mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1648545: Part 1 - Move most of SpecialPowers to testing-common. r=ahal,credential-management-reviewers,sgalich
Differential Revision: https://phabricator.services.mozilla.com/D119448
This commit is contained in:
parent
ec0426503d
commit
e94ae217e5
@ -90,8 +90,8 @@ const intermittently_loaded_scripts = {
|
||||
"resource://testing-common/BrowserTestUtilsChild.sys.mjs",
|
||||
"resource://testing-common/ContentEventListenerChild.sys.mjs",
|
||||
"resource://specialpowers/AppTestDelegateChild.sys.mjs",
|
||||
"resource://specialpowers/SpecialPowersChild.sys.mjs",
|
||||
"resource://specialpowers/WrapPrivileged.sys.mjs",
|
||||
"resource://testing-common/SpecialPowersChild.sys.mjs",
|
||||
"resource://testing-common/WrapPrivileged.sys.mjs",
|
||||
]),
|
||||
frameScripts: new Set([]),
|
||||
processScripts: new Set([
|
||||
|
@ -72,9 +72,9 @@ const intermittently_loaded_scripts = {
|
||||
"chrome://remote/content/shared/Log.sys.mjs",
|
||||
"resource://testing-common/BrowserTestUtilsChild.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/WrapPrivileged.sys.mjs",
|
||||
"resource://testing-common/WrapPrivileged.sys.mjs",
|
||||
]),
|
||||
processScripts: new Set([]),
|
||||
};
|
||||
|
@ -234,9 +234,6 @@ async function synthesizeMouse(browser, link, event) {
|
||||
browser,
|
||||
[link, event],
|
||||
(linkInContent, eventInContent) => {
|
||||
const { EventUtils } = ChromeUtils.importESModule(
|
||||
"resource://specialpowers/SpecialPowersEventUtils.sys.mjs"
|
||||
);
|
||||
const target = content.document.getElementById(linkInContent);
|
||||
EventUtils.synthesizeMouseAtCenter(target, eventInContent, content);
|
||||
return target.href;
|
||||
|
@ -155,10 +155,7 @@ async function clickOn(selector, beforeContentFn) {
|
||||
}
|
||||
|
||||
await SpecialPowers.spawn(lastTab.linkedBrowser, [selector], arg => {
|
||||
const { EventUtils } = ChromeUtils.importESModule(
|
||||
"resource://specialpowers/SpecialPowersEventUtils.sys.mjs"
|
||||
);
|
||||
|
||||
/* eslint-env mozilla/chrome-script */
|
||||
let element = content.document.querySelector(arg);
|
||||
return EventUtils.synthesizeClick(element);
|
||||
});
|
||||
|
@ -13,9 +13,6 @@
|
||||
function triggerKey() {
|
||||
SpecialPowers.loadChromeScript(() => {
|
||||
/* eslint-env mozilla/chrome-script */
|
||||
const { EventUtils } = ChromeUtils.import(
|
||||
"resource://specialpowers/SpecialPowersEventUtils.jsm"
|
||||
);
|
||||
var win = Services.wm.getMostRecentBrowserWindow();
|
||||
for (let i = 0; i < 200; ++i) {
|
||||
EventUtils.synthesizeKey("a", {}, win);
|
||||
|
@ -26,9 +26,6 @@
|
||||
// InputTaskManager properly
|
||||
SpecialPowers.loadChromeScript(() => {
|
||||
/* eslint-env mozilla/chrome-script */
|
||||
const { EventUtils } = ChromeUtils.import(
|
||||
"resource://specialpowers/SpecialPowersEventUtils.jsm"
|
||||
);
|
||||
var win = Services.wm.getMostRecentBrowserWindow();
|
||||
EventUtils.synthesizeKey("a", {}, win);
|
||||
EventUtils.synthesizeKey("b", {}, win);
|
||||
|
@ -14,9 +14,6 @@
|
||||
input.focus();
|
||||
SpecialPowers.loadChromeScript(() => {
|
||||
/* eslint-env mozilla/chrome-script */
|
||||
const { EventUtils } = ChromeUtils.import(
|
||||
"resource://specialpowers/SpecialPowersEventUtils.jsm"
|
||||
);
|
||||
var win = Services.wm.getMostRecentBrowserWindow();
|
||||
EventUtils.synthesizeKey("a", {}, win);
|
||||
});
|
||||
|
@ -9,10 +9,7 @@ add_task(async function test_explicit_object_prototype() {
|
||||
const url =
|
||||
"http://mochi.test:8888/browser/js/xpconnect/tests/browser/browser_promise_userInteractionHandling.html";
|
||||
await BrowserTestUtils.withNewTab(url, async browser => {
|
||||
await ContentTask.spawn(browser, {}, async () => {
|
||||
const { EventUtils } = ChromeUtils.importESModule(
|
||||
"resource://specialpowers/SpecialPowersEventUtils.sys.mjs"
|
||||
);
|
||||
await SpecialPowers.spawn(browser, [], async () => {
|
||||
const DOMWindowUtils = EventUtils._getDOMWindowUtils(content.window);
|
||||
is(
|
||||
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.
|
||||
var stack = SpecialPowers.wrap(SpecialPowers.Components).stack;
|
||||
while (/specialpowers/.test(stack)) {
|
||||
while (/testing-common/.test(stack)) {
|
||||
stack = stack.caller;
|
||||
}
|
||||
ok(/clickCallback/.test(stack), "clickCallback should be reachable via Components.stack");
|
||||
|
@ -13,13 +13,6 @@ XPCOMUtils.defineLazyServiceGetter(
|
||||
|
||||
this.specialpowers = class extends ExtensionAPI {
|
||||
onStartup() {
|
||||
let uri = Services.io.newURI("content/", null, this.extension.rootURI);
|
||||
resProto.setSubstitutionWithFlags(
|
||||
"specialpowers",
|
||||
uri,
|
||||
resProto.ALLOW_CONTENT_ACCESS
|
||||
);
|
||||
|
||||
// Register special testing modules.
|
||||
let manifest = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
||||
manifest.append("tests.manifest");
|
||||
@ -27,18 +20,36 @@ this.specialpowers = class extends ExtensionAPI {
|
||||
.QueryInterface(Ci.nsIComponentRegistrar)
|
||||
.autoRegister(manifest);
|
||||
|
||||
{
|
||||
let uri = Services.io.newURI("content/", null, this.extension.rootURI);
|
||||
resProto.setSubstitutionWithFlags(
|
||||
"specialpowers",
|
||||
uri,
|
||||
resProto.ALLOW_CONTENT_ACCESS
|
||||
);
|
||||
}
|
||||
|
||||
if (!resProto.hasSubstitution("testing-common")) {
|
||||
let uri = Services.io.newURI("modules/", null, this.extension.rootURI);
|
||||
resProto.setSubstitution(
|
||||
"testing-common",
|
||||
uri,
|
||||
resProto.ALLOW_CONTENT_ACCESS
|
||||
);
|
||||
}
|
||||
|
||||
ChromeUtils.registerWindowActor("SpecialPowers", {
|
||||
allFrames: true,
|
||||
includeChrome: true,
|
||||
child: {
|
||||
esModuleURI: "resource://specialpowers/SpecialPowersChild.sys.mjs",
|
||||
esModuleURI: "resource://testing-common/SpecialPowersChild.sys.mjs",
|
||||
observers: [
|
||||
"chrome-document-global-created",
|
||||
"content-document-global-created",
|
||||
],
|
||||
},
|
||||
parent: {
|
||||
esModuleURI: "resource://specialpowers/SpecialPowersParent.sys.mjs",
|
||||
esModuleURI: "resource://testing-common/SpecialPowersParent.sys.mjs",
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
WrapPrivileged: "resource://specialpowers/WrapPrivileged.sys.mjs",
|
||||
WrapPrivileged: "resource://testing-common/WrapPrivileged.sys.mjs",
|
||||
});
|
||||
|
||||
const Cm = Components.manager;
|
||||
|
@ -6,7 +6,7 @@ const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
|
||||
WrapPrivileged: "resource://specialpowers/WrapPrivileged.sys.mjs",
|
||||
WrapPrivileged: "resource://testing-common/WrapPrivileged.sys.mjs",
|
||||
});
|
||||
|
||||
const Cm = Components.manager;
|
||||
|
@ -12,14 +12,16 @@ const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
ContentTaskUtils: "resource://testing-common/ContentTaskUtils.sys.mjs",
|
||||
MockColorPicker: "resource://specialpowers/MockColorPicker.sys.mjs",
|
||||
MockFilePicker: "resource://specialpowers/MockFilePicker.sys.mjs",
|
||||
MockPermissionPrompt: "resource://specialpowers/MockPermissionPrompt.sys.mjs",
|
||||
MockColorPicker: "resource://testing-common/MockColorPicker.sys.mjs",
|
||||
MockFilePicker: "resource://testing-common/MockFilePicker.sys.mjs",
|
||||
MockPermissionPrompt:
|
||||
"resource://testing-common/MockPermissionPrompt.sys.mjs",
|
||||
PerTestCoverageUtils:
|
||||
"resource://testing-common/PerTestCoverageUtils.sys.mjs",
|
||||
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
|
||||
SpecialPowersSandbox: "resource://specialpowers/SpecialPowersSandbox.sys.mjs",
|
||||
WrapPrivileged: "resource://specialpowers/WrapPrivileged.sys.mjs",
|
||||
SpecialPowersSandbox:
|
||||
"resource://testing-common/SpecialPowersSandbox.sys.mjs",
|
||||
WrapPrivileged: "resource://testing-common/WrapPrivileged.sys.mjs",
|
||||
});
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
|
@ -12,7 +12,8 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
||||
PerTestCoverageUtils:
|
||||
"resource://testing-common/PerTestCoverageUtils.sys.mjs",
|
||||
ServiceWorkerCleanUp: "resource://gre/modules/ServiceWorkerCleanUp.sys.mjs",
|
||||
SpecialPowersSandbox: "resource://specialpowers/SpecialPowersSandbox.sys.mjs",
|
||||
SpecialPowersSandbox:
|
||||
"resource://testing-common/SpecialPowersSandbox.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
|
@ -28,7 +28,7 @@ const SANDBOX_GLOBALS = [
|
||||
"URL",
|
||||
];
|
||||
const EXTRA_IMPORTS = {
|
||||
EventUtils: "resource://specialpowers/SpecialPowersEventUtils.sys.mjs",
|
||||
EventUtils: "resource://testing-common/SpecialPowersEventUtils.sys.mjs",
|
||||
};
|
||||
|
||||
let expectFail = false;
|
||||
|
@ -15,10 +15,12 @@ FINAL_TARGET_FILES += [
|
||||
]
|
||||
|
||||
FINAL_TARGET_FILES.content += [
|
||||
"../modules/Assert.sys.mjs",
|
||||
"content/AppTestDelegate.sys.mjs",
|
||||
"content/AppTestDelegateChild.sys.mjs",
|
||||
"content/AppTestDelegateParent.sys.mjs",
|
||||
]
|
||||
|
||||
modules = [
|
||||
"content/MockColorPicker.sys.mjs",
|
||||
"content/MockFilePicker.sys.mjs",
|
||||
"content/MockPermissionPrompt.sys.mjs",
|
||||
@ -29,9 +31,9 @@ FINAL_TARGET_FILES.content += [
|
||||
"content/WrapPrivileged.sys.mjs",
|
||||
]
|
||||
|
||||
TESTING_JS_MODULES += [
|
||||
"content/MockFilePicker.sys.mjs",
|
||||
]
|
||||
TESTING_JS_MODULES += modules
|
||||
|
||||
FINAL_TARGET_FILES.modules += modules
|
||||
|
||||
with Files("**"):
|
||||
BUG_COMPONENT = ("Testing", "Mochitest")
|
||||
|
@ -128,7 +128,7 @@ async function submitFormAndGetResults(
|
||||
) {
|
||||
async function contentSubmitForm([contentFormAction, contentSelectorValues]) {
|
||||
const { WrapPrivileged } = ChromeUtils.importESModule(
|
||||
"resource://specialpowers/WrapPrivileged.sys.mjs"
|
||||
"resource://testing-common/WrapPrivileged.sys.mjs"
|
||||
);
|
||||
let doc = content.document;
|
||||
let form = doc.querySelector("form");
|
||||
|
Loading…
Reference in New Issue
Block a user