From ff0fe13c9f57379ca16d5cada450fc18e0f0daca Mon Sep 17 00:00:00 2001 From: Alexandre Poirot Date: Mon, 29 Apr 2019 13:42:55 +0000 Subject: [PATCH] Bug 1543095 - Pass `frameId` to all Page events. r=ato Differential Revision: https://phabricator.services.mozilla.com/D28957 --HG-- extra : moz-landing-system : lando --- remote/domains/content/Page.jsm | 6 +++--- remote/test/browser/browser_page_frameNavigated.js | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/remote/domains/content/Page.jsm b/remote/domains/content/Page.jsm index 8cc6087679b4..8b0372c138a5 100644 --- a/remote/domains/content/Page.jsm +++ b/remote/domains/content/Page.jsm @@ -119,10 +119,10 @@ class Page extends ContentProcessDomain { break; case "pageshow": - this.emit("Page.loadEventFired", {timestamp}); + this.emit("Page.loadEventFired", {timestamp, frameId}); // XXX this should most likely be sent differently - this.emit("Page.navigatedWithinDocument", {timestamp}); - this.emit("Page.frameStoppedLoading", {timestamp}); + this.emit("Page.navigatedWithinDocument", {timestamp, frameId, url}); + this.emit("Page.frameStoppedLoading", {timestamp, frameId}); break; } } diff --git a/remote/test/browser/browser_page_frameNavigated.js b/remote/test/browser/browser_page_frameNavigated.js index c3f6e5080a48..bfe8eecb812f 100644 --- a/remote/test/browser/browser_page_frameNavigated.js +++ b/remote/test/browser/browser_page_frameNavigated.js @@ -97,6 +97,16 @@ async function testCDP() { is(frameNavigated.frame.url, url, "frameNavigated url is the same being given to " + "Page.navigate"); + const navigatedWithinDocument = resolutions.get("navigatedWithinDocument"); + is(navigatedWithinDocument.frameId, frameId, "navigatedWithinDocument frameId is " + + "the same than the one returned by Page.navigate"); + is(navigatedWithinDocument.url, url, "navigatedWithinDocument url is the same than " + + "the one being given to Page.navigate"); + + const frameStoppedLoading = resolutions.get("frameStoppedLoading"); + is(frameStoppedLoading.frameId, frameId, "frameStoppedLoading frameId is the same " + + "than the one returned by Page.navigate"); + await client.close(); ok(true, "The client is closed");