Repository navigation
Handle module resolution when there is no active script - #4181
Conversation
domfarolino
left a comment
There was a problem hiding this comment.
Thanks again for taking this! This looks good to me. Regarding changing the name of "default classic script fetch options" => "default script fetch options" after this PR (which was briefly discussed in the original issue), I am indifferent.
Can start looking at tests for this, but with finals coming up no guarantees on a timeline.
| corresponding module script</a>, or in <span>HostImportModuleDynamically</span>).</p></li> | ||
|
|
||
| <li><p>Let <var>resolved module script</var> be <var>moduleMap</var>[<var>url</var>]. (This entry | ||
| must <span data-x="map exists">exist</span> for us to have gotten to this point.)</p></li> |
There was a problem hiding this comment.
Not related to the changes here, and entirely optional, but I kind of like the idea of asserting that moduleMap[url] exists, instead of having this off to the side.
annevk
left a comment
There was a problem hiding this comment.
I initially had some nits on using less spaces in variable names, but the mixture in this algorithm was already present. It might be nice to cleanup.
One other thought I had was that perhaps an abstraction is in order, but perhaps that gets too messy with the fetch options?
I don't think we guarantee that? e.g., in Blink (with |
|
@annevk yeah, the abstraction isn't worth it, I think. @gsnedders that is what I was afraid of. I guess then I should file a WPT bug asking for test infra for clicks which behave the same way as actual user clicks? In the meantime, should we merge this without tests, as it's probably untestable? |
|
I guess I could write manual tests... |
|
I wrote https://t3.glitch.me yesterday as a start for some Chrome debugging...with a little more work some of these might pass as manual tests, however I prefer:
|
Yeah. Do you know if there's any way to do this in Blink's LayoutTests today, FWIW? |
|
I don't know offhand, but I'll probably poke around at least a bit and report back, before filing a request. (Including verifying that the code you linked me to doesn't do something unexpectedly good, like queuing a task.) |
5355e33 to
1ac8d01
Compare
Closes #3295. This also fixes a related inaccurate assert in EnqueueJob, putting in guards for a null active script there as well and adding examples explaining the various scenarios.
1ac8d01 to
49423b9
Compare
|
This is ready for (and needs) re-review, as I've now incorporated some of the job-related stuff that was also discussed in #3295. |
|
Manual-for-now tests at web-platform-tests/wpt#14158; discussion on how to automate at web-platform-tests/wpt#14158. |
| is a built-in function that does not originate from any particular <span | ||
| data-x="concept-script">script</span>.</p> | ||
|
|
||
| <p>With this step in place, the active script is propagated from the above code into the job, |
There was a problem hiding this comment.
Wasn't the plan to remove jobs completely and have JavaScript instead queue things to the host? That would also resolve this, no?
There was a problem hiding this comment.
That is the current setup, just done via money patch. It's not a "removal" though; the things JavaScript posts are still called "jobs", which we convert to microtasks.
| <p>In this case, the JavaScript function for the <span data-x="event handlers">event | ||
| handler</span> will be created by the <span data-x="getting the current value of the event | ||
| handler">get the current value of the event handler</span> algorithm as a direct result of user | ||
| action, with no script on the stack (i.e. no <span>active script</span>). Thus, when the |
annevk
left a comment
There was a problem hiding this comment.
Seems fine, but please address the nit (maybe at some point we should do those programmatically). I also noticed some lack of "If ..., then ..." but we're not consistent so...
…(), a=testonly Automatic update from web-platform-testsAdd tests for no active script in import() (#14157) Follows whatwg/html#4181. -- wpt-commits: 5241a3fe2c638f9fadcc040f39f3e6a71a2be2e1 wpt-pr: 14157
…(), a=testonly Automatic update from web-platform-testsAdd tests for no active script in import() (#14157) Follows whatwg/html#4181. -- wpt-commits: 5241a3fe2c638f9fadcc040f39f3e6a71a2be2e1 wpt-pr: 14157
…(), a=testonly Automatic update from web-platform-testsAdd tests for no active script in import() (#14157) Follows whatwg/html#4181. -- wpt-commits: 5241a3fe2c638f9fadcc040f39f3e6a71a2be2e1 wpt-pr: 14157
…(), a=testonly Automatic update from web-platform-testsAdd tests for no active script in import() (#14157) Follows whatwg/html#4181. -- wpt-commits: 5241a3fe2c638f9fadcc040f39f3e6a71a2be2e1 wpt-pr: 14157
Closes #4267. Related to previous work in #4181. Tests: web-platform-tests/wpt#15251
Closes whatwg#4267. Related to previous work in whatwg#4181. Tests: web-platform-tests/wpt#15251
Closes whatwg#4267. Related to previous work in whatwg#4181. Tests: web-platform-tests/wpt#15251
…(), a=testonly Automatic update from web-platform-testsAdd tests for no active script in import() (#14157) Follows whatwg/html#4181. -- wpt-commits: 5241a3fe2c638f9fadcc040f39f3e6a71a2be2e1 wpt-pr: 14157 UltraBlame original commit: a1cc7364d13d9e2d8561042a2e204792ac344496
…(), a=testonly Automatic update from web-platform-testsAdd tests for no active script in import() (#14157) Follows whatwg/html#4181. -- wpt-commits: 5241a3fe2c638f9fadcc040f39f3e6a71a2be2e1 wpt-pr: 14157 UltraBlame original commit: 8b5324f6bd04819422f05d72d7d72219ef2b1b2b
…(), a=testonly Automatic update from web-platform-testsAdd tests for no active script in import() (#14157) Follows whatwg/html#4181. -- wpt-commits: 5241a3fe2c638f9fadcc040f39f3e6a71a2be2e1 wpt-pr: 14157 UltraBlame original commit: a1cc7364d13d9e2d8561042a2e204792ac344496
…(), a=testonly Automatic update from web-platform-testsAdd tests for no active script in import() (#14157) Follows whatwg/html#4181. -- wpt-commits: 5241a3fe2c638f9fadcc040f39f3e6a71a2be2e1 wpt-pr: 14157 UltraBlame original commit: 8b5324f6bd04819422f05d72d7d72219ef2b1b2b
…(), a=testonly Automatic update from web-platform-testsAdd tests for no active script in import() (#14157) Follows whatwg/html#4181. -- wpt-commits: 5241a3fe2c638f9fadcc040f39f3e6a71a2be2e1 wpt-pr: 14157 UltraBlame original commit: a1cc7364d13d9e2d8561042a2e204792ac344496
…(), a=testonly Automatic update from web-platform-testsAdd tests for no active script in import() (#14157) Follows whatwg/html#4181. -- wpt-commits: 5241a3fe2c638f9fadcc040f39f3e6a71a2be2e1 wpt-pr: 14157 UltraBlame original commit: 8b5324f6bd04819422f05d72d7d72219ef2b1b2b
…(), a=testonly Automatic update from web-platform-testsAdd tests for no active script in import() (#14157) Follows whatwg/html#4181. -- wpt-commits: 5241a3fe2c638f9fadcc040f39f3e6a71a2be2e1 wpt-pr: 14157
…(), a=testonly Automatic update from web-platform-testsAdd tests for no active script in import() (#14157) Follows whatwg/html#4181. -- wpt-commits: 5241a3fe2c638f9fadcc040f39f3e6a71a2be2e1 wpt-pr: 14157
Closes #3295.
Thanks @jonco3 for the prompt on fixing this.
Tests: I believe this is technically not tested yet, although there are a lot of adjacent tests, e.g. https://github.com/web-platform-tests/wpt/blob/fca3dc941825b298617f8bf6c9ce7c196b4de6f5/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-base-url-inline-module.html#L29-L32 . But those don't test the specific scenario here, because when you call the
.onclickgetter, there is an active script.Instead we need a test that uses the fancy new testdriver thingies to actually click the div (instead of having JS call
div.onclick()as the existing tests do).Even that might not really work; @gsnedders do you know if the JS engine has script "on the stack" when testdriver clicks a div? (The answer we want is "no", just like when a user clicks the div.)
Ideally those tests should actually have a different document base URL than script base URL, e.g. by using an external script.
It would be really appreciated if someone else were up for writing those tests; I would be happy to review.