Bug 1580448 - Renaming Test{Child, Parent} => TestWindow{Child, Parent};r=nika

Differential Revision: https://phabricator.services.mozilla.com/D69818
This commit is contained in:
David Teller 2020-04-30 16:19:14 +00:00
Родитель 038fcc44b3
Коммит 8317b02f61
13 изменённых файлов: 73 добавлений и 65 удалений

Просмотреть файл

@ -17,7 +17,7 @@ declTest("crash actor", {
let newTabBrowser = newTab.linkedBrowser;
let parent = newTabBrowser.browsingContext.currentWindowGlobal.getActor(
"Test"
"TestWindow"
);
ok(parent, "JSWindowActorParent should have value.");
@ -30,8 +30,12 @@ declTest("crash actor", {
"Actor should be loaded in the content process."
);
// Make sure that the actor is loaded.
let actorChild = child.getActor("Test");
is(actorChild.show(), "TestChild", "actor show should have value.");
let actorChild = child.getActor("TestWindow");
is(
actorChild.show(),
"TestWindowChild",
"actor show should have value."
);
is(
actorChild.manager,
child,
@ -62,7 +66,7 @@ declTest("crash actor", {
let newTabBrowser = newTab.linkedBrowser;
let parent = newTabBrowser.browsingContext.currentWindowGlobal.getActor(
"Test"
"TestWindow"
);
ok(parent, "JSWindowActorParent should have value.");
@ -75,8 +79,12 @@ declTest("crash actor", {
"Actor should be loaded in the content process."
);
// Make sure that the actor is loaded.
let actorChild = child.getActor("Test");
is(actorChild.show(), "TestChild", "actor show should have value.");
let actorChild = child.getActor("TestWindow");
is(
actorChild.show(),
"TestWindowChild",
"actor show should have value."
);
is(
actorChild.manager,
child,

Просмотреть файл

@ -14,7 +14,7 @@ declTest("destroy actor by iframe remove", {
await ContentTaskUtils.waitForEvent(frame, "load");
is(content.window.frames.length, 1, "There should be an iframe.");
let child = frame.contentWindow.windowGlobalChild;
let actorChild = child.getActor("Test");
let actorChild = child.getActor("TestWindow");
ok(actorChild, "JSWindowActorChild should have value.");
let willDestroyPromise = new Promise(resolve => {
@ -44,7 +44,7 @@ declTest("destroy actor by iframe remove", {
await Promise.all([willDestroyPromise, didDestroyPromise]);
Assert.throws(
() => child.getActor("Test"),
() => child.getActor("TestWindow"),
/InvalidStateError/,
"Should throw if frame destroy."
);
@ -68,7 +68,7 @@ declTest("destroy actor by page navigates", {
let frame = content.document.querySelector("iframe");
frame.contentWindow.location = url;
let child = frame.contentWindow.windowGlobalChild;
let actorChild = child.getActor("Test");
let actorChild = child.getActor("TestWindow");
ok(actorChild, "JSWindowActorChild should have value.");
let willDestroyPromise = new Promise(resolve => {
@ -100,7 +100,7 @@ declTest("destroy actor by page navigates", {
]);
Assert.throws(
() => child.getActor("Test"),
() => child.getActor("TestWindow"),
/InvalidStateError/,
"Should throw if frame destroy."
);
@ -117,7 +117,7 @@ declTest("destroy actor by tab being closed", {
let newTabBrowser = newTab.linkedBrowser;
let parent = newTabBrowser.browsingContext.currentWindowGlobal.getActor(
"Test"
"TestWindow"
);
ok(parent, "JSWindowActorParent should have value.");
@ -153,7 +153,7 @@ declTest("destroy actor by tab being closed", {
info("setting up destroy listeners");
await SpecialPowers.spawn(newTabBrowser, [], () => {
let child = content.windowGlobalChild;
let actorChild = child.getActor("Test");
let actorChild = child.getActor("TestWindow");
ok(actorChild, "JSWindowActorChild should have value.");
Services.obs.addObserver(function obs(subject, topic, data) {

Просмотреть файл

@ -32,7 +32,7 @@ declTest("test event triggering actor creation", {
is(data, "mozshowdropdown");
let parent = browser.browsingContext.currentWindowGlobal;
let actorParent = parent.getActor("Test");
let actorParent = parent.getActor("TestWindow");
ok(actorParent, "JSWindowActorParent should have value.");
is(
subject.wrappedJSObject,

Просмотреть файл

@ -6,8 +6,8 @@ declTest("getActor on both sides", {
async test(browser) {
let parent = browser.browsingContext.currentWindowGlobal;
ok(parent, "WindowGlobalParent should have value.");
let actorParent = parent.getActor("Test");
is(actorParent.show(), "TestParent", "actor show should have vaule.");
let actorParent = parent.getActor("TestWindow");
is(actorParent.show(), "TestWindowParent", "actor show should have vaule.");
is(actorParent.manager, parent, "manager should match WindowGlobalParent.");
await SpecialPowers.spawn(browser, [], async function() {
@ -18,8 +18,8 @@ declTest("getActor on both sides", {
false,
"Actor should be loaded in the content process."
);
let actorChild = child.getActor("Test");
is(actorChild.show(), "TestChild", "actor show should have vaule.");
let actorChild = child.getActor("TestWindow");
is(actorChild.show(), "TestWindowChild", "actor show should have vaule.");
is(actorChild.manager, child, "manager should match WindowGlobalChild.");
});
},

Просмотреть файл

@ -11,7 +11,7 @@ declTest("getActor with mismatch", {
let parent = browser.browsingContext.currentWindowGlobal;
ok(parent, "WindowGlobalParent should have value.");
Assert.throws(
() => parent.getActor("Test"),
() => parent.getActor("TestWindow"),
/NS_ERROR_NOT_AVAILABLE/,
"Should throw if it doesn't match."
);
@ -21,7 +21,7 @@ declTest("getActor with mismatch", {
ok(child, "WindowGlobalChild should have value.");
Assert.throws(
() => child.getActor("Test"),
() => child.getActor("TestWindow"),
/NS_ERROR_NOT_AVAILABLE/,
"Should throw if it doesn't match."
);
@ -35,12 +35,12 @@ declTest("getActor with matches", {
async test(browser) {
let parent = browser.browsingContext.currentWindowGlobal;
ok(parent.getActor("Test"), "JSWindowActorParent should have value.");
ok(parent.getActor("TestWindow"), "JSWindowActorParent should have value.");
await SpecialPowers.spawn(browser, [], async function() {
let child = content.windowGlobalChild;
ok(child, "WindowGlobalChild should have value.");
ok(child.getActor("Test"), "JSWindowActorChild should have value.");
ok(child.getActor("TestWindow"), "JSWindowActorChild should have value.");
});
},
});
@ -61,7 +61,7 @@ declTest("getActor with iframe matches", {
await content.SpecialPowers.spawn(frame, [], () => {
let child = content.windowGlobalChild;
Assert.ok(
child.getActor("Test"),
child.getActor("TestWindow"),
"JSWindowActorChild should have value."
);
});
@ -85,7 +85,7 @@ declTest("getActor with iframe mismatch", {
await content.SpecialPowers.spawn(frame, [], () => {
let child = content.windowGlobalChild;
Assert.throws(
() => child.getActor("Test"),
() => child.getActor("TestWindow"),
/NS_ERROR_NOT_AVAILABLE/,
"Should throw if it doesn't match."
);
@ -99,12 +99,12 @@ declTest("getActor with remoteType match", {
async test(browser) {
let parent = browser.browsingContext.currentWindowGlobal;
ok(parent.getActor("Test"), "JSWindowActorParent should have value.");
ok(parent.getActor("TestWindow"), "JSWindowActorParent should have value.");
await SpecialPowers.spawn(browser, [], async function() {
let child = content.windowGlobalChild;
ok(child, "WindowGlobalChild should have value.");
ok(child.getActor("Test"), "JSWindowActorChild should have value.");
ok(child.getActor("TestWindow"), "JSWindowActorChild should have value.");
});
},
});
@ -117,7 +117,7 @@ declTest("getActor with iframe remoteType match", {
await SpecialPowers.spawn(browser, [TEST_URL], async function(url) {
let child = content.windowGlobalChild;
ok(child, "WindowGlobalChild should have value.");
ok(child.getActor("Test"), "JSWindowActorChild should have value.");
ok(child.getActor("TestWindow"), "JSWindowActorChild should have value.");
// Create and append an iframe into the window's document.
let frame = content.document.createElement("iframe");
@ -129,7 +129,7 @@ declTest("getActor with iframe remoteType match", {
await content.SpecialPowers.spawn(frame, [], () => {
child = content.windowGlobalChild;
Assert.ok(
child.getActor("Test"),
child.getActor("TestWindow"),
"JSWindowActorChild should have value."
);
});
@ -144,7 +144,7 @@ declTest("getActor with remoteType mismatch", {
async test(browser) {
let parent = browser.browsingContext.currentWindowGlobal;
Assert.throws(
() => parent.getActor("Test"),
() => parent.getActor("TestWindow"),
/NS_ERROR_NOT_AVAILABLE/,
"Should throw if its remoteTypes don't match."
);
@ -153,7 +153,7 @@ declTest("getActor with remoteType mismatch", {
let child = content.windowGlobalChild;
ok(child, "WindowGlobalChild should have value.");
Assert.throws(
() => child.getActor("Test"),
() => child.getActor("TestWindow"),
/NS_ERROR_NOT_AVAILABLE/,
"Should throw if its remoteTypes don't match."
);
@ -167,12 +167,12 @@ declTest("getActor with iframe messageManagerGroups match", {
async test(browser) {
let parent = browser.browsingContext.currentWindowGlobal;
ok(parent.getActor("Test"), "JSWindowActorParent should have value.");
ok(parent.getActor("TestWindow"), "JSWindowActorParent should have value.");
await SpecialPowers.spawn(browser, [TEST_URL], async function(url) {
let child = content.windowGlobalChild;
ok(child, "WindowGlobalChild should have value.");
ok(child.getActor("Test"), "JSWindowActorChild should have value.");
ok(child.getActor("TestWindow"), "JSWindowActorChild should have value.");
});
},
});
@ -184,7 +184,7 @@ declTest("getActor with iframe messageManagerGroups mismatch", {
async test(browser) {
let parent = browser.browsingContext.currentWindowGlobal;
Assert.throws(
() => parent.getActor("Test"),
() => parent.getActor("TestWindow"),
/NS_ERROR_NOT_AVAILABLE/,
"Should throw if its messageManagerGroups doesn't match."
);
@ -193,7 +193,7 @@ declTest("getActor with iframe messageManagerGroups mismatch", {
let child = content.windowGlobalChild;
ok(child, "WindowGlobalChild should have value.");
Assert.throws(
() => child.getActor("Test"),
() => child.getActor("TestWindow"),
/NS_ERROR_NOT_AVAILABLE/,
"Should throw if its messageManagerGroups doesn't match."
);
@ -212,7 +212,7 @@ declTest("getActor without allFrames", {
is(content.frames.length, 1, "There should be an iframe.");
let child = frame.contentWindow.windowGlobalChild;
Assert.throws(
() => child.getActor("Test"),
() => child.getActor("TestWindow"),
/NS_ERROR_NOT_AVAILABLE/,
"Should throw if allFrames is false."
);
@ -230,7 +230,7 @@ declTest("getActor with allFrames", {
content.document.body.appendChild(frame);
is(content.frames.length, 1, "There should be an iframe.");
let child = frame.contentWindow.windowGlobalChild;
let actorChild = child.getActor("Test");
let actorChild = child.getActor("TestWindow");
ok(actorChild, "JSWindowActorChild should have value.");
});
},
@ -242,7 +242,7 @@ declTest("getActor without includeChrome", {
async test(_browser, win) {
let parent = win.docShell.browsingContext.currentWindowGlobal;
SimpleTest.doesThrow(
() => parent.getActor("Test"),
() => parent.getActor("TestWindow"),
"Should throw if includeChrome is false."
);
},
@ -253,7 +253,7 @@ declTest("getActor with includeChrome", {
async test(_browser, win) {
let parent = win.docShell.browsingContext.currentWindowGlobal;
let actorParent = parent.getActor("Test");
let actorParent = parent.getActor("TestWindow");
ok(actorParent, "JSWindowActorParent should have value.");
},
});

Просмотреть файл

@ -10,12 +10,12 @@ declTest("test observer triggering actor creation", {
Services.obs.notifyObservers(content.window, TOPIC, "dataString");
let child = content.windowGlobalChild;
let actorChild = child.getActor("Test");
let actorChild = child.getActor("TestWindow");
ok(actorChild, "JSWindowActorChild should have value.");
let { subject, topic, data } = actorChild.lastObserved;
is(
subject.windowGlobalChild.getActor("Test"),
subject.windowGlobalChild.getActor("TestWindow"),
actorChild,
"Should have been recieved on the right actor"
);
@ -32,12 +32,12 @@ declTest("test observers with null data", {
Services.obs.notifyObservers(content.window, TOPIC);
let child = content.windowGlobalChild;
let actorChild = child.getActor("Test");
let actorChild = child.getActor("TestWindow");
ok(actorChild, "JSWindowActorChild should have value.");
let { subject, topic, data } = actorChild.lastObserved;
is(
subject.windowGlobalChild.getActor("Test"),
subject.windowGlobalChild.getActor("TestWindow"),
actorChild,
"Should have been recieved on the right actor"
);
@ -53,7 +53,7 @@ declTest("observers don't notify with wrong window", {
const TOPIC = "test-js-window-actor-child-observer";
Services.obs.notifyObservers(null, TOPIC);
let child = content.windowGlobalChild;
let actorChild = child.getActor("Test");
let actorChild = child.getActor("TestWindow");
ok(actorChild, "JSWindowActorChild should have value.");
is(
actorChild.lastObserved,
@ -74,7 +74,7 @@ declTest("observers notify with audio-playback", {
audio.play();
let child = content.windowGlobalChild;
let actorChild = child.getActor("Test");
let actorChild = child.getActor("TestWindow");
ok(actorChild, "JSWindowActorChild should have value.");
let observePromise = new Promise(resolve => {

Просмотреть файл

@ -5,7 +5,7 @@
declTest("double register", {
async test() {
SimpleTest.doesThrow(
() => ChromeUtils.registerWindowActor("Test", windowActorOptions),
() => ChromeUtils.registerWindowActor("TestWindow", windowActorOptions),
"Should throw if register has duplicate name."
);
},

Просмотреть файл

@ -5,12 +5,12 @@
declTest("asyncMessage testing", {
async test(browser) {
let parent = browser.browsingContext.currentWindowGlobal;
let actorParent = parent.getActor("Test");
let actorParent = parent.getActor("TestWindow");
ok(actorParent, "JSWindowActorParent should have value.");
await ContentTask.spawn(browser, {}, async function() {
let child = content.windowGlobalChild;
let actorChild = child.getActor("Test");
let actorChild = child.getActor("TestWindow");
ok(actorChild, "JSWindowActorChild should have value.");
let promise = new Promise(resolve => {
@ -33,7 +33,7 @@ declTest("asyncMessage without both sides", {
// gets created by having sent the message.
await ContentTask.spawn(browser, {}, async function() {
let child = content.windowGlobalChild;
let actorChild = child.getActor("Test");
let actorChild = child.getActor("TestWindow");
ok(actorChild, "JSWindowActorChild should have value.");
let promise = new Promise(resolve => {

Просмотреть файл

@ -20,7 +20,7 @@ function maybeAsyncStack(offset, column) {
declTest("sendQuery Error", {
async test(browser) {
let parent = browser.browsingContext.currentWindowGlobal;
let actorParent = parent.getActor("Test");
let actorParent = parent.getActor("TestWindow");
let asyncStack = maybeAsyncStack(2, 8);
let error = await actorParent
@ -31,7 +31,7 @@ declTest("sendQuery Error", {
is(error.name, "SyntaxError", "Error should have the correct name");
is(
error.stack,
"receiveMessage@resource://testing-common/TestChild.jsm:28:31\n" +
"receiveMessage@resource://testing-common/TestWindowChild.jsm:28:31\n" +
asyncStack,
"Error should have the correct stack"
);
@ -41,7 +41,7 @@ declTest("sendQuery Error", {
declTest("sendQuery Exception", {
async test(browser) {
let parent = browser.browsingContext.currentWindowGlobal;
let actorParent = parent.getActor("Test");
let actorParent = parent.getActor("TestWindow");
let asyncStack = maybeAsyncStack(2, 8);
let error = await actorParent
@ -59,7 +59,7 @@ declTest("sendQuery Exception", {
);
is(
error.stack,
"receiveMessage@resource://testing-common/TestChild.jsm:31:22\n" +
"receiveMessage@resource://testing-common/TestWindowChild.jsm:31:22\n" +
asyncStack,
"Error should have the correct stack"
);
@ -69,7 +69,7 @@ declTest("sendQuery Exception", {
declTest("sendQuery testing", {
async test(browser) {
let parent = browser.browsingContext.currentWindowGlobal;
let actorParent = parent.getActor("Test");
let actorParent = parent.getActor("TestWindow");
ok(actorParent, "JSWindowActorParent should have value.");
let { result } = await actorParent.sendQuery("asyncAdd", { a: 10, b: 20 });
@ -85,7 +85,7 @@ declTest("sendQuery in-process early lifetime", {
let iframe = browser.contentDocument.createElement("iframe");
browser.contentDocument.body.appendChild(iframe);
let wgc = iframe.contentWindow.windowGlobalChild;
let actorChild = wgc.getActor("Test");
let actorChild = wgc.getActor("TestWindow");
let { result } = await actorChild.sendQuery("asyncMul", { a: 10, b: 20 });
is(result, 200);
},

Просмотреть файл

@ -9,10 +9,10 @@ const URL = "about:blank";
const TEST_URL = "http://test2.example.org/";
let windowActorOptions = {
parent: {
moduleURI: "resource://testing-common/TestParent.jsm",
moduleURI: "resource://testing-common/TestWindowParent.jsm",
},
child: {
moduleURI: "resource://testing-common/TestChild.jsm",
moduleURI: "resource://testing-common/TestWindowChild.jsm",
events: {
mozshowdropdown: {},
@ -60,7 +60,7 @@ function declTest(name, cfg) {
remote: true,
fission,
});
ChromeUtils.registerWindowActor("Test", actorOptions);
ChromeUtils.registerWindowActor("TestWindow", actorOptions);
// Wait for the provided URL to load in our browser
let browser = win.gBrowser.selectedBrowser;
@ -73,7 +73,7 @@ function declTest(name, cfg) {
await Promise.resolve(test(browser, win));
} finally {
// Clean up after we're done.
ChromeUtils.unregisterWindowActor("Test");
ChromeUtils.unregisterWindowActor("TestWindow");
await BrowserTestUtils.closeWindow(win);
info("Exiting test: " + name);
}

Просмотреть файл

@ -6,9 +6,9 @@
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var EXPORTED_SYMBOLS = ["TestChild"];
var EXPORTED_SYMBOLS = ["TestWindowChild"];
class TestChild extends JSWindowActorChild {
class TestWindowChild extends JSWindowActorChild {
constructor() {
super();
}
@ -54,7 +54,7 @@ class TestChild extends JSWindowActorChild {
}
show() {
return "TestChild";
return "TestWindowChild";
}
willDestroy() {

Просмотреть файл

@ -6,9 +6,9 @@
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var EXPORTED_SYMBOLS = ["TestParent"];
var EXPORTED_SYMBOLS = ["TestWindowParent"];
class TestParent extends JSWindowActorParent {
class TestWindowParent extends JSWindowActorParent {
constructor() {
super();
this.wrappedJSObject = this;
@ -41,6 +41,6 @@ class TestParent extends JSWindowActorParent {
}
show() {
return "TestParent";
return "TestWindowParent";
}
}

Просмотреть файл

@ -17,8 +17,8 @@ with Files('KeyPressEventModelCheckerChild.jsm'):
BUG_COMPONENT = ('Core', 'DOM: Events')
TESTING_JS_MODULES += [
'TestChild.jsm',
'TestParent.jsm',
'TestWindowChild.jsm',
'TestWindowParent.jsm',
]
FINAL_TARGET_FILES.actors += [