зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1793652 - Convert docshell/ JSMs to ESMs. r=nika,arai
Differential Revision: https://phabricator.services.mozilla.com/D158599
This commit is contained in:
Родитель
99af743ba9
Коммит
ba5ca544c2
|
@ -16,11 +16,8 @@
|
|||
// simplified, but the risk of regressing its behavior is high.
|
||||
/* eslint complexity: ["error", 43] */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["URIFixup", "URIFixupInfo"];
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { AppConstants } = ChromeUtils.import(
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
);
|
||||
|
@ -266,7 +263,7 @@ XPCOMUtils.defineLazyGetter(lazy, "knownSuffixes", () => {
|
|||
return suffixes;
|
||||
});
|
||||
|
||||
function URIFixup() {
|
||||
export function URIFixup() {
|
||||
// There are cases that nsIExternalProtocolService.externalProtocolHandlerExists() does
|
||||
// not work well and returns always true due to flatpak. In this case, in order to
|
||||
// fallback to nsIHandlerService.exits(), we test whether can trust
|
||||
|
@ -666,7 +663,7 @@ URIFixup.prototype = {
|
|||
QueryInterface: ChromeUtils.generateQI(["nsIURIFixup"]),
|
||||
};
|
||||
|
||||
function URIFixupInfo(originalInput = "") {
|
||||
export function URIFixupInfo(originalInput = "") {
|
||||
this._originalInput = originalInput;
|
||||
}
|
||||
|
|
@ -125,6 +125,6 @@ LOCAL_INCLUDES += [
|
|||
"/tools/profiler",
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES += ["URIFixup.jsm"]
|
||||
EXTRA_JS_MODULES += ["URIFixup.sys.mjs"]
|
||||
|
||||
include("/tools/fuzzing/libfuzzer-config.mozbuild")
|
||||
|
|
|
@ -62,14 +62,14 @@ Classes = [
|
|||
'cid': '{c6cf88b7-452e-47eb-bdc9-86e3561648ef}',
|
||||
'contract_ids': ['@mozilla.org/docshell/uri-fixup;1'],
|
||||
'interfaces': ['nsIURIFixup'],
|
||||
'jsm': 'resource://gre/modules/URIFixup.jsm',
|
||||
'esModule': 'resource://gre/modules/URIFixup.sys.mjs',
|
||||
'singleton': True,
|
||||
'constructor': 'URIFixup',
|
||||
},
|
||||
{
|
||||
'cid': '{33d75835-722f-42c0-89cc-44f328e56a86}',
|
||||
'contract_ids': ['@mozilla.org/docshell/uri-fixup-info;1'],
|
||||
'jsm': 'resource://gre/modules/URIFixup.jsm',
|
||||
'esModule': 'resource://gre/modules/URIFixup.sys.mjs',
|
||||
'constructor': 'URIFixupInfo',
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
var EXPORTED_SYMBOLS = ["Bug1622420Child"];
|
||||
|
||||
class Bug1622420Child extends JSWindowActorChild {
|
||||
export class Bug1622420Child extends JSWindowActorChild {
|
||||
receiveMessage(msg) {
|
||||
switch (msg.name) {
|
||||
case "hasWindowContextForTopBC":
|
|
@ -1,5 +1,3 @@
|
|||
var EXPORTED_SYMBOLS = ["Bug422543Child"];
|
||||
|
||||
class SHistoryListener {
|
||||
constructor() {
|
||||
this.retval = true;
|
||||
|
@ -32,7 +30,7 @@ SHistoryListener.prototype.QueryInterface = ChromeUtils.generateQI([
|
|||
|
||||
let listeners;
|
||||
|
||||
class Bug422543Child extends JSWindowActorChild {
|
||||
export class Bug422543Child extends JSWindowActorChild {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
[DEFAULT]
|
||||
support-files =
|
||||
Bug422543Child.jsm
|
||||
Bug422543Child.sys.mjs
|
||||
dummy_page.html
|
||||
favicon_bug655270.ico
|
||||
file_bug234628-1-child.html
|
||||
|
@ -97,7 +97,7 @@ https_first_disabled = true
|
|||
[browser_bug1622420.js]
|
||||
support-files =
|
||||
file_bug1622420.html
|
||||
Bug1622420Child.jsm
|
||||
Bug1622420Child.sys.mjs
|
||||
[browser_bug1673702.js]
|
||||
https_first_disabled = true
|
||||
skip-if =
|
||||
|
|
|
@ -5,7 +5,7 @@ add_task(async function test() {
|
|||
ChromeUtils.registerWindowActor(ACTOR, {
|
||||
allFrames: true,
|
||||
child: {
|
||||
moduleURI: `${base}/Bug1622420Child.jsm`,
|
||||
esModuleURI: `${base}/Bug1622420Child.sys.mjs`,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ add_task(async function runTests() {
|
|||
let base = getRootDirectory(gTestPath).slice(0, -1);
|
||||
ChromeUtils.registerWindowActor(ACTOR, {
|
||||
child: {
|
||||
moduleURI: `${base}/Bug422543Child.jsm`,
|
||||
esModuleURI: `${base}/Bug422543Child.sys.mjs`,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["DocShellHelpersParent", "DocShellHelpersChild"];
|
||||
|
||||
class DocShellHelpersParent extends JSWindowActorParent {
|
||||
export class DocShellHelpersParent extends JSWindowActorParent {
|
||||
static eventListener;
|
||||
|
||||
// These static variables should be set when registering the actor
|
||||
|
@ -31,7 +27,7 @@ class DocShellHelpersParent extends JSWindowActorParent {
|
|||
}
|
||||
}
|
||||
|
||||
class DocShellHelpersChild extends JSWindowActorChild {
|
||||
export class DocShellHelpersChild extends JSWindowActorChild {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
|
@ -39,7 +39,7 @@ support-files =
|
|||
bug909218.html
|
||||
bug909218.js
|
||||
docshell_helpers.js
|
||||
DocShellHelpers.jsm
|
||||
DocShellHelpers.sys.mjs
|
||||
file_viewsource_forbidden_in_iframe.html
|
||||
generic.html
|
||||
mozFrameType_window.xhtml
|
||||
|
|
|
@ -23,8 +23,8 @@ const { BrowserTestUtils } = ChromeUtils.import(
|
|||
);
|
||||
|
||||
const ACTOR_MODULE_URI =
|
||||
"chrome://mochitests/content/chrome/docshell/test/chrome/DocShellHelpers.jsm";
|
||||
const { DocShellHelpersParent } = ChromeUtils.import(ACTOR_MODULE_URI);
|
||||
"chrome://mochitests/content/chrome/docshell/test/chrome/DocShellHelpers.sys.mjs";
|
||||
const { DocShellHelpersParent } = ChromeUtils.importESModule(ACTOR_MODULE_URI);
|
||||
// Some functions assume chrome-harness.js has been loaded.
|
||||
/* import-globals-from ../../../testing/mochitest/chrome-harness.js */
|
||||
|
||||
|
@ -216,10 +216,10 @@ function doPageNavigation(params) {
|
|||
if (useActor) {
|
||||
ChromeUtils.registerWindowActor("DocShellHelpers", {
|
||||
parent: {
|
||||
moduleURI: ACTOR_MODULE_URI,
|
||||
esModuleURI: ACTOR_MODULE_URI,
|
||||
},
|
||||
child: {
|
||||
moduleURI: ACTOR_MODULE_URI,
|
||||
esModuleURI: ACTOR_MODULE_URI,
|
||||
events: {
|
||||
pageshow: { createActor: true, capture: true },
|
||||
pagehide: { createActor: true, capture: true },
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
"use strict";
|
||||
var EXPORTED_SYMBOLS = ["AllowJavascriptChild"];
|
||||
|
||||
class AllowJavascriptChild extends JSWindowActorChild {
|
||||
export class AllowJavascriptChild extends JSWindowActorChild {
|
||||
async receiveMessage(msg) {
|
||||
switch (msg.name) {
|
||||
case "CheckScriptsAllowed":
|
|
@ -1,9 +1,6 @@
|
|||
"use strict";
|
||||
var EXPORTED_SYMBOLS = ["AllowJavascriptParent"];
|
||||
|
||||
let loadPromises = new WeakMap();
|
||||
|
||||
class AllowJavascriptParent extends JSWindowActorParent {
|
||||
export class AllowJavascriptParent extends JSWindowActorParent {
|
||||
async receiveMessage(msg) {
|
||||
switch (msg.name) {
|
||||
case "LoadFired":
|
|
@ -31,8 +31,8 @@ server.registerPathHandler("/", (request, response) => {
|
|||
response.write(HTML);
|
||||
});
|
||||
|
||||
const { AllowJavascriptParent } = ChromeUtils.import(
|
||||
"resource://test/AllowJavascriptParent.jsm"
|
||||
const { AllowJavascriptParent } = ChromeUtils.importESModule(
|
||||
"resource://test/AllowJavascriptParent.sys.mjs"
|
||||
);
|
||||
|
||||
async function assertScriptsAllowed(bc, expectAllowed, desc) {
|
||||
|
@ -65,11 +65,11 @@ add_task(async function() {
|
|||
ChromeUtils.registerWindowActor(ACTOR, {
|
||||
allFrames: true,
|
||||
child: {
|
||||
moduleURI: "resource://test/AllowJavascriptChild.jsm",
|
||||
esModuleURI: "resource://test/AllowJavascriptChild.sys.mjs",
|
||||
events: { load: { capture: true } },
|
||||
},
|
||||
parent: {
|
||||
moduleURI: "resource://test/AllowJavascriptParent.jsm",
|
||||
esModuleURI: "resource://test/AllowJavascriptParent.sys.mjs",
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ head = head_docshell.js
|
|||
[test_allowJavascript.js]
|
||||
skip-if = os == 'android'
|
||||
support-files =
|
||||
AllowJavascriptChild.jsm
|
||||
AllowJavascriptParent.jsm
|
||||
AllowJavascriptChild.sys.mjs
|
||||
AllowJavascriptParent.sys.mjs
|
||||
[test_bug442584.js]
|
||||
[test_browsing_context_structured_clone.js]
|
||||
[test_URIFixup.js]
|
||||
|
|
|
@ -32,15 +32,10 @@ excluded_from_convert_prefix = list(
|
|||
path_sep_to_native,
|
||||
[
|
||||
# Testcases for actors.
|
||||
"docshell/test/unit/AllowJavascriptChild.jsm",
|
||||
"docshell/test/unit/AllowJavascriptParent.jsm",
|
||||
"toolkit/actors/TestProcessActorChild.jsm",
|
||||
"toolkit/actors/TestProcessActorParent.jsm",
|
||||
"toolkit/actors/TestWindowChild.jsm",
|
||||
"toolkit/actors/TestWindowParent.jsm",
|
||||
# Testcases for loader.
|
||||
"docshell/test/browser/Bug1622420Child.jsm",
|
||||
"docshell/test/browser/Bug422543Child.jsm",
|
||||
"js/xpconnect/tests/unit/",
|
||||
# Testcase for build system.
|
||||
"python/mozbuild/mozbuild/test/",
|
||||
|
|
|
@ -86,7 +86,7 @@ avoid-blacklist-and-whitelist:
|
|||
- devtools/client/inspector/markup/test/lib_babel_6.21.0_min.js
|
||||
- devtools/client/inspector/markup/test/lib_react_dom_15.4.1.js
|
||||
- docshell/base/nsDocShell.cpp
|
||||
- docshell/base/URIFixup.jsm
|
||||
- docshell/base/URIFixup.sys.mjs
|
||||
- docshell/test/unit/test_URIFixup_info.js
|
||||
- dom/base/Document.cpp
|
||||
- dom/base/MaybeCrossOriginObject.cpp
|
||||
|
|
Загрузка…
Ссылка в новой задаче