mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1564360 - Ignore iframes for Page.frameNavigated r=remote-protocol-reviewers,ochameau
WIP to illustrate a fix for this issue Differential Revision: https://phabricator.services.mozilla.com/D37402 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
1a0c0179a5
commit
337fec9e49
@ -65,7 +65,7 @@ class ContextObserver {
|
||||
|
||||
handleEvent({ type, target, persisted }) {
|
||||
const window = target.defaultView;
|
||||
if (window.top != this.chromeEventHandler.ownerGlobal) {
|
||||
if (window != this.chromeEventHandler.ownerGlobal) {
|
||||
// Ignore iframes for now.
|
||||
return;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ support-files =
|
||||
chrome-remote-interface.js
|
||||
doc_network_requestWillBeSent.html
|
||||
doc_page_frameNavigated.html
|
||||
doc_page_frameNavigated_iframe.html
|
||||
file_network_requestWillBeSent.js
|
||||
head.js
|
||||
|
||||
@ -16,6 +17,7 @@ support-files =
|
||||
[browser_network_requestWillBeSent.js]
|
||||
[browser_page_bringToFront.js]
|
||||
[browser_page_frameNavigated.js]
|
||||
[browser_page_frameNavigated_iframe.js]
|
||||
[browser_page_runtime_events.js]
|
||||
[browser_runtime_callFunctionOn.js]
|
||||
[browser_runtime_evaluate.js]
|
||||
|
42
remote/test/browser/browser_page_frameNavigated_iframe.js
Normal file
42
remote/test/browser/browser_page_frameNavigated_iframe.js
Normal file
@ -0,0 +1,42 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test that frameNavigated is not fired for iframes embedded in the page.
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,default-test-page";
|
||||
const PAGE_URL =
|
||||
"http://example.com/browser/remote/test/browser/doc_page_frameNavigated_iframe.html";
|
||||
|
||||
const promises = new Set();
|
||||
const resolutions = new Map();
|
||||
|
||||
add_task(async function() {
|
||||
const { client } = await setupTestForUri(TEST_URI);
|
||||
|
||||
const { Page } = client;
|
||||
await Page.enable();
|
||||
|
||||
// Store all frameNavigated events in an array
|
||||
const frameNavigatedEvents = [];
|
||||
Page.frameNavigated(e => frameNavigatedEvents.push(e));
|
||||
|
||||
info("Navigate to a page containing an iframe");
|
||||
const onStoppedLoading = Page.frameStoppedLoading();
|
||||
const { frameId } = await Page.navigate({ url: PAGE_URL });
|
||||
await onStoppedLoading;
|
||||
|
||||
is(frameNavigatedEvents.length, 1, "Received only 1 frameNavigated event");
|
||||
is(
|
||||
frameNavigatedEvents[0].frame.id,
|
||||
frameId,
|
||||
"Received the correct frameId for the frameNavigated event"
|
||||
);
|
||||
|
||||
await client.close();
|
||||
ok(true, "The client is closed");
|
||||
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
await RemoteAgent.close();
|
||||
});
|
9
remote/test/browser/doc_page_frameNavigated_iframe.html
Normal file
9
remote/test/browser/doc_page_frameNavigated_iframe.html
Normal file
@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test page for frameNavigated_iframe</title>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src="data:text/html,somecontent"></iframe>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user