Bug 1866732 - Part 1: Remove tests for loading JSMs in Actors. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D233362
This commit is contained in:
@@ -14,5 +14,3 @@ support-files = ["head.js"]
|
|||||||
["browser_sendAsyncMessage.js"]
|
["browser_sendAsyncMessage.js"]
|
||||||
|
|
||||||
["browser_sendQuery.js"]
|
["browser_sendQuery.js"]
|
||||||
|
|
||||||
["browser_uri_combination.js"]
|
|
||||||
|
|||||||
@@ -2,22 +2,10 @@
|
|||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const ERROR_LINE_NUMBERS = {
|
const ERROR_LINE_NUMBER = 28;
|
||||||
jsm: 31,
|
const EXCEPTION_LINE_NUMBER = ERROR_LINE_NUMBER + 3;
|
||||||
"sys.mjs": 28,
|
const ERROR_COLUMN_NUMBER = 31;
|
||||||
};
|
const EXCEPTION_COLUMN_NUMBER = 22;
|
||||||
const EXCEPTION_LINE_NUMBERS = {
|
|
||||||
jsm: ERROR_LINE_NUMBERS.jsm + 3,
|
|
||||||
"sys.mjs": ERROR_LINE_NUMBERS["sys.mjs"] + 3,
|
|
||||||
};
|
|
||||||
const ERROR_COLUMN_NUMBERS = {
|
|
||||||
jsm: 31,
|
|
||||||
"sys.mjs": 31,
|
|
||||||
};
|
|
||||||
const EXCEPTION_COLUMN_NUMBERS = {
|
|
||||||
jsm: 22,
|
|
||||||
"sys.mjs": 22,
|
|
||||||
};
|
|
||||||
|
|
||||||
function maybeAsyncStack(offset, column) {
|
function maybeAsyncStack(offset, column) {
|
||||||
if (
|
if (
|
||||||
@@ -39,7 +27,7 @@ function maybeAsyncStack(offset, column) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declTest("sendQuery Error", {
|
declTest("sendQuery Error", {
|
||||||
async test(browser, _window, fileExt) {
|
async test(browser, _window) {
|
||||||
let parent = browser.browsingContext.currentWindowGlobal.domProcess;
|
let parent = browser.browsingContext.currentWindowGlobal.domProcess;
|
||||||
let actorParent = parent.getActor("TestProcessActor");
|
let actorParent = parent.getActor("TestProcessActor");
|
||||||
|
|
||||||
@@ -52,7 +40,7 @@ declTest("sendQuery Error", {
|
|||||||
is(error.name, "SyntaxError", "Error should have the correct name");
|
is(error.name, "SyntaxError", "Error should have the correct name");
|
||||||
is(
|
is(
|
||||||
error.stack,
|
error.stack,
|
||||||
`receiveMessage@resource://testing-common/TestProcessActorChild.${fileExt}:${ERROR_LINE_NUMBERS[fileExt]}:${ERROR_COLUMN_NUMBERS[fileExt]}\n` +
|
`receiveMessage@resource://testing-common/TestProcessActorChild.sys.mjs:${ERROR_LINE_NUMBER}:${ERROR_COLUMN_NUMBER}\n` +
|
||||||
asyncStack,
|
asyncStack,
|
||||||
"Error should have the correct stack"
|
"Error should have the correct stack"
|
||||||
);
|
);
|
||||||
@@ -60,7 +48,7 @@ declTest("sendQuery Error", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
declTest("sendQuery Exception", {
|
declTest("sendQuery Exception", {
|
||||||
async test(browser, _window, fileExt) {
|
async test(browser, _window) {
|
||||||
let parent = browser.browsingContext.currentWindowGlobal.domProcess;
|
let parent = browser.browsingContext.currentWindowGlobal.domProcess;
|
||||||
let actorParent = parent.getActor("TestProcessActor");
|
let actorParent = parent.getActor("TestProcessActor");
|
||||||
|
|
||||||
@@ -80,7 +68,7 @@ declTest("sendQuery Exception", {
|
|||||||
);
|
);
|
||||||
is(
|
is(
|
||||||
error.stack,
|
error.stack,
|
||||||
`receiveMessage@resource://testing-common/TestProcessActorChild.${fileExt}:${EXCEPTION_LINE_NUMBERS[fileExt]}:${EXCEPTION_COLUMN_NUMBERS[fileExt]}\n` +
|
`receiveMessage@resource://testing-common/TestProcessActorChild.sys.mjs:${EXCEPTION_LINE_NUMBER}:${EXCEPTION_COLUMN_NUMBER}\n` +
|
||||||
asyncStack,
|
asyncStack,
|
||||||
"Error should have the correct stack"
|
"Error should have the correct stack"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,81 +0,0 @@
|
|||||||
add_task(function specify_both() {
|
|
||||||
// Specifying both should throw.
|
|
||||||
|
|
||||||
SimpleTest.doesThrow(() => {
|
|
||||||
ChromeUtils.registerProcessActor("TestProcessActor", {
|
|
||||||
parent: {
|
|
||||||
moduleURI: "resource://testing-common/TestProcessActorParent.jsm",
|
|
||||||
},
|
|
||||||
child: {
|
|
||||||
moduleURI: "resource://testing-common/TestProcessActorChild.jsm",
|
|
||||||
esModuleURI: "resource://testing-common/TestProcessActorChild.sys.mjs",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}, "Should throw if both moduleURI and esModuleURI are specified.");
|
|
||||||
|
|
||||||
SimpleTest.doesThrow(() => {
|
|
||||||
ChromeUtils.registerProcessActor("TestProcessActor", {
|
|
||||||
parent: {
|
|
||||||
esModuleURI: "resource://testing-common/TestProcessActorParent.sys.mjs",
|
|
||||||
},
|
|
||||||
child: {
|
|
||||||
moduleURI: "resource://testing-common/TestProcessActorChild.jsm",
|
|
||||||
esModuleURI: "resource://testing-common/TestProcessActorChild.sys.mjs",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}, "Should throw if both moduleURI and esModuleURI are specified.");
|
|
||||||
|
|
||||||
SimpleTest.doesThrow(() => {
|
|
||||||
ChromeUtils.registerProcessActor("TestProcessActor", {
|
|
||||||
parent: {
|
|
||||||
moduleURI: "resource://testing-common/TestProcessActorParent.jsm",
|
|
||||||
esModuleURI: "resource://testing-common/TestProcessActorParent.sys.mjs",
|
|
||||||
},
|
|
||||||
child: {
|
|
||||||
moduleURI: "resource://testing-common/TestProcessActorChild.jsm",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}, "Should throw if both moduleURI and esModuleURI are specified.");
|
|
||||||
|
|
||||||
SimpleTest.doesThrow(() => {
|
|
||||||
ChromeUtils.registerProcessActor("TestProcessActor", {
|
|
||||||
parent: {
|
|
||||||
moduleURI: "resource://testing-common/TestProcessActorParent.jsm",
|
|
||||||
esModuleURI: "resource://testing-common/TestProcessActorParent.sys.mjs",
|
|
||||||
},
|
|
||||||
child: {
|
|
||||||
esModuleURI: "resource://testing-common/TestProcessActorChild.sys.mjs",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}, "Should throw if both moduleURI and esModuleURI are specified.");
|
|
||||||
});
|
|
||||||
|
|
||||||
add_task(function specify_mixed() {
|
|
||||||
// Mixing JSM and ESM should work.
|
|
||||||
|
|
||||||
try {
|
|
||||||
ChromeUtils.registerProcessActor("TestProcessActor", {
|
|
||||||
parent: {
|
|
||||||
moduleURI: "resource://testing-common/TestProcessActorParent.jsm",
|
|
||||||
},
|
|
||||||
child: {
|
|
||||||
esModuleURI: "resource://testing-common/TestProcessActorChild.sys.mjs",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
ChromeUtils.unregisterProcessActor("TestProcessActor");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
ChromeUtils.registerProcessActor("TestProcessActor", {
|
|
||||||
parent: {
|
|
||||||
esModuleURI: "resource://testing-common/TestProcessActorParent.sys.mjs",
|
|
||||||
},
|
|
||||||
child: {
|
|
||||||
moduleURI: "resource://testing-common/TestProcessActorChild.jsm",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
ChromeUtils.unregisterProcessActor("TestProcessActor");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -8,16 +8,6 @@
|
|||||||
const URL = "about:blank";
|
const URL = "about:blank";
|
||||||
const TEST_URL = "http://test2.example.org/";
|
const TEST_URL = "http://test2.example.org/";
|
||||||
let processActorOptions = {
|
let processActorOptions = {
|
||||||
jsm: {
|
|
||||||
parent: {
|
|
||||||
moduleURI: "resource://testing-common/TestProcessActorParent.jsm",
|
|
||||||
},
|
|
||||||
child: {
|
|
||||||
moduleURI: "resource://testing-common/TestProcessActorChild.jsm",
|
|
||||||
observers: ["test-js-content-actor-child-observer"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"sys.mjs": {
|
|
||||||
parent: {
|
parent: {
|
||||||
esModuleURI: "resource://testing-common/TestProcessActorParent.sys.mjs",
|
esModuleURI: "resource://testing-common/TestProcessActorParent.sys.mjs",
|
||||||
},
|
},
|
||||||
@@ -25,7 +15,6 @@ let processActorOptions = {
|
|||||||
esModuleURI: "resource://testing-common/TestProcessActorChild.sys.mjs",
|
esModuleURI: "resource://testing-common/TestProcessActorChild.sys.mjs",
|
||||||
observers: ["test-js-content-actor-child-observer"],
|
observers: ["test-js-content-actor-child-observer"],
|
||||||
},
|
},
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function promiseNotification(aNotification) {
|
function promiseNotification(aNotification) {
|
||||||
@@ -41,11 +30,6 @@ function promiseNotification(aNotification) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function declTest(name, cfg) {
|
function declTest(name, cfg) {
|
||||||
declTestWithOptions(name, cfg, "jsm");
|
|
||||||
declTestWithOptions(name, cfg, "sys.mjs");
|
|
||||||
}
|
|
||||||
|
|
||||||
function declTestWithOptions(name, cfg, fileExt) {
|
|
||||||
let {
|
let {
|
||||||
url = "about:blank",
|
url = "about:blank",
|
||||||
includeParent = false,
|
includeParent = false,
|
||||||
@@ -57,8 +41,8 @@ function declTestWithOptions(name, cfg, fileExt) {
|
|||||||
// Build the actor options object which will be used to register & unregister
|
// Build the actor options object which will be used to register & unregister
|
||||||
// our process actor.
|
// our process actor.
|
||||||
let actorOptions = {
|
let actorOptions = {
|
||||||
parent: Object.assign({}, processActorOptions[fileExt].parent),
|
parent: Object.assign({}, processActorOptions.parent),
|
||||||
child: Object.assign({}, processActorOptions[fileExt].child),
|
child: Object.assign({}, processActorOptions.child),
|
||||||
};
|
};
|
||||||
actorOptions.includeParent = includeParent;
|
actorOptions.includeParent = includeParent;
|
||||||
if (remoteTypes !== undefined) {
|
if (remoteTypes !== undefined) {
|
||||||
@@ -77,7 +61,7 @@ function declTestWithOptions(name, cfg, fileExt) {
|
|||||||
try {
|
try {
|
||||||
await BrowserTestUtils.withNewTab(url, async browser => {
|
await BrowserTestUtils.withNewTab(url, async browser => {
|
||||||
info("browser ready");
|
info("browser ready");
|
||||||
await Promise.resolve(test(browser, window, fileExt));
|
await Promise.resolve(test(browser, window));
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
// Unregister the actor after the test is complete.
|
// Unregister the actor after the test is complete.
|
||||||
|
|||||||
@@ -31,5 +31,3 @@ support-files = [
|
|||||||
["browser_sendAsyncMessage.js"]
|
["browser_sendAsyncMessage.js"]
|
||||||
|
|
||||||
["browser_sendQuery.js"]
|
["browser_sendQuery.js"]
|
||||||
|
|
||||||
["browser_uri_combination.js"]
|
|
||||||
|
|||||||
@@ -2,22 +2,10 @@
|
|||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const ERROR_LINE_NUMBERS = {
|
const ERROR_LINE_NUMBER = 36;
|
||||||
jsm: 39,
|
const EXCEPTION_LINE_NUMBER = ERROR_LINE_NUMBER + 3;
|
||||||
"sys.mjs": 36,
|
const ERROR_COLUMN_NUMBER = 31;
|
||||||
};
|
const EXCEPTION_COLUMN_NUMBER = 22;
|
||||||
const EXCEPTION_LINE_NUMBERS = {
|
|
||||||
jsm: ERROR_LINE_NUMBERS.jsm + 3,
|
|
||||||
"sys.mjs": ERROR_LINE_NUMBERS["sys.mjs"] + 3,
|
|
||||||
};
|
|
||||||
const ERROR_COLUMN_NUMBERS = {
|
|
||||||
jsm: 31,
|
|
||||||
"sys.mjs": 31,
|
|
||||||
};
|
|
||||||
const EXCEPTION_COLUMN_NUMBERS = {
|
|
||||||
jsm: 22,
|
|
||||||
"sys.mjs": 22,
|
|
||||||
};
|
|
||||||
|
|
||||||
function maybeAsyncStack(offset, column) {
|
function maybeAsyncStack(offset, column) {
|
||||||
if (
|
if (
|
||||||
@@ -39,7 +27,7 @@ function maybeAsyncStack(offset, column) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declTest("sendQuery Error", {
|
declTest("sendQuery Error", {
|
||||||
async test(browser, _window, fileExt) {
|
async test(browser, _window) {
|
||||||
let parent = browser.browsingContext.currentWindowGlobal;
|
let parent = browser.browsingContext.currentWindowGlobal;
|
||||||
let actorParent = parent.getActor("TestWindow");
|
let actorParent = parent.getActor("TestWindow");
|
||||||
|
|
||||||
@@ -52,7 +40,7 @@ declTest("sendQuery Error", {
|
|||||||
is(error.name, "SyntaxError", "Error should have the correct name");
|
is(error.name, "SyntaxError", "Error should have the correct name");
|
||||||
is(
|
is(
|
||||||
error.stack,
|
error.stack,
|
||||||
`receiveMessage@resource://testing-common/TestWindowChild.${fileExt}:${ERROR_LINE_NUMBERS[fileExt]}:${ERROR_COLUMN_NUMBERS[fileExt]}\n` +
|
`receiveMessage@resource://testing-common/TestWindowChild.sys.mjs:${ERROR_LINE_NUMBER}:${ERROR_COLUMN_NUMBER}\n` +
|
||||||
asyncStack,
|
asyncStack,
|
||||||
"Error should have the correct stack"
|
"Error should have the correct stack"
|
||||||
);
|
);
|
||||||
@@ -60,7 +48,7 @@ declTest("sendQuery Error", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
declTest("sendQuery Exception", {
|
declTest("sendQuery Exception", {
|
||||||
async test(browser, _window, fileExt) {
|
async test(browser, _window) {
|
||||||
let parent = browser.browsingContext.currentWindowGlobal;
|
let parent = browser.browsingContext.currentWindowGlobal;
|
||||||
let actorParent = parent.getActor("TestWindow");
|
let actorParent = parent.getActor("TestWindow");
|
||||||
|
|
||||||
@@ -80,7 +68,7 @@ declTest("sendQuery Exception", {
|
|||||||
);
|
);
|
||||||
is(
|
is(
|
||||||
error.stack,
|
error.stack,
|
||||||
`receiveMessage@resource://testing-common/TestWindowChild.${fileExt}:${EXCEPTION_LINE_NUMBERS[fileExt]}:${EXCEPTION_COLUMN_NUMBERS[fileExt]}\n` +
|
`receiveMessage@resource://testing-common/TestWindowChild.sys.mjs:${EXCEPTION_LINE_NUMBER}:${EXCEPTION_COLUMN_NUMBER}\n` +
|
||||||
asyncStack,
|
asyncStack,
|
||||||
"Error should have the correct stack"
|
"Error should have the correct stack"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,81 +0,0 @@
|
|||||||
add_task(function specify_both() {
|
|
||||||
// Specifying both should throw.
|
|
||||||
|
|
||||||
SimpleTest.doesThrow(() => {
|
|
||||||
ChromeUtils.registerWindowActor("TestWindow", {
|
|
||||||
parent: {
|
|
||||||
moduleURI: "resource://testing-common/TestWindowParent.jsm",
|
|
||||||
},
|
|
||||||
child: {
|
|
||||||
moduleURI: "resource://testing-common/TestWindowChild.jsm",
|
|
||||||
esModuleURI: "resource://testing-common/TestWindowChild.sys.mjs",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}, "Should throw if both moduleURI and esModuleURI are specified.");
|
|
||||||
|
|
||||||
SimpleTest.doesThrow(() => {
|
|
||||||
ChromeUtils.registerWindowActor("TestWindow", {
|
|
||||||
parent: {
|
|
||||||
esModuleURI: "resource://testing-common/TestWindowParent.sys.mjs",
|
|
||||||
},
|
|
||||||
child: {
|
|
||||||
moduleURI: "resource://testing-common/TestWindowChild.jsm",
|
|
||||||
esModuleURI: "resource://testing-common/TestWindowChild.sys.mjs",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}, "Should throw if both moduleURI and esModuleURI are specified.");
|
|
||||||
|
|
||||||
SimpleTest.doesThrow(() => {
|
|
||||||
ChromeUtils.registerWindowActor("TestWindow", {
|
|
||||||
parent: {
|
|
||||||
moduleURI: "resource://testing-common/TestWindowParent.jsm",
|
|
||||||
esModuleURI: "resource://testing-common/TestWindowParent.sys.mjs",
|
|
||||||
},
|
|
||||||
child: {
|
|
||||||
moduleURI: "resource://testing-common/TestWindowChild.jsm",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}, "Should throw if both moduleURI and esModuleURI are specified.");
|
|
||||||
|
|
||||||
SimpleTest.doesThrow(() => {
|
|
||||||
ChromeUtils.registerWindowActor("TestWindow", {
|
|
||||||
parent: {
|
|
||||||
moduleURI: "resource://testing-common/TestWindowParent.jsm",
|
|
||||||
esModuleURI: "resource://testing-common/TestWindowParent.sys.mjs",
|
|
||||||
},
|
|
||||||
child: {
|
|
||||||
esModuleURI: "resource://testing-common/TestWindowChild.sys.mjs",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}, "Should throw if both moduleURI and esModuleURI are specified.");
|
|
||||||
});
|
|
||||||
|
|
||||||
add_task(function specify_mixed() {
|
|
||||||
// Mixing JSM and ESM should work.
|
|
||||||
|
|
||||||
try {
|
|
||||||
ChromeUtils.registerWindowActor("TestWindow", {
|
|
||||||
parent: {
|
|
||||||
moduleURI: "resource://testing-common/TestWindowParent.jsm",
|
|
||||||
},
|
|
||||||
child: {
|
|
||||||
esModuleURI: "resource://testing-common/TestWindowChild.sys.mjs",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
ChromeUtils.unregisterWindowActor("TestWindow");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
ChromeUtils.registerWindowActor("TestWindow", {
|
|
||||||
parent: {
|
|
||||||
esModuleURI: "resource://testing-common/TestWindowParent.sys.mjs",
|
|
||||||
},
|
|
||||||
child: {
|
|
||||||
moduleURI: "resource://testing-common/TestWindowChild.jsm",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
ChromeUtils.unregisterWindowActor("TestWindow");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -8,30 +8,15 @@
|
|||||||
const URL = "about:blank";
|
const URL = "about:blank";
|
||||||
const TEST_URL = "http://test2.example.org/";
|
const TEST_URL = "http://test2.example.org/";
|
||||||
let windowActorOptions = {
|
let windowActorOptions = {
|
||||||
jsm: {
|
|
||||||
parent: {
|
|
||||||
moduleURI: "resource://testing-common/TestWindowParent.jsm",
|
|
||||||
},
|
|
||||||
child: {
|
|
||||||
moduleURI: "resource://testing-common/TestWindowChild.jsm",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"sys.mjs": {
|
|
||||||
parent: {
|
parent: {
|
||||||
esModuleURI: "resource://testing-common/TestWindowParent.sys.mjs",
|
esModuleURI: "resource://testing-common/TestWindowParent.sys.mjs",
|
||||||
},
|
},
|
||||||
child: {
|
child: {
|
||||||
esModuleURI: "resource://testing-common/TestWindowChild.sys.mjs",
|
esModuleURI: "resource://testing-common/TestWindowChild.sys.mjs",
|
||||||
},
|
},
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function declTest(name, cfg) {
|
function declTest(name, cfg) {
|
||||||
declTestWithOptions(name, cfg, "jsm");
|
|
||||||
declTestWithOptions(name, cfg, "sys.mjs");
|
|
||||||
}
|
|
||||||
|
|
||||||
function declTestWithOptions(name, cfg, fileExt) {
|
|
||||||
let {
|
let {
|
||||||
url = "about:blank",
|
url = "about:blank",
|
||||||
allFrames = false,
|
allFrames = false,
|
||||||
@@ -47,8 +32,8 @@ function declTestWithOptions(name, cfg, fileExt) {
|
|||||||
// Build the actor options object which will be used to register & unregister
|
// Build the actor options object which will be used to register & unregister
|
||||||
// our window actor.
|
// our window actor.
|
||||||
let actorOptions = {
|
let actorOptions = {
|
||||||
parent: { ...windowActorOptions[fileExt].parent },
|
parent: { ...windowActorOptions.parent },
|
||||||
child: { ...windowActorOptions[fileExt].child, events, observers },
|
child: { ...windowActorOptions.child, events, observers },
|
||||||
};
|
};
|
||||||
actorOptions.allFrames = allFrames;
|
actorOptions.allFrames = allFrames;
|
||||||
actorOptions.includeChrome = includeChrome;
|
actorOptions.includeChrome = includeChrome;
|
||||||
@@ -71,7 +56,7 @@ function declTestWithOptions(name, cfg, fileExt) {
|
|||||||
try {
|
try {
|
||||||
await BrowserTestUtils.withNewTab(url, async browser => {
|
await BrowserTestUtils.withNewTab(url, async browser => {
|
||||||
info("browser ready");
|
info("browser ready");
|
||||||
await Promise.resolve(test(browser, window, fileExt));
|
await Promise.resolve(test(browser, window));
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
// Unregister the actor after the test is complete.
|
// Unregister the actor after the test is complete.
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
/* vim: set ts=2 sw=2 sts=2 et tw=80: */
|
|
||||||
/* 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/. */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var EXPORTED_SYMBOLS = ["TestProcessActorChild"];
|
|
||||||
|
|
||||||
class TestProcessActorChild extends JSProcessActorChild {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.sawActorCreated = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
actorCreated() {
|
|
||||||
this.sawActorCreated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
receiveMessage(aMessage) {
|
|
||||||
switch (aMessage.name) {
|
|
||||||
case "toChild":
|
|
||||||
aMessage.data.toChild = true;
|
|
||||||
this.sendAsyncMessage("toParent", aMessage.data);
|
|
||||||
break;
|
|
||||||
case "asyncAdd":
|
|
||||||
let { a, b } = aMessage.data;
|
|
||||||
return new Promise(resolve => {
|
|
||||||
resolve({ result: a + b });
|
|
||||||
});
|
|
||||||
case "error":
|
|
||||||
return Promise.reject(new SyntaxError(aMessage.data.message));
|
|
||||||
case "exception":
|
|
||||||
return Promise.reject(
|
|
||||||
Components.Exception(aMessage.data.message, aMessage.data.result)
|
|
||||||
);
|
|
||||||
case "done":
|
|
||||||
this.done(aMessage.data);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
observe(subject, topic, data) {
|
|
||||||
this.lastObserved = { subject, topic, data };
|
|
||||||
}
|
|
||||||
|
|
||||||
show() {
|
|
||||||
return "TestProcessActorChild";
|
|
||||||
}
|
|
||||||
|
|
||||||
didDestroy() {
|
|
||||||
Services.obs.notifyObservers(
|
|
||||||
this,
|
|
||||||
"test-js-content-actor-diddestroy",
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
/* vim: set ts=2 sw=2 sts=2 et tw=80: */
|
|
||||||
/* 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/. */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var EXPORTED_SYMBOLS = ["TestProcessActorParent"];
|
|
||||||
|
|
||||||
class TestProcessActorParent extends JSProcessActorParent {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.wrappedJSObject = this;
|
|
||||||
this.sawActorCreated = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
actorCreated() {
|
|
||||||
this.sawActorCreated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
receiveMessage(aMessage) {
|
|
||||||
switch (aMessage.name) {
|
|
||||||
case "init":
|
|
||||||
aMessage.data.initial = true;
|
|
||||||
this.sendAsyncMessage("toChild", aMessage.data);
|
|
||||||
break;
|
|
||||||
case "toParent":
|
|
||||||
aMessage.data.toParent = true;
|
|
||||||
this.sendAsyncMessage("done", aMessage.data);
|
|
||||||
break;
|
|
||||||
case "asyncMul":
|
|
||||||
let { a, b } = aMessage.data;
|
|
||||||
return { result: a * b };
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
show() {
|
|
||||||
return "TestProcessActorParent";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
/* vim: set ts=2 sw=2 sts=2 et tw=80: */
|
|
||||||
/* 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/. */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var EXPORTED_SYMBOLS = ["TestWindowChild"];
|
|
||||||
|
|
||||||
var docShellThunks = new Map();
|
|
||||||
|
|
||||||
class TestWindowChild extends JSWindowActorChild {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.sawActorCreated = false;
|
|
||||||
|
|
||||||
try {
|
|
||||||
void this.contentWindow;
|
|
||||||
} catch (e) {
|
|
||||||
this.uninitializedGetterError = e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
actorCreated() {
|
|
||||||
this.sawActorCreated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
receiveMessage(aMessage) {
|
|
||||||
switch (aMessage.name) {
|
|
||||||
case "toChild":
|
|
||||||
aMessage.data.toChild = true;
|
|
||||||
this.sendAsyncMessage("toParent", aMessage.data);
|
|
||||||
break;
|
|
||||||
case "asyncAdd":
|
|
||||||
let { a, b } = aMessage.data;
|
|
||||||
return new Promise(resolve => {
|
|
||||||
resolve({ result: a + b });
|
|
||||||
});
|
|
||||||
case "error":
|
|
||||||
return Promise.reject(new SyntaxError(aMessage.data.message));
|
|
||||||
case "exception":
|
|
||||||
return Promise.reject(
|
|
||||||
Components.Exception(aMessage.data.message, aMessage.data.result)
|
|
||||||
);
|
|
||||||
case "done":
|
|
||||||
this.done(aMessage.data);
|
|
||||||
break;
|
|
||||||
case "noncloneReply":
|
|
||||||
// Return a value which is non-cloneable, like a WindowProxy.
|
|
||||||
return this.contentWindow;
|
|
||||||
case "storeActor":
|
|
||||||
docShellThunks.set(this.docShell, this);
|
|
||||||
break;
|
|
||||||
case "checkActor": {
|
|
||||||
let actor = docShellThunks.get(this.docShell);
|
|
||||||
docShellThunks.delete(this.docShell);
|
|
||||||
|
|
||||||
let contentWindow;
|
|
||||||
let error;
|
|
||||||
try {
|
|
||||||
contentWindow = actor.contentWindow;
|
|
||||||
} catch (e) {
|
|
||||||
error = e;
|
|
||||||
}
|
|
||||||
if (error) {
|
|
||||||
return {
|
|
||||||
status: "error",
|
|
||||||
errorType: error.name,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
status: "success",
|
|
||||||
valueIsNull: contentWindow === null,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleEvent(aEvent) {
|
|
||||||
this.sendAsyncMessage("event", { type: aEvent.type });
|
|
||||||
}
|
|
||||||
|
|
||||||
observe(subject, topic, data) {
|
|
||||||
switch (topic) {
|
|
||||||
case "audio-playback":
|
|
||||||
this.done({ subject, topic, data });
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
this.lastObserved = { subject, topic, data };
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
show() {
|
|
||||||
return "TestWindowChild";
|
|
||||||
}
|
|
||||||
|
|
||||||
didDestroy() {
|
|
||||||
Services.obs.notifyObservers(this, "test-js-window-actor-diddestroy", true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
/* vim: set ts=2 sw=2 sts=2 et tw=80: */
|
|
||||||
/* 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/. */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var EXPORTED_SYMBOLS = ["TestWindowParent"];
|
|
||||||
|
|
||||||
class TestWindowParent extends JSWindowActorParent {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.wrappedJSObject = this;
|
|
||||||
this.sawActorCreated = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
actorCreated() {
|
|
||||||
this.sawActorCreated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
receiveMessage(aMessage) {
|
|
||||||
switch (aMessage.name) {
|
|
||||||
case "init":
|
|
||||||
aMessage.data.initial = true;
|
|
||||||
this.sendAsyncMessage("toChild", aMessage.data);
|
|
||||||
break;
|
|
||||||
case "toParent":
|
|
||||||
aMessage.data.toParent = true;
|
|
||||||
this.sendAsyncMessage("done", aMessage.data);
|
|
||||||
break;
|
|
||||||
case "asyncMul":
|
|
||||||
let { a, b } = aMessage.data;
|
|
||||||
return { result: a * b };
|
|
||||||
|
|
||||||
case "event":
|
|
||||||
Services.obs.notifyObservers(
|
|
||||||
this,
|
|
||||||
"test-js-window-actor-parent-event",
|
|
||||||
aMessage.data.type
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case "messagePort": {
|
|
||||||
const { port } = aMessage.data;
|
|
||||||
port.postMessage("Message sent from parent over a MessagePort.");
|
|
||||||
port.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
show() {
|
|
||||||
return "TestWindowParent";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -22,13 +22,9 @@ with Files("PictureInPictureChild.sys.mjs"):
|
|||||||
SPHINX_TREES["actors"] = "docs"
|
SPHINX_TREES["actors"] = "docs"
|
||||||
|
|
||||||
TESTING_JS_MODULES += [
|
TESTING_JS_MODULES += [
|
||||||
"TestProcessActorChild.jsm",
|
|
||||||
"TestProcessActorChild.sys.mjs",
|
"TestProcessActorChild.sys.mjs",
|
||||||
"TestProcessActorParent.jsm",
|
|
||||||
"TestProcessActorParent.sys.mjs",
|
"TestProcessActorParent.sys.mjs",
|
||||||
"TestWindowChild.jsm",
|
|
||||||
"TestWindowChild.sys.mjs",
|
"TestWindowChild.sys.mjs",
|
||||||
"TestWindowParent.jsm",
|
|
||||||
"TestWindowParent.sys.mjs",
|
"TestWindowParent.sys.mjs",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user