Closed Bug 1890929 Opened 1 year ago Closed 24 days ago

Inline module scripts with no dependencies should be executed after a full task

Categories

(Core :: DOM: Core & HTML, defect, P4)

defect

Tracking

()

RESOLVED FIXED
141 Branch
Tracking Status
firefox141 --- fixed

People

(Reporter: d, Assigned: allstars.chh)

References

Details

Attachments

(3 files)

See test at https://github.com/web-platform-tests/wpt/pull/45660 and spec discussion at https://github.com/whatwg/html/pull/10272.

It appears Gecko instead runs them immediately.

Chrome and Safari run them after a full task. If you believe that's a good idea, please let me know and we can start a spec discussion. I don't think Gecko's behavior is very good though because it's impossible to spec cleanly, given the existence of top-level await.

jonco, smaug, who should look at this?

Flags: needinfo?(smaug)
Flags: needinfo?(jcoppeard)

The latest plan is to run them after a full task. The spec and tests PR have been updated.

(In reply to Henri Sivonen (:hsivonen) from comment #1)

jonco, smaug, who should look at this?

jonco :)

Flags: needinfo?(smaug)
Severity: -- → S3

Yoshi, could you look into this at some point?

Flags: needinfo?(jcoppeard) → needinfo?(allstars.chh)
See Also: → 1891413
Assignee: nobody → allstars.chh
Flags: needinfo?(allstars.chh)
Priority: -- → P4
Summary: Inline module scripts with no dependencies should execute after a single microtask → Inline module scripts with no dependencies should be executed after a full task

Refactors execution behavior to run asynchronously for inline scripts that are
not generated by the parser.

spec:
https://html.spec.whatwg.org/#prepare-the-script-element

Step 32. If el does not have a src content attribute:
2. type: "module"
...
3. Fetch an inline module script graph, given source text, base URL, settings object, options, and with the following steps given result:
1. Queue an element task on the networking task source given el to perform the following steps:
1. Mark as ready el given result.

Step 33. If ... el's type is "module":
3. Otherwise, if el is not parser-inserted:
3.2.1 Execute the script element scripts[0].

According to the spec, non-parser-inserted inline module scripts should
execute in order.

https://html.spec.whatwg.org/#prepare-the-script-element

Step 33. If ... el's type is "module":
...
3. Otherwise, if el is not parser-inserted:
1. Let scripts be el's preparation-time document's list of scripts that will execute in order as soon as possible.
2. Append el to scripts.

QA Whiteboard: [qa-triage-done-c142/b141]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: