Bug 1648545: Part 1 - Move most of SpecialPowers to testing-common. r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D119448
This commit is contained in:
@@ -90,8 +90,8 @@ const intermittently_loaded_scripts = {
|
|||||||
"resource://testing-common/BrowserTestUtilsChild.sys.mjs",
|
"resource://testing-common/BrowserTestUtilsChild.sys.mjs",
|
||||||
"resource://testing-common/ContentEventListenerChild.sys.mjs",
|
"resource://testing-common/ContentEventListenerChild.sys.mjs",
|
||||||
"resource://specialpowers/AppTestDelegateChild.sys.mjs",
|
"resource://specialpowers/AppTestDelegateChild.sys.mjs",
|
||||||
"resource://specialpowers/SpecialPowersChild.sys.mjs",
|
"resource://testing-common/SpecialPowersChild.sys.mjs",
|
||||||
"resource://specialpowers/WrapPrivileged.sys.mjs",
|
"resource://testing-common/WrapPrivileged.sys.mjs",
|
||||||
]),
|
]),
|
||||||
frameScripts: new Set([]),
|
frameScripts: new Set([]),
|
||||||
processScripts: new Set([
|
processScripts: new Set([
|
||||||
|
|||||||
@@ -72,9 +72,9 @@ const intermittently_loaded_scripts = {
|
|||||||
"chrome://remote/content/shared/Log.sys.mjs",
|
"chrome://remote/content/shared/Log.sys.mjs",
|
||||||
"resource://testing-common/BrowserTestUtilsChild.sys.mjs",
|
"resource://testing-common/BrowserTestUtilsChild.sys.mjs",
|
||||||
"resource://testing-common/ContentEventListenerChild.sys.mjs",
|
"resource://testing-common/ContentEventListenerChild.sys.mjs",
|
||||||
"resource://specialpowers/SpecialPowersChild.sys.mjs",
|
"resource://testing-common/SpecialPowersChild.sys.mjs",
|
||||||
"resource://specialpowers/AppTestDelegateChild.sys.mjs",
|
"resource://specialpowers/AppTestDelegateChild.sys.mjs",
|
||||||
"resource://specialpowers/WrapPrivileged.sys.mjs",
|
"resource://testing-common/WrapPrivileged.sys.mjs",
|
||||||
]),
|
]),
|
||||||
processScripts: new Set([]),
|
processScripts: new Set([]),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -234,9 +234,6 @@ async function synthesizeMouse(browser, link, event) {
|
|||||||
browser,
|
browser,
|
||||||
[link, event],
|
[link, event],
|
||||||
(linkInContent, eventInContent) => {
|
(linkInContent, eventInContent) => {
|
||||||
const { EventUtils } = ChromeUtils.importESModule(
|
|
||||||
"resource://specialpowers/SpecialPowersEventUtils.sys.mjs"
|
|
||||||
);
|
|
||||||
const target = content.document.getElementById(linkInContent);
|
const target = content.document.getElementById(linkInContent);
|
||||||
EventUtils.synthesizeMouseAtCenter(target, eventInContent, content);
|
EventUtils.synthesizeMouseAtCenter(target, eventInContent, content);
|
||||||
return target.href;
|
return target.href;
|
||||||
|
|||||||
@@ -155,10 +155,7 @@ async function clickOn(selector, beforeContentFn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await SpecialPowers.spawn(lastTab.linkedBrowser, [selector], arg => {
|
await SpecialPowers.spawn(lastTab.linkedBrowser, [selector], arg => {
|
||||||
const { EventUtils } = ChromeUtils.importESModule(
|
/* eslint-env mozilla/chrome-script */
|
||||||
"resource://specialpowers/SpecialPowersEventUtils.sys.mjs"
|
|
||||||
);
|
|
||||||
|
|
||||||
let element = content.document.querySelector(arg);
|
let element = content.document.querySelector(arg);
|
||||||
return EventUtils.synthesizeClick(element);
|
return EventUtils.synthesizeClick(element);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -13,9 +13,6 @@
|
|||||||
function triggerKey() {
|
function triggerKey() {
|
||||||
SpecialPowers.loadChromeScript(() => {
|
SpecialPowers.loadChromeScript(() => {
|
||||||
/* eslint-env mozilla/chrome-script */
|
/* eslint-env mozilla/chrome-script */
|
||||||
const { EventUtils } = ChromeUtils.import(
|
|
||||||
"resource://specialpowers/SpecialPowersEventUtils.jsm"
|
|
||||||
);
|
|
||||||
var win = Services.wm.getMostRecentBrowserWindow();
|
var win = Services.wm.getMostRecentBrowserWindow();
|
||||||
for (let i = 0; i < 200; ++i) {
|
for (let i = 0; i < 200; ++i) {
|
||||||
EventUtils.synthesizeKey("a", {}, win);
|
EventUtils.synthesizeKey("a", {}, win);
|
||||||
|
|||||||
@@ -26,9 +26,6 @@
|
|||||||
// InputTaskManager properly
|
// InputTaskManager properly
|
||||||
SpecialPowers.loadChromeScript(() => {
|
SpecialPowers.loadChromeScript(() => {
|
||||||
/* eslint-env mozilla/chrome-script */
|
/* eslint-env mozilla/chrome-script */
|
||||||
const { EventUtils } = ChromeUtils.import(
|
|
||||||
"resource://specialpowers/SpecialPowersEventUtils.jsm"
|
|
||||||
);
|
|
||||||
var win = Services.wm.getMostRecentBrowserWindow();
|
var win = Services.wm.getMostRecentBrowserWindow();
|
||||||
EventUtils.synthesizeKey("a", {}, win);
|
EventUtils.synthesizeKey("a", {}, win);
|
||||||
EventUtils.synthesizeKey("b", {}, win);
|
EventUtils.synthesizeKey("b", {}, win);
|
||||||
|
|||||||
@@ -14,9 +14,6 @@
|
|||||||
input.focus();
|
input.focus();
|
||||||
SpecialPowers.loadChromeScript(() => {
|
SpecialPowers.loadChromeScript(() => {
|
||||||
/* eslint-env mozilla/chrome-script */
|
/* eslint-env mozilla/chrome-script */
|
||||||
const { EventUtils } = ChromeUtils.import(
|
|
||||||
"resource://specialpowers/SpecialPowersEventUtils.jsm"
|
|
||||||
);
|
|
||||||
var win = Services.wm.getMostRecentBrowserWindow();
|
var win = Services.wm.getMostRecentBrowserWindow();
|
||||||
EventUtils.synthesizeKey("a", {}, win);
|
EventUtils.synthesizeKey("a", {}, win);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,10 +9,7 @@ add_task(async function test_explicit_object_prototype() {
|
|||||||
const url =
|
const url =
|
||||||
"http://mochi.test:8888/browser/js/xpconnect/tests/browser/browser_promise_userInteractionHandling.html";
|
"http://mochi.test:8888/browser/js/xpconnect/tests/browser/browser_promise_userInteractionHandling.html";
|
||||||
await BrowserTestUtils.withNewTab(url, async browser => {
|
await BrowserTestUtils.withNewTab(url, async browser => {
|
||||||
await ContentTask.spawn(browser, {}, async () => {
|
await SpecialPowers.spawn(browser, [], async () => {
|
||||||
const { EventUtils } = ChromeUtils.importESModule(
|
|
||||||
"resource://specialpowers/SpecialPowersEventUtils.sys.mjs"
|
|
||||||
);
|
|
||||||
const DOMWindowUtils = EventUtils._getDOMWindowUtils(content.window);
|
const DOMWindowUtils = EventUtils._getDOMWindowUtils(content.window);
|
||||||
is(
|
is(
|
||||||
DOMWindowUtils.isHandlingUserInput,
|
DOMWindowUtils.isHandlingUserInput,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=960820
|
|||||||
|
|
||||||
// Check Components.stack, but first filter through the SpecialPowers junk.
|
// Check Components.stack, but first filter through the SpecialPowers junk.
|
||||||
var stack = SpecialPowers.wrap(SpecialPowers.Components).stack;
|
var stack = SpecialPowers.wrap(SpecialPowers.Components).stack;
|
||||||
while (/specialpowers/.test(stack)) {
|
while (/testing-common/.test(stack)) {
|
||||||
stack = stack.caller;
|
stack = stack.caller;
|
||||||
}
|
}
|
||||||
ok(/clickCallback/.test(stack), "clickCallback should be reachable via Components.stack");
|
ok(/clickCallback/.test(stack), "clickCallback should be reachable via Components.stack");
|
||||||
|
|||||||
@@ -31,14 +31,14 @@ this.specialpowers = class extends ExtensionAPI {
|
|||||||
allFrames: true,
|
allFrames: true,
|
||||||
includeChrome: true,
|
includeChrome: true,
|
||||||
child: {
|
child: {
|
||||||
esModuleURI: "resource://specialpowers/SpecialPowersChild.sys.mjs",
|
esModuleURI: "resource://testing-common/SpecialPowersChild.sys.mjs",
|
||||||
observers: [
|
observers: [
|
||||||
"chrome-document-global-created",
|
"chrome-document-global-created",
|
||||||
"content-document-global-created",
|
"content-document-global-created",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
parent: {
|
parent: {
|
||||||
esModuleURI: "resource://specialpowers/SpecialPowersParent.sys.mjs",
|
esModuleURI: "resource://testing-common/SpecialPowersParent.sys.mjs",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
const lazy = {};
|
const lazy = {};
|
||||||
|
|
||||||
ChromeUtils.defineESModuleGetters(lazy, {
|
ChromeUtils.defineESModuleGetters(lazy, {
|
||||||
WrapPrivileged: "resource://specialpowers/WrapPrivileged.sys.mjs",
|
WrapPrivileged: "resource://testing-common/WrapPrivileged.sys.mjs",
|
||||||
});
|
});
|
||||||
|
|
||||||
const Cm = Components.manager;
|
const Cm = Components.manager;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const lazy = {};
|
|||||||
|
|
||||||
ChromeUtils.defineESModuleGetters(lazy, {
|
ChromeUtils.defineESModuleGetters(lazy, {
|
||||||
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
|
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
|
||||||
WrapPrivileged: "resource://specialpowers/WrapPrivileged.sys.mjs",
|
WrapPrivileged: "resource://testing-common/WrapPrivileged.sys.mjs",
|
||||||
});
|
});
|
||||||
|
|
||||||
const Cm = Components.manager;
|
const Cm = Components.manager;
|
||||||
|
|||||||
@@ -12,14 +12,16 @@ const lazy = {};
|
|||||||
|
|
||||||
ChromeUtils.defineESModuleGetters(lazy, {
|
ChromeUtils.defineESModuleGetters(lazy, {
|
||||||
ContentTaskUtils: "resource://testing-common/ContentTaskUtils.sys.mjs",
|
ContentTaskUtils: "resource://testing-common/ContentTaskUtils.sys.mjs",
|
||||||
MockColorPicker: "resource://specialpowers/MockColorPicker.sys.mjs",
|
MockColorPicker: "resource://testing-common/MockColorPicker.sys.mjs",
|
||||||
MockFilePicker: "resource://specialpowers/MockFilePicker.sys.mjs",
|
MockFilePicker: "resource://testing-common/MockFilePicker.sys.mjs",
|
||||||
MockPermissionPrompt: "resource://specialpowers/MockPermissionPrompt.sys.mjs",
|
MockPermissionPrompt:
|
||||||
|
"resource://testing-common/MockPermissionPrompt.sys.mjs",
|
||||||
PerTestCoverageUtils:
|
PerTestCoverageUtils:
|
||||||
"resource://testing-common/PerTestCoverageUtils.sys.mjs",
|
"resource://testing-common/PerTestCoverageUtils.sys.mjs",
|
||||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
|
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
|
||||||
SpecialPowersSandbox: "resource://specialpowers/SpecialPowersSandbox.sys.mjs",
|
SpecialPowersSandbox:
|
||||||
WrapPrivileged: "resource://specialpowers/WrapPrivileged.sys.mjs",
|
"resource://testing-common/SpecialPowersSandbox.sys.mjs",
|
||||||
|
WrapPrivileged: "resource://testing-common/WrapPrivileged.sys.mjs",
|
||||||
});
|
});
|
||||||
ChromeUtils.defineModuleGetter(
|
ChromeUtils.defineModuleGetter(
|
||||||
lazy,
|
lazy,
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||||||
HiddenFrame: "resource://gre/modules/HiddenFrame.sys.mjs",
|
HiddenFrame: "resource://gre/modules/HiddenFrame.sys.mjs",
|
||||||
PerTestCoverageUtils:
|
PerTestCoverageUtils:
|
||||||
"resource://testing-common/PerTestCoverageUtils.sys.mjs",
|
"resource://testing-common/PerTestCoverageUtils.sys.mjs",
|
||||||
SpecialPowersSandbox: "resource://specialpowers/SpecialPowersSandbox.sys.mjs",
|
SpecialPowersSandbox:
|
||||||
|
"resource://testing-common/SpecialPowersSandbox.sys.mjs",
|
||||||
});
|
});
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ const SANDBOX_GLOBALS = [
|
|||||||
"URL",
|
"URL",
|
||||||
];
|
];
|
||||||
const EXTRA_IMPORTS = {
|
const EXTRA_IMPORTS = {
|
||||||
EventUtils: "resource://specialpowers/SpecialPowersEventUtils.sys.mjs",
|
EventUtils: "resource://testing-common/SpecialPowersEventUtils.sys.mjs",
|
||||||
};
|
};
|
||||||
|
|
||||||
let expectFail = false;
|
let expectFail = false;
|
||||||
|
|||||||
@@ -15,10 +15,12 @@ FINAL_TARGET_FILES += [
|
|||||||
]
|
]
|
||||||
|
|
||||||
FINAL_TARGET_FILES.content += [
|
FINAL_TARGET_FILES.content += [
|
||||||
"../modules/Assert.sys.mjs",
|
|
||||||
"content/AppTestDelegate.sys.mjs",
|
"content/AppTestDelegate.sys.mjs",
|
||||||
"content/AppTestDelegateChild.sys.mjs",
|
"content/AppTestDelegateChild.sys.mjs",
|
||||||
"content/AppTestDelegateParent.sys.mjs",
|
"content/AppTestDelegateParent.sys.mjs",
|
||||||
|
]
|
||||||
|
|
||||||
|
TESTING_JS_MODULES += [
|
||||||
"content/MockColorPicker.sys.mjs",
|
"content/MockColorPicker.sys.mjs",
|
||||||
"content/MockFilePicker.sys.mjs",
|
"content/MockFilePicker.sys.mjs",
|
||||||
"content/MockPermissionPrompt.sys.mjs",
|
"content/MockPermissionPrompt.sys.mjs",
|
||||||
@@ -29,9 +31,5 @@ FINAL_TARGET_FILES.content += [
|
|||||||
"content/WrapPrivileged.sys.mjs",
|
"content/WrapPrivileged.sys.mjs",
|
||||||
]
|
]
|
||||||
|
|
||||||
TESTING_JS_MODULES += [
|
|
||||||
"content/MockFilePicker.sys.mjs",
|
|
||||||
]
|
|
||||||
|
|
||||||
with Files("**"):
|
with Files("**"):
|
||||||
BUG_COMPONENT = ("Testing", "Mochitest")
|
BUG_COMPONENT = ("Testing", "Mochitest")
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ async function submitFormAndGetResults(
|
|||||||
) {
|
) {
|
||||||
async function contentSubmitForm([contentFormAction, contentSelectorValues]) {
|
async function contentSubmitForm([contentFormAction, contentSelectorValues]) {
|
||||||
const { WrapPrivileged } = ChromeUtils.importESModule(
|
const { WrapPrivileged } = ChromeUtils.importESModule(
|
||||||
"resource://specialpowers/WrapPrivileged.sys.mjs"
|
"resource://testing-common/WrapPrivileged.sys.mjs"
|
||||||
);
|
);
|
||||||
let doc = content.document;
|
let doc = content.document;
|
||||||
let form = doc.querySelector("form");
|
let form = doc.querySelector("form");
|
||||||
|
|||||||
Reference in New Issue
Block a user