Bug 297939
| Summary: | Race condition between module script execution and FrameLoader's document completion check. | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Basuke Suzuki <basuke> |
| Component: | New Bugs | Assignee: | Basuke Suzuki <basuke> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Basuke Suzuki
When module scripts access document.readyState during their execution, they incorrectly receive "complete" when they should receive "interactive" according to the HTML specification.
DESCRIPTION:
Module scripts should execute after DOMContentLoaded but before the load event, at which point document.readyState should be "interactive". However, due to a race condition between JavaScript execution and FrameLoader's readyState control, module scripts see the state as "complete".
STEPS TO REPRODUCE:
1. Load a page with a module script that checks document.readyState
2. The module script will see "complete" instead of "interactive"
Test case: load-event-timing.html
EXPECTED RESULTS:
Module scripts should see document.readyState as "interactive" during their execution phase.
ACTUAL RESULTS:
Module scripts see document.readyState as "complete".
Reproducibility is sometimes because it doesn’t happen when script module is simple and there’s no other classic inline script. This tells the fact that this must be dependent on the surrounding situation.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Basuke Suzuki
rdar://159112160
Basuke Suzuki
Pull request: https://github.com/WebKit/WebKit/pull/49910
EWS
Committed 299282@main (f1e55dd8fe6f): <https://commits.webkit.org/299282@main>
Reviewed commits have been landed. Closing PR #49910 and removing active labels.
Basuke Suzuki
This was reverted on https://commits.webkit.org/301215@main
Basuke Suzuki
<rdar://problem/162211435>
Basuke Suzuki
Pull request: https://github.com/WebKit/WebKit/pull/52127
EWS
Committed 301345@main (85e09b241c12): <https://commits.webkit.org/301345@main>
Reviewed commits have been landed. Closing PR #52127 and removing active labels.