Bug 1602898: Rename Window.getWindowGlobalChild() to .windowGlobalChild. r=farre

Differential Revision: https://phabricator.services.mozilla.com/D56609

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kris Maglione 2020-01-21 18:48:26 +00:00
parent c3eb36bee1
commit aa0306477e
29 changed files with 57 additions and 73 deletions

View File

@ -112,7 +112,7 @@ class WebRTCChild extends JSWindowActorChild {
}
function getActorForWindow(window) {
let windowGlobal = window.getWindowGlobalChild();
let windowGlobal = window.windowGlobalChild;
try {
if (windowGlobal) {
return windowGlobal.getActor("WebRTC");

View File

@ -40,10 +40,7 @@ function init() {
window.addEventListener(
"pageshow",
e => {
window
.getWindowGlobalChild()
.getActor("LightweightTheme")
.handleEvent(e);
window.windowGlobalChild.getActor("LightweightTheme").handleEvent(e);
},
{ once: true }
);

View File

@ -63,10 +63,7 @@ function HistorySidebarInit() {
window.addEventListener(
"pageshow",
e => {
window
.getWindowGlobalChild()
.getActor("LightweightTheme")
.handleEvent(e);
window.windowGlobalChild.getActor("LightweightTheme").handleEvent(e);
},
{ once: true }
);

View File

@ -1929,7 +1929,7 @@ var gPrivacyPane = {
*/
showPasswords() {
if (LoginHelper.managementURI) {
let loginManager = window.getWindowGlobalChild().getActor("LoginManager");
let loginManager = window.windowGlobalChild.getActor("LoginManager");
loginManager.sendAsyncMessage("PasswordManager:OpenPreferences", {
entryPoint: "preferences",
});

View File

@ -59,9 +59,7 @@ class SiteSpecificBrowserChild extends JSWindowActorChild {
}
function getActor(docShell) {
return docShell.domWindow
.getWindowGlobalChild()
.getActor("SiteSpecificBrowser");
return docShell.domWindow.windowGlobalChild.getActor("SiteSpecificBrowser");
}
// JS actors can't generally be XPCOM objects so we must use a separate class.

View File

@ -35,10 +35,7 @@ let onLoaded = () => {
window.addEventListener(
"pageshow",
e => {
window
.getWindowGlobalChild()
.getActor("LightweightTheme")
.handleEvent(e);
window.windowGlobalChild.getActor("LightweightTheme").handleEvent(e);
},
{ once: true }
);

View File

@ -89,8 +89,8 @@ function getActorFromWindow(contentWindow, name = "FormAutofill") {
return null;
}
return contentWindow.getWindowGlobalChild
? contentWindow.getWindowGlobalChild().getActor(name)
return contentWindow.windowGlobalChild
? contentWindow.windowGlobalChild.getActor(name)
: null;
}

View File

@ -919,7 +919,7 @@ class FormAutofillCreditCardSection extends FormAutofillSection {
return null;
}
let actor = window.getWindowGlobalChild().getActor("FormAutofill");
let actor = window.windowGlobalChild.getActor("FormAutofill");
return actor.sendQuery("FormAutofill:GetDecryptedString", {
cipherText,
reauth,

View File

@ -449,9 +449,6 @@ Minimal Example Actors
// resource://testing-common/TestParent.jsm
var EXPORTED_SYMBOLS = ["TestParent"];
class TestParent extends JSWindowActorParent {
constructor() {
super();
}
...
}
@ -460,9 +457,6 @@ Minimal Example Actors
// resource://testing-common/TestChild.jsm
var EXPORTED_SYMBOLS = ["TestChild"];
class TestChild extends JSWindowActorChild {
constructor() {
super();
}
...
}
@ -475,7 +469,7 @@ Minimal Example Actors
let parentActor = this.browser.browsingContext.currentWindowGlobal.getActor("Test");
// get child side actor
let childActor = content.window.getWindowGlobalChild().getActor("Test");
let childActor = content.windowGlobalChild.getActor("Test");
.. _Electrolysis Project: https://wiki.mozilla.org/Electrolysis
.. _IPC Actors: https://developer.mozilla.org/en-US/docs/Mozilla/IPDL/Tutorial

View File

@ -13,7 +13,7 @@ declTest("destroy actor by iframe remove", {
content.document.body.appendChild(frame);
await ContentTaskUtils.waitForEvent(frame, "load");
is(content.window.frames.length, 1, "There should be an iframe.");
let child = frame.contentWindow.window.getWindowGlobalChild();
let child = frame.contentWindow.windowGlobalChild;
let actorChild = child.getActor("Test");
ok(actorChild, "JSWindowActorChild should have value.");
@ -67,7 +67,7 @@ declTest("destroy actor by page navigates", {
await SpecialPowers.spawn(browser, [TEST_URL], async function(url) {
let frame = content.document.querySelector("iframe");
frame.contentWindow.location = url;
let child = frame.contentWindow.window.getWindowGlobalChild();
let child = frame.contentWindow.windowGlobalChild;
let actorChild = child.getActor("Test");
ok(actorChild, "JSWindowActorChild should have value.");

View File

@ -11,7 +11,7 @@ declTest("getActor on both sides", {
is(actorParent.manager, parent, "manager should match WindowGlobalParent.");
await SpecialPowers.spawn(browser, [], async function() {
let child = content.window.getWindowGlobalChild();
let child = content.windowGlobalChild;
ok(child, "WindowGlobalChild should have value.");
is(
child.isInProcess,

View File

@ -17,7 +17,7 @@ declTest("getActor with mismatch", {
);
await SpecialPowers.spawn(browser, [], async function() {
let child = content.getWindowGlobalChild();
let child = content.windowGlobalChild;
ok(child, "WindowGlobalChild should have value.");
Assert.throws(
@ -38,7 +38,7 @@ declTest("getActor with matches", {
ok(parent.getActor("Test"), "JSWindowActorParent should have value.");
await SpecialPowers.spawn(browser, [], async function() {
let child = content.getWindowGlobalChild();
let child = content.windowGlobalChild;
ok(child, "WindowGlobalChild should have value.");
ok(child.getActor("Test"), "JSWindowActorChild should have value.");
});
@ -59,7 +59,7 @@ declTest("getActor with iframe matches", {
is(content.frames.length, 1, "There should be an iframe.");
await content.SpecialPowers.spawn(frame, [], () => {
let child = content.getWindowGlobalChild();
let child = content.windowGlobalChild;
Assert.ok(
child.getActor("Test"),
"JSWindowActorChild should have value."
@ -83,7 +83,7 @@ declTest("getActor with iframe mismatch", {
is(content.frames.length, 1, "There should be an iframe.");
await content.SpecialPowers.spawn(frame, [], () => {
let child = content.getWindowGlobalChild();
let child = content.windowGlobalChild;
Assert.throws(
() => child.getActor("Test"),
/NS_ERROR_NOT_AVAILABLE/,
@ -102,7 +102,7 @@ declTest("getActor with remoteType match", {
ok(parent.getActor("Test"), "JSWindowActorParent should have value.");
await SpecialPowers.spawn(browser, [], async function() {
let child = content.getWindowGlobalChild();
let child = content.windowGlobalChild;
ok(child, "WindowGlobalChild should have value.");
ok(child.getActor("Test"), "JSWindowActorChild should have value.");
});
@ -115,7 +115,7 @@ declTest("getActor with iframe remoteType match", {
async test(browser) {
await SpecialPowers.spawn(browser, [TEST_URL], async function(url) {
let child = content.getWindowGlobalChild();
let child = content.windowGlobalChild;
ok(child, "WindowGlobalChild should have value.");
ok(child.getActor("Test"), "JSWindowActorChild should have value.");
@ -127,7 +127,7 @@ declTest("getActor with iframe remoteType match", {
is(content.frames.length, 1, "There should be an iframe.");
await content.SpecialPowers.spawn(frame, [], () => {
child = content.getWindowGlobalChild();
child = content.windowGlobalChild;
Assert.ok(
child.getActor("Test"),
"JSWindowActorChild should have value."
@ -150,7 +150,7 @@ declTest("getActor with remoteType mismatch", {
);
await SpecialPowers.spawn(browser, [], async function() {
let child = content.getWindowGlobalChild();
let child = content.windowGlobalChild;
ok(child, "WindowGlobalChild should have value.");
Assert.throws(
() => child.getActor("Test"),
@ -170,7 +170,7 @@ declTest("getActor without allFrames", {
let frame = content.document.createElement("iframe");
content.document.body.appendChild(frame);
is(content.frames.length, 1, "There should be an iframe.");
let child = frame.contentWindow.getWindowGlobalChild();
let child = frame.contentWindow.windowGlobalChild;
Assert.throws(
() => child.getActor("Test"),
/NS_ERROR_NOT_AVAILABLE/,
@ -189,7 +189,7 @@ declTest("getActor with allFrames", {
let frame = content.document.createElement("iframe");
content.document.body.appendChild(frame);
is(content.frames.length, 1, "There should be an iframe.");
let child = frame.contentWindow.getWindowGlobalChild();
let child = frame.contentWindow.windowGlobalChild;
let actorChild = child.getActor("Test");
ok(actorChild, "JSWindowActorChild should have value.");
});

View File

@ -9,13 +9,13 @@ declTest("test observer triggering actor creation", {
const TOPIC = "test-js-window-actor-child-observer";
Services.obs.notifyObservers(content.window, TOPIC, "dataString");
let child = content.window.getWindowGlobalChild();
let child = content.windowGlobalChild;
let actorChild = child.getActor("Test");
ok(actorChild, "JSWindowActorChild should have value.");
let { subject, topic, data } = actorChild.lastObserved;
is(
subject.getWindowGlobalChild().getActor("Test"),
subject.windowGlobalChild.getActor("Test"),
actorChild,
"Should have been recieved on the right actor"
);
@ -31,13 +31,13 @@ declTest("test observers with null data", {
const TOPIC = "test-js-window-actor-child-observer";
Services.obs.notifyObservers(content.window, TOPIC);
let child = content.window.getWindowGlobalChild();
let child = content.windowGlobalChild;
let actorChild = child.getActor("Test");
ok(actorChild, "JSWindowActorChild should have value.");
let { subject, topic, data } = actorChild.lastObserved;
is(
subject.getWindowGlobalChild().getActor("Test"),
subject.windowGlobalChild.getActor("Test"),
actorChild,
"Should have been recieved on the right actor"
);
@ -52,7 +52,7 @@ declTest("observers don't notify with wrong window", {
await SpecialPowers.spawn(browser, [], async function() {
const TOPIC = "test-js-window-actor-child-observer";
Services.obs.notifyObservers(null, TOPIC);
let child = content.window.getWindowGlobalChild();
let child = content.windowGlobalChild;
let actorChild = child.getActor("Test");
ok(actorChild, "JSWindowActorChild should have value.");
is(
@ -73,7 +73,7 @@ declTest("observers notify with audio-playback", {
let audio = content.document.querySelector("audio");
audio.play();
let child = content.window.getWindowGlobalChild();
let child = content.windowGlobalChild;
let actorChild = child.getActor("Test");
ok(actorChild, "JSWindowActorChild should have value.");

View File

@ -9,7 +9,7 @@ declTest("asyncMessage testing", {
ok(actorParent, "JSWindowActorParent should have value.");
await ContentTask.spawn(browser, {}, async function() {
let child = content.window.getWindowGlobalChild();
let child = content.windowGlobalChild;
let actorChild = child.getActor("Test");
ok(actorChild, "JSWindowActorChild should have value.");
@ -32,7 +32,7 @@ declTest("asyncMessage without both sides", {
// If we don't create a parent actor, make sure the parent actor
// gets created by having sent the message.
await ContentTask.spawn(browser, {}, async function() {
let child = content.window.getWindowGlobalChild();
let child = content.windowGlobalChild;
let actorChild = child.getActor("Test");
ok(actorChild, "JSWindowActorChild should have value.");

View File

@ -84,7 +84,7 @@ declTest("sendQuery in-process early lifetime", {
async test(browser) {
let iframe = browser.contentDocument.createElement("iframe");
browser.contentDocument.body.appendChild(iframe);
let wgc = iframe.contentWindow.getWindowGlobalChild();
let wgc = iframe.contentWindow.windowGlobalChild;
let actorChild = wgc.getActor("Test");
let { result } = await actorChild.sendQuery("asyncMul", { a: 10, b: 20 });
is(result, 200);

View File

@ -548,8 +548,8 @@ partial interface Window {
[ChromeOnly]
readonly attribute boolean hasOpenerForInitialContentBrowser;
[ChromeOnly]
WindowGlobalChild? getWindowGlobalChild();
[Pure, ChromeOnly]
readonly attribute WindowGlobalChild? windowGlobalChild;
};
Window includes TouchEventHandlers;

View File

@ -514,7 +514,7 @@ const STATE_COMPLETED = 5;
function FlushRendering(aFlushMode) {
let browsingContext = content.docShell.browsingContext;
let ignoreThrottledAnimations = (aFlushMode === FlushMode.IGNORE_THROTTLED_ANIMATIONS);
let promise = content.getWindowGlobalChild().getActor("ReftestFission").sendQuery("FlushRendering", {browsingContext, ignoreThrottledAnimations});
let promise = content.windowGlobalChild.getActor("ReftestFission").sendQuery("FlushRendering", {browsingContext, ignoreThrottledAnimations});
return promise.then(function(result) {
for (let errorString of result.errorStrings) {
LogError(errorString);
@ -1382,7 +1382,7 @@ function SynchronizeForSnapshot(flags)
}
let browsingContext = content.docShell.browsingContext;
let promise = content.getWindowGlobalChild().getActor("ReftestFission").sendQuery("UpdateLayerTree", {browsingContext});
let promise = content.windowGlobalChild.getActor("ReftestFission").sendQuery("UpdateLayerTree", {browsingContext});
return promise.then(function (result) {
for (let errorString of result) {
LogError(errorString);

View File

@ -181,7 +181,7 @@ function Tester(aTests, structuredLogger, aCallback) {
// Make sure our SpecialPowers actor is instantiated, in case it was
// registered after our DOMWindowCreated event was fired (which it
// most likely was).
window.getWindowGlobalChild().getActor("SpecialPowers");
void window.windowGlobalChild.getActor("SpecialPowers");
var simpleTestScope = {};
this._scriptLoader.loadSubScript(

View File

@ -679,7 +679,7 @@ class SpecialPowersChild extends JSWindowActorChild {
async toggleMuteState(aMuted, aWindow) {
let actor = aWindow
? aWindow.getWindowGlobalChild().getActor("SpecialPowers")
? aWindow.windowGlobalChild.getActor("SpecialPowers")
: this;
return actor.sendQuery("SPToggleMuteAudio", { mute: aMuted });
}
@ -1773,7 +1773,7 @@ class SpecialPowersChild extends JSWindowActorChild {
try {
let actor = aWindow
? aWindow.getWindowGlobalChild().getActor("SpecialPowers")
? aWindow.windowGlobalChild.getActor("SpecialPowers")
: this;
actor.sendAsyncMessage("SpecialPowers.Focus", {});
} catch (e) {

View File

@ -497,7 +497,7 @@ class BaseContext {
* @returns {PointConduit}
*/
openConduit(subject, address) {
let wgc = this.contentWindow.getWindowGlobalChild();
let wgc = this.contentWindow.windowGlobalChild;
let conduit = wgc.getActor("Conduits").openConduit(subject, {
id: subject.id || getUniqueId(),
extensionId: this.extension.id,

View File

@ -262,7 +262,7 @@ add_task(async function test_sub_subframe_conduit_verified_env() {
async function faker(extensionId, envType) {
try {
let id = envType + "-xyz1234";
let wgc = this.content.getWindowGlobalChild();
let wgc = this.content.windowGlobalChild;
let conduit = wgc.getActor("Conduits").openConduit({}, {
id,

View File

@ -375,7 +375,7 @@ let gAutoCompleteListener = {
return;
}
let loginManager = window.getWindowGlobalChild().getActor("LoginManager");
let loginManager = window.windowGlobalChild.getActor("LoginManager");
let hostname = eventTarget.ownerDocument.documentURIObject.host;
loginManager.sendAsyncMessage("PasswordManager:OpenPreferences", {
hostname,
@ -424,7 +424,7 @@ this.LoginManagerChild = class LoginManagerChild extends JSWindowActorChild {
}
static forWindow(window) {
let windowGlobal = window.getWindowGlobalChild();
let windowGlobal = window.windowGlobalChild;
if (windowGlobal) {
return windowGlobal.getActor("LoginManager");
}
@ -665,11 +665,13 @@ this.LoginManagerChild = class LoginManagerChild extends JSWindowActorChild {
}
// Get the highest accessible docshell and attach the progress listener to that.
let browsingContext = window.getWindowGlobalChild().browsingContext;
let docShell;
while (browsingContext && browsingContext.docShell) {
for (
let browsingContext = BrowsingContext.getFromWindow(window);
browsingContext && browsingContext.docShell;
browsingContext = browsingContext.parent
) {
docShell = browsingContext.docShell;
browsingContext = browsingContext.parent;
}
try {
@ -1595,7 +1597,7 @@ this.LoginManagerChild = class LoginManagerChild extends JSWindowActorChild {
}
let autoFilledLogin = docState.fillsByRootElement.get(form.rootElement);
let browsingContextId = win.getWindowGlobalChild().browsingContext.id;
let browsingContextId = win.windowGlobalChild.browsingContext.id;
let detail = {
origin,

View File

@ -109,7 +109,7 @@ function checkAutoCompleteResults(actualValues, expectedValues, hostname, msg) {
}
function getIframeBrowsingContext(window, iframeNumber = 0) {
let bc = SpecialPowers.wrap(window).getWindowGlobalChild().browsingContext;
let bc = SpecialPowers.wrap(window).windowGlobalChild.browsingContext;
return SpecialPowers.unwrap(bc.getChildren()[iframeNumber]);
}

View File

@ -134,7 +134,7 @@ add_task(async function test_dedupe_subdomain() {
"form-basic-password", "pass1");
let filledGUID = await SpecialPowers.spawn(bc, [], function getFilledGUID() {
let LMC = this.content.getWindowGlobalChild().getActor("LoginManager");
let LMC = this.content.windowGlobalChild.getActor("LoginManager");
let doc = this.content.document;
let form = doc.getElementById("form-basic");
return LMC.stateForDocument(doc).fillsByRootElement.get(form).guid;

View File

@ -296,8 +296,8 @@
Assert.equal(proxyok, "PASS", "Proxy Authorization OK, " + frameid);
}
let parentIFrameBC = SpecialPowers.wrap(window).getWindowGlobalChild().
browsingContext.getChildren()[0];
let parentIFrameBC = SpecialPowers.wrap(window).windowGlobalChild
.browsingContext.getChildren()[0];
let childIFrame = SpecialPowers.unwrap(parentIFrameBC.getChildren()[0]);
await SpecialPowers.spawn(childIFrame, ["iframe1"], checkIframe);

View File

@ -545,8 +545,7 @@ function openTabPrompt(domWin, tabPrompt, args) {
}
function openRemotePrompt(domWin, args) {
let windowGlobal = domWin.getWindowGlobalChild();
let actor = windowGlobal.getActor("Prompt");
let actor = domWin.windowGlobalChild.getActor("Prompt");
let docShell = domWin.docShell;
let inPermitUnload =

View File

@ -39,7 +39,7 @@ function isAutocompleteDisabled(aField) {
function FormHistoryClient({ formField, inputName }) {
if (formField && inputName != this.SEARCHBAR_ID) {
let window = formField.ownerGlobal;
this.windowGlobal = window.getWindowGlobalChild();
this.windowGlobal = window.windowGlobalChild;
} else if (inputName == this.SEARCHBAR_ID && formField) {
throw new Error(
"FormHistoryClient constructed with both a " +

View File

@ -85,8 +85,7 @@ var ContentDOMReference = {
);
}
let browsingContext = element.ownerGlobal.getWindowGlobalChild()
.browsingContext;
let browsingContext = BrowsingContext.getFromWindow(element.ownerGlobal);
let mappings = gRegistry.get(browsingContext);
if (!mappings) {
mappings = {

View File

@ -40,6 +40,7 @@ const extraDefinitions = [
// single) variable.
{ name: "XPCOMUtils", writable: false },
{ name: "Task", writable: false },
{ name: "windowGlobalChild", writable: false },
];
// Some files in global-scripts.inc need mapping to specific locations.