mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1578465 - Remove the content-utils.js framescript, r=nika
This also updates the two functions (BrowserTestUtils.firstBrowserLoaded, browser_broadcastchannel.js#browserFrameLoaded) that rely on the previous event to use the new one. Differential Revision: https://phabricator.services.mozilla.com/D49002 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
b4ca3b2db3
commit
3b22805481
@ -50,17 +50,8 @@ async function addBrowserFrameInUserContext(uri, userContextId) {
|
||||
}
|
||||
|
||||
function browserFrameLoaded(browser) {
|
||||
const mm = browser.messageManager;
|
||||
return new Promise(resolve => {
|
||||
const eventName = "browser-test-utils:loadEvent";
|
||||
mm.addMessageListener(eventName, function onLoad(msg) {
|
||||
if (msg.target != browser) {
|
||||
return;
|
||||
}
|
||||
mm.removeMessageListener(eventName, onLoad);
|
||||
resolve(msg.data.internalURL);
|
||||
});
|
||||
});
|
||||
let event = "BrowserTestUtils:ContentEvent:load";
|
||||
return BrowserTestUtils.waitForEvent(browser, event);
|
||||
}
|
||||
|
||||
function removeBrowserFrame({ browser }) {
|
||||
|
@ -43,11 +43,6 @@ XPCOMUtils.defineLazyServiceGetters(this, {
|
||||
],
|
||||
});
|
||||
|
||||
Services.mm.loadFrameScript(
|
||||
"chrome://mochikit/content/tests/BrowserTestUtils/content-utils.js",
|
||||
true
|
||||
);
|
||||
|
||||
const PROCESSSELECTOR_CONTRACTID = "@mozilla.org/ipc/processselector;1";
|
||||
const OUR_PROCESSSELECTOR_CID = Components.ID(
|
||||
"{f9746211-3d53-4465-9aeb-ca0d96de0253}"
|
||||
@ -479,18 +474,20 @@ var BrowserTestUtils = {
|
||||
* @resolves Once the selected browser fires its load event.
|
||||
*/
|
||||
firstBrowserLoaded(win, aboutBlank = true, checkFn = null) {
|
||||
let mm = win.messageManager;
|
||||
return this.waitForMessage(mm, "browser-test-utils:loadEvent", msg => {
|
||||
if (checkFn) {
|
||||
return checkFn(msg.target);
|
||||
return this.waitForEvent(
|
||||
win,
|
||||
"BrowserTestUtils:ContentEvent:load",
|
||||
true,
|
||||
event => {
|
||||
if (checkFn) {
|
||||
return checkFn(event.target);
|
||||
}
|
||||
return (
|
||||
win.gBrowser.selectedBrowser.currentURI.spec !== "about:blank" ||
|
||||
aboutBlank
|
||||
);
|
||||
}
|
||||
|
||||
let selectedBrowser = win.gBrowser.selectedBrowser;
|
||||
return (
|
||||
msg.target == selectedBrowser &&
|
||||
(aboutBlank || selectedBrowser.currentURI.spec != "about:blank")
|
||||
);
|
||||
});
|
||||
);
|
||||
},
|
||||
|
||||
_webProgressListeners: new Set(),
|
||||
|
@ -1,35 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
"use strict";
|
||||
|
||||
addEventListener(
|
||||
"DOMContentLoaded",
|
||||
function(event) {
|
||||
let subframe = event.target != content.document;
|
||||
// For error page, internalURL is 'about:neterror?...', and visibleURL
|
||||
// is the original URL.
|
||||
sendAsyncMessage("browser-test-utils:DOMContentLoadedEvent", {
|
||||
subframe,
|
||||
internalURL: event.target.documentURI,
|
||||
visibleURL: content.document.location.href,
|
||||
});
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
addEventListener(
|
||||
"load",
|
||||
function(event) {
|
||||
let subframe = event.target != content.document;
|
||||
sendAsyncMessage("browser-test-utils:loadEvent", {
|
||||
subframe,
|
||||
internalURL: event.target.documentURI,
|
||||
visibleURL: content.document.location.href,
|
||||
});
|
||||
},
|
||||
true
|
||||
);
|
@ -65,7 +65,6 @@ FINAL_TARGET_FILES.content.tests.SimpleTest += [
|
||||
FINAL_TARGET_FILES.content.tests.BrowserTestUtils += [
|
||||
'BrowserTestUtils/content/content-about-page-utils.js',
|
||||
'BrowserTestUtils/content/content-task.js',
|
||||
'BrowserTestUtils/content/content-utils.js',
|
||||
]
|
||||
|
||||
MOCHITEST_MANIFESTS += [
|
||||
|
Loading…
Reference in New Issue
Block a user