ProgressListener prematurely stops navigation on subframe location changes
Categories
(Remote Protocol :: Agent, defect, P3)
Tracking
(firefox154 fixed)
| Tracking | Status | |
|---|---|---|
| firefox154 | --- | fixed |
People
(Reporter: whimboo, Assigned: whimboo)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [webdriver:m21], [wptsync upstream])
Attachments
(1 file)
Noticed this bug while updating my patch on bug 1664165, and some web-platform tests still failing.
The ProgressListener class in remote/shared/Navigate.sys.mjs registers with NOTIFY_LOCATION on the top-level WebProgress. With this flag, onLocationChange receives location-change events from all frames — including subframes — not just the monitored top-level document.
When a subframe performs a same-document navigation (hash change, history.pushState, or history.replaceState), onLocationChange fires with LOCATION_CHANGE_SAME_DOCUMENT. The current code unconditionally calls stop() in that case, causing the navigation promise to resolve before the top-level document has finished loading.
To reproduce navigate to a page that loads an iframe which calls history.replaceState (e.g. /html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-history-replaceState.html in WPT). The navigation command (WebDriver:Navigate / browsingContext.navigate) returns before the page is ready, so any script the test runner injects immediately after (window.__wptrunner_process_next_event) does not exist yet, resulting in a TypeError.
To fix this we should update onLocationChange and skip the LOCATION_CHANGE_SAME_DOCUMENT handling when progress.browsingContext !== this.#webProgress.browsingContext — i.e. when the event originates from a subframe rather than the monitored top-level context.
| Assignee | ||
Comment 1•13 days ago
|
||
Updated•13 days ago
|
Updated•13 days ago
|
| Assignee | ||
Comment 2•13 days ago
|
||
Actually the test /html/cross-origin-embedder-policy/require-corp.https.html shows a similar failure when using the ProgressListener. The page loads fine, but CORP blocks a subframe resource, causing a LOCATION_CHANGE_ERROR_PAGE event for the subframe's webProgress. The ProgressListener's onLocationChange picks this up as well without any subframe check and incorrectly aborts the navigation with "Reached error page: Address rejected".
| Assignee | ||
Updated•13 days ago
|
| Comment hidden (Intermittent Failures Robot) |
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/61086 for changes under testing/web-platform/tests
Comment 6•8 days ago
|
||
| bugherder | ||
Upstream PR merged by moz-wptsync-bot
Updated•1 day ago
|
Description
•