Closed Bug 1543095 Opened 5 months ago Closed 4 months ago

Emit Page.frameNavigated event

Categories

(Remote Protocol :: Page, enhancement, P1)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ochameau, Assigned: ochameau)

References

(Blocks 5 open bugs)

Details

Attachments

(2 files)

The documentation of this event is sparse:
https://chromedevtools.github.io/devtools-protocol/tot/Page#event-frameNavigated
Page.frameNavigated:
Fired once navigation of the frame has completed. Frame is now associated with the new loader.

Chromium implementation:
https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/inspector/inspector_page_agent.cc?dr=CSs&g=0&l=891-896

But from what I can see when running Wordpress test suite, this event seems to be sent earlier than what the documentation suggests.

And by looking at Puppeteer usage of it:
https://github.com/GoogleChrome/puppeteer/blob/0c8ace2fab4ec7c7f8add21313760ca4c438d256/lib/FrameManager.js#L224-L234
You can see that it has to fire the earliest, so that the Frame instance created on line 232 is registered in the global Map on line 234.

So that later, we have the Frame instance for the given frameId available when we receive all the other events.
For example here, on lify cycle events:
https://github.com/GoogleChrome/puppeteer/blob/0c8ace2fab4ec7c7f8add21313760ca4c438d256/lib/FrameManager.js#L134-L138

I would say that Page.frameNavigated has to be fired the earliest it can, as soon as we can compute the frameId of a frame. The location will most likely be invalid and still refer to the previous origin, but I imagine some other event is going to update the location. Like Frame.navigatedWithinDocument.

Type: defect → enhancement
Blocks: 1543098
Priority: -- → P2
Attachment #9058289 - Attachment description: Bug 1543095 - Implement Page.frameNavigated → Bug 1543095 - Implement Page.frameNavigated.
Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/063f7a6e6362
Implement Page.frameNavigated. r=ato
https://hg.mozilla.org/integration/autoland/rev/022cef1ce6b9
Pass `frameId` to all Page events. r=ato
Blocks: 1548102
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Priority: P2 → P1
You need to log in before you can comment on or make changes to this bug.