Closed Bug 1636453 Opened 4 years ago Closed 2 years ago

Only emit Page.navigatedWithinDocument for history API usage or anchor navigation

Categories

(Remote Protocol :: CDP, defect, P3)

defect
Points:
2

Tracking

(firefox102 fixed)

RESOLVED FIXED
102 Branch
Tracking Status
firefox102 --- fixed

People

(Reporter: impossibus, Assigned: jdescottes)

References

Details

(Whiteboard: [bidi-m3-mvp])

Attachments

(2 files)

Right now we do emit this event but without any checks, so it gets emitted in all cases.

This breaks Page.waitForNavigation in Puppeteer, for example, where we see a race with Network events.

The hashchange event listener should help here. At least for the first part of the event definition:

Fired when same-document navigation happens, e.g. due to history API usage or anchor navigation.

Whereby history API usage is related to Page.navigateToHistoryEntry (bug 1609152).

So we might want to fix both at once.

Summary: Implement Page.navigatedWithinDocument → Only emit Page.navigatedWithinDocument for history API usage or anchor navigation
Whiteboard: [puppeteer-beta-reserve] → [puppeteer-beta2-mvp]
Component: CDP: Page → CDP

Trying to move navigatedWithinDocument to hashchange breaks a few navigations with the current implementation of puppeteer. See for more details, but the summary is that to do this we need to first make sure that loaderId is correctly provided for frameNavigated events, even for navigations which don't hit the network.

Whiteboard: [puppeteer-beta2-mvp] → [webdriver:triage][puppeteer-beta2-mvp]
Depends on: 1770135

Depends on D146984

This is needed to be forward compatible with new versions of puppeteer
The navigatedWithinDocument event should only have been emitted for same
document navigation (either hashchange or history navigation), but it was
emitted on load.

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED

Depends on D146985

The previous changeset changed the implementation of navigatedWithinDocument to
be emitted in the proper scenarios (ie, same document navigation).

However our Page.navigate implementation would still timeout waiting on a
network request if you tried to programmatically perform a hash navigation.
Meaning hash navigation was only working when triggered from the page.

With this changeset, we try to detect hash navigations in Page.navigate and
treat them as "network-less" navigations (same as for non http/https navigations)

Severity: -- → S3
Priority: P2 → P3
Whiteboard: [webdriver:triage][puppeteer-beta2-mvp] → [bidi-m3-mvp]
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0133613140be
[cdp] Move Page.navigatedWithinDocument to hashChange r=webdriver-reviewers,whimboo
https://hg.mozilla.org/integration/autoland/rev/ad7a8c63d820
[cdp] Support Page.navigate for hash navigation r=webdriver-reviewers,whimboo
Points: --- → 2
Regressions: 1770849
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 102 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: