Bug 1826265 - Convert lazy load JSM by GeckoViewStartup module to ESM. r=geckoview-reviewers,extension-reviewers,amejiamarmol

Also, GeckoViewStorageController might not use correct principal since
bug 1801338 doesn't consider GeckoView.

So this fix loads correct ESM and use lazy loading.

Differential Revision: https://phabricator.services.mozilla.com/D174557
This commit is contained in:
Makoto Kato 2023-04-11 08:55:43 +00:00
Родитель b1ac56a99e
Коммит dbdf270e6a
19 изменённых файлов: 62 добавлений и 148 удалений

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

@ -11,14 +11,9 @@
ChromeUtils.defineESModuleGetters(this, { ChromeUtils.defineESModuleGetters(this, {
GeckoViewTabBridge: "resource://gre/modules/GeckoViewTab.sys.mjs", GeckoViewTabBridge: "resource://gre/modules/GeckoViewTab.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
mobileWindowTracker: "resource://gre/modules/GeckoViewWebExtension.sys.mjs",
}); });
ChromeUtils.defineModuleGetter(
this,
"mobileWindowTracker",
"resource://gre/modules/GeckoViewWebExtension.jsm"
);
var { EventDispatcher } = ChromeUtils.importESModule( var { EventDispatcher } = ChromeUtils.importESModule(
"resource://gre/modules/Messaging.sys.mjs" "resource://gre/modules/Messaging.sys.mjs"
); );

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

@ -6,9 +6,9 @@
"use strict"; "use strict";
XPCOMUtils.defineLazyModuleGetters(this, { ChromeUtils.defineESModuleGetters(this, {
GeckoViewWebExtension: "resource://gre/modules/GeckoViewWebExtension.jsm", GeckoViewWebExtension: "resource://gre/modules/GeckoViewWebExtension.sys.mjs",
ExtensionActionHelper: "resource://gre/modules/GeckoViewWebExtension.jsm", ExtensionActionHelper: "resource://gre/modules/GeckoViewWebExtension.sys.mjs",
}); });
const { BrowserActionBase } = ChromeUtils.import( const { BrowserActionBase } = ChromeUtils.import(

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

@ -6,9 +6,7 @@
ChromeUtils.defineESModuleGetters(this, { ChromeUtils.defineESModuleGetters(this, {
DownloadPaths: "resource://gre/modules/DownloadPaths.sys.mjs", DownloadPaths: "resource://gre/modules/DownloadPaths.sys.mjs",
}); DownloadTracker: "resource://gre/modules/GeckoViewWebExtension.sys.mjs",
XPCOMUtils.defineLazyModuleGetters(this, {
DownloadTracker: "resource://gre/modules/GeckoViewWebExtension.jsm",
}); });
Cu.importGlobalProperties(["PathUtils"]); Cu.importGlobalProperties(["PathUtils"]);

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

@ -6,9 +6,9 @@
"use strict"; "use strict";
XPCOMUtils.defineLazyModuleGetters(this, { ChromeUtils.defineESModuleGetters(this, {
GeckoViewWebExtension: "resource://gre/modules/GeckoViewWebExtension.jsm", GeckoViewWebExtension: "resource://gre/modules/GeckoViewWebExtension.sys.mjs",
ExtensionActionHelper: "resource://gre/modules/GeckoViewWebExtension.jsm", ExtensionActionHelper: "resource://gre/modules/GeckoViewWebExtension.sys.mjs",
}); });
const { PageActionBase } = ChromeUtils.import( const { PageActionBase } = ChromeUtils.import(

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

@ -9,14 +9,9 @@
ChromeUtils.defineESModuleGetters(this, { ChromeUtils.defineESModuleGetters(this, {
GeckoViewTabBridge: "resource://gre/modules/GeckoViewTab.sys.mjs", GeckoViewTabBridge: "resource://gre/modules/GeckoViewTab.sys.mjs",
PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs", PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs",
mobileWindowTracker: "resource://gre/modules/GeckoViewWebExtension.sys.mjs",
}); });
ChromeUtils.defineModuleGetter(
this,
"mobileWindowTracker",
"resource://gre/modules/GeckoViewWebExtension.jsm"
);
const getBrowserWindow = window => { const getBrowserWindow = window => {
return window.browsingContext.topChromeWindow; return window.browsingContext.topChromeWindow;
}; };

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

@ -129,11 +129,11 @@ class GeckoViewStartup {
case "content-process-ready-for-script": case "content-process-ready-for-script":
case "app-startup": { case "app-startup": {
GeckoViewUtils.addLazyGetter(this, "GeckoViewConsole", { GeckoViewUtils.addLazyGetter(this, "GeckoViewConsole", {
module: "resource://gre/modules/GeckoViewConsole.jsm", module: "resource://gre/modules/GeckoViewConsole.sys.mjs",
}); });
GeckoViewUtils.addLazyGetter(this, "GeckoViewStorageController", { GeckoViewUtils.addLazyGetter(this, "GeckoViewStorageController", {
module: "resource://gre/modules/GeckoViewStorageController.jsm", module: "resource://gre/modules/GeckoViewStorageController.sys.mjs",
ged: [ ged: [
"GeckoView:ClearData", "GeckoView:ClearData",
"GeckoView:ClearSessionContextData", "GeckoView:ClearSessionContextData",
@ -150,7 +150,7 @@ class GeckoViewStartup {
}); });
GeckoViewUtils.addLazyGetter(this, "GeckoViewPushController", { GeckoViewUtils.addLazyGetter(this, "GeckoViewPushController", {
module: "resource://gre/modules/GeckoViewPushController.jsm", module: "resource://gre/modules/GeckoViewPushController.sys.mjs",
ged: ["GeckoView:PushEvent", "GeckoView:PushSubscriptionChanged"], ged: ["GeckoView:PushEvent", "GeckoView:PushSubscriptionChanged"],
}); });
@ -173,7 +173,7 @@ class GeckoViewStartup {
if (Services.appinfo.sessionHistoryInParent) { if (Services.appinfo.sessionHistoryInParent) {
GeckoViewUtils.addLazyGetter(this, "GeckoViewSessionStore", { GeckoViewUtils.addLazyGetter(this, "GeckoViewSessionStore", {
module: "resource://gre/modules/GeckoViewSessionStore.jsm", module: "resource://gre/modules/GeckoViewSessionStore.sys.mjs",
observers: [ observers: [
"browsing-context-did-set-embedder", "browsing-context-did-set-embedder",
"browsing-context-discarded", "browsing-context-discarded",
@ -182,7 +182,7 @@ class GeckoViewStartup {
} }
GeckoViewUtils.addLazyGetter(this, "GeckoViewWebExtension", { GeckoViewUtils.addLazyGetter(this, "GeckoViewWebExtension", {
module: "resource://gre/modules/GeckoViewWebExtension.jsm", module: "resource://gre/modules/GeckoViewWebExtension.sys.mjs",
ged: [ ged: [
"GeckoView:ActionDelegate:Attached", "GeckoView:ActionDelegate:Attached",
"GeckoView:BrowserAction:Click", "GeckoView:BrowserAction:Click",
@ -211,7 +211,7 @@ class GeckoViewStartup {
}); });
GeckoViewUtils.addLazyGetter(this, "ChildCrashHandler", { GeckoViewUtils.addLazyGetter(this, "ChildCrashHandler", {
module: "resource://gre/modules/ChildCrashHandler.jsm", module: "resource://gre/modules/ChildCrashHandler.sys.mjs",
observers: ["ipc:content-shutdown", "compositor:process-aborted"], observers: ["ipc:content-shutdown", "compositor:process-aborted"],
}); });
@ -224,7 +224,7 @@ class GeckoViewStartup {
case "profile-after-change": { case "profile-after-change": {
GeckoViewUtils.addLazyGetter(this, "GeckoViewRemoteDebugger", { GeckoViewUtils.addLazyGetter(this, "GeckoViewRemoteDebugger", {
module: "resource://gre/modules/GeckoViewRemoteDebugger.jsm", module: "resource://gre/modules/GeckoViewRemoteDebugger.sys.mjs",
init: gvrd => gvrd.onInit(), init: gvrd => gvrd.onInit(),
}); });
@ -239,7 +239,7 @@ class GeckoViewStartup {
); );
GeckoViewUtils.addLazyGetter(this, "DownloadTracker", { GeckoViewUtils.addLazyGetter(this, "DownloadTracker", {
module: "resource://gre/modules/GeckoViewWebExtension.jsm", module: "resource://gre/modules/GeckoViewWebExtension.sys.mjs",
ged: ["GeckoView:WebExtension:DownloadChanged"], ged: ["GeckoView:WebExtension:DownloadChanged"],
}); });

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

@ -101,7 +101,7 @@ public class WebExtension {
private static final String LOGTAG = "WebExtension"; private static final String LOGTAG = "WebExtension";
// Keep in sync with GeckoViewWebExtension.jsm // Keep in sync with GeckoViewWebExtension.sys.mjs
public static class Flags { public static class Flags {
/* /*
* Default flags for this WebExtension. * Default flags for this WebExtension.

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

@ -2,16 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
var EXPORTED_SYMBOLS = ["ChildCrashHandler"];
const { GeckoViewUtils } = ChromeUtils.importESModule(
"resource://gre/modules/GeckoViewUtils.sys.mjs"
);
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -34,7 +26,7 @@ function getPendingMinidump(id) {
}); });
} }
var ChildCrashHandler = { export var ChildCrashHandler = {
// The event listener for this is hooked up in GeckoViewStartup.jsm // The event listener for this is hooked up in GeckoViewStartup.jsm
observe(aSubject, aTopic, aData) { observe(aSubject, aTopic, aData) {
if ( if (

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

@ -1,17 +1,12 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["GeckoViewConsole"]; import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
const { GeckoViewUtils } = ChromeUtils.importESModule(
"resource://gre/modules/GeckoViewUtils.sys.mjs"
);
const { debug, warn } = GeckoViewUtils.initLogging("Console"); const { debug, warn } = GeckoViewUtils.initLogging("Console");
var GeckoViewConsole = { export var GeckoViewConsole = {
_isEnabled: false, _isEnabled: false,
get enabled() { get enabled() {

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

@ -2,16 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
var EXPORTED_SYMBOLS = ["GeckoViewPushController"];
const { GeckoViewUtils } = ChromeUtils.importESModule(
"resource://gre/modules/GeckoViewUtils.sys.mjs"
);
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -33,7 +25,7 @@ function createScopeAndPrincipal(scopeAndAttrs) {
return [scope, principal]; return [scope, principal];
} }
const GeckoViewPushController = { export const GeckoViewPushController = {
onEvent(aEvent, aData, aCallback) { onEvent(aEvent, aData, aCallback) {
debug`onEvent ${aEvent} ${aData}`; debug`onEvent ${aEvent} ${aData}`;

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

@ -2,16 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
var EXPORTED_SYMBOLS = ["GeckoViewRemoteDebugger"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { GeckoViewUtils } = ChromeUtils.importESModule(
"resource://gre/modules/GeckoViewUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -34,7 +26,7 @@ XPCOMUtils.defineLazyGetter(lazy, "SocketListener", () => {
const { debug, warn } = GeckoViewUtils.initLogging("RemoteDebugger"); const { debug, warn } = GeckoViewUtils.initLogging("RemoteDebugger");
var GeckoViewRemoteDebugger = { export var GeckoViewRemoteDebugger = {
observe(aSubject, aTopic, aData) { observe(aSubject, aTopic, aData) {
if (aTopic !== "nsPref:changed") { if (aTopic !== "nsPref:changed") {
return; return;

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

@ -2,14 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
var EXPORTED_SYMBOLS = ["GeckoViewSessionStore"];
const { GeckoViewUtils } = ChromeUtils.importESModule(
"resource://gre/modules/GeckoViewUtils.sys.mjs"
);
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const lazy = {}; const lazy = {};
@ -115,7 +108,7 @@ class SHistoryListener {
} }
} }
var GeckoViewSessionStore = { export var GeckoViewSessionStore = {
// For each <browser> element, records the SHistoryListener. // For each <browser> element, records the SHistoryListener.
_browserSHistoryListener: new WeakMap(), _browserSHistoryListener: new WeakMap(),

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

@ -2,16 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
var EXPORTED_SYMBOLS = ["GeckoViewStorageController"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
E10SUtils: "resource://gre/modules/E10SUtils.sys.mjs",
PrincipalsCollector: "resource://gre/modules/PrincipalsCollector.sys.mjs",
});
XPCOMUtils.defineLazyPreferenceGetter( XPCOMUtils.defineLazyPreferenceGetter(
lazy, lazy,
"serviceMode", "serviceMode",
@ -25,15 +25,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
"cookiebanners.service.mode.privateBrowsing", "cookiebanners.service.mode.privateBrowsing",
Ci.nsICookieBannerService.MODE_DISABLED Ci.nsICookieBannerService.MODE_DISABLED
); );
const { GeckoViewUtils } = ChromeUtils.importESModule(
"resource://gre/modules/GeckoViewUtils.sys.mjs"
);
const { PrincipalsCollector } = ChromeUtils.import(
"resource://gre/modules/PrincipalsCollector.jsm"
);
const { E10SUtils } = ChromeUtils.importESModule(
"resource://gre/modules/E10SUtils.sys.mjs"
);
const { debug, warn } = GeckoViewUtils.initLogging( const { debug, warn } = GeckoViewUtils.initLogging(
"GeckoViewStorageController" "GeckoViewStorageController"
@ -112,7 +103,7 @@ function convertFlags(aJavaFlags) {
return flags; return flags;
} }
const GeckoViewStorageController = { export const GeckoViewStorageController = {
onEvent(aEvent, aData, aCallback) { onEvent(aEvent, aData, aCallback) {
debug`onEvent ${aEvent} ${aData}`; debug`onEvent ${aEvent} ${aData}`;
@ -138,7 +129,7 @@ const GeckoViewStorageController = {
const permissions = rawPerms.map(p => { const permissions = rawPerms.map(p => {
return { return {
uri: Services.io.createExposableURI(p.principal.URI).displaySpec, uri: Services.io.createExposableURI(p.principal.URI).displaySpec,
principal: E10SUtils.serializePrincipal(p.principal), principal: lazy.E10SUtils.serializePrincipal(p.principal),
perm: p.type, perm: p.type,
value: p.capability, value: p.capability,
contextId: p.principal.originAttributes.geckoViewSessionContextId, contextId: p.principal.originAttributes.geckoViewSessionContextId,
@ -163,7 +154,7 @@ const GeckoViewStorageController = {
const permissions = rawPerms.map(p => { const permissions = rawPerms.map(p => {
return { return {
uri: Services.io.createExposableURI(p.principal.URI).displaySpec, uri: Services.io.createExposableURI(p.principal.URI).displaySpec,
principal: E10SUtils.serializePrincipal(p.principal), principal: lazy.E10SUtils.serializePrincipal(p.principal),
perm: p.type, perm: p.type,
value: p.capability, value: p.capability,
contextId: p.principal.originAttributes.geckoViewSessionContextId, contextId: p.principal.originAttributes.geckoViewSessionContextId,
@ -174,7 +165,7 @@ const GeckoViewStorageController = {
break; break;
} }
case "GeckoView:SetPermission": { case "GeckoView:SetPermission": {
const principal = E10SUtils.deserializePrincipal(aData.principal); const principal = lazy.E10SUtils.deserializePrincipal(aData.principal);
let key = aData.perm; let key = aData.perm;
if (key == "storage-access") { if (key == "storage-access") {
key = "3rdPartyStorage^" + aData.thirdPartyOrigin; key = "3rdPartyStorage^" + aData.thirdPartyOrigin;
@ -297,7 +288,7 @@ const GeckoViewStorageController = {
// user interaction, we need to ensure that we only delete those permissions that // user interaction, we need to ensure that we only delete those permissions that
// do not have any existing storage. // do not have any existing storage.
if (flags & Ci.nsIClearDataService.CLEAR_HISTORY) { if (flags & Ci.nsIClearDataService.CLEAR_HISTORY) {
const principalsCollector = new PrincipalsCollector(); const principalsCollector = new lazy.PrincipalsCollector();
const principals = await principalsCollector.getAllPrincipals(); const principals = await principalsCollector.getAllPrincipals();
await new Promise(resolve => { await new Promise(resolve => {
Services.clearData.deleteUserInteractionForClearingHistory( Services.clearData.deleteUserInteractionForClearingHistory(

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

@ -3,7 +3,6 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
import { GeckoViewModule } from "resource://gre/modules/GeckoViewModule.sys.mjs"; import { GeckoViewModule } from "resource://gre/modules/GeckoViewModule.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const { ExtensionUtils } = ChromeUtils.import( const { ExtensionUtils } = ChromeUtils.import(
"resource://gre/modules/ExtensionUtils.jsm" "resource://gre/modules/ExtensionUtils.jsm"
@ -15,10 +14,7 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", EventDispatcher: "resource://gre/modules/Messaging.sys.mjs",
}); mobileWindowTracker: "resource://gre/modules/GeckoViewWebExtension.sys.mjs",
XPCOMUtils.defineLazyModuleGetters(lazy, {
mobileWindowTracker: "resource://gre/modules/GeckoViewWebExtension.jsm",
}); });
class Tab { class Tab {

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

@ -89,7 +89,7 @@ export var GeckoViewUtils = {
XPCOMUtils.defineLazyGetter(scope, name, _ => { XPCOMUtils.defineLazyGetter(scope, name, _ => {
let ret = undefined; let ret = undefined;
if (module) { if (module) {
ret = ChromeUtils.import(module)[name]; ret = ChromeUtils.importESModule(module)[name];
} else if (service) { } else if (service) {
ret = Cc[service].getService(Ci.nsISupports).wrappedJSObject; ret = Cc[service].getService(Ci.nsISupports).wrappedJSObject;
} else if (typeof handler === "function") { } else if (typeof handler === "function") {

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

@ -2,25 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
var EXPORTED_SYMBOLS = [ import { EventEmitter } from "resource://gre/modules/EventEmitter.sys.mjs";
"ExtensionActionHelper",
"GeckoViewConnection",
"GeckoViewWebExtension",
"mobileWindowTracker",
"DownloadTracker",
];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { GeckoViewUtils } = ChromeUtils.importESModule(
"resource://gre/modules/GeckoViewUtils.sys.mjs"
);
const { EventEmitter } = ChromeUtils.importESModule(
"resource://gre/modules/EventEmitter.sys.mjs"
);
const PRIVATE_BROWSING_PERMISSION = { const PRIVATE_BROWSING_PERMISSION = {
permissions: ["internal:privateBrowsingAllowed"], permissions: ["internal:privateBrowsingAllowed"],
@ -52,9 +36,7 @@ XPCOMUtils.defineLazyServiceGetter(
const { debug, warn } = GeckoViewUtils.initLogging("Console"); const { debug, warn } = GeckoViewUtils.initLogging("Console");
const DOWNLOAD_CHANGED_MESSAGE = "GeckoView:WebExtension:DownloadChanged"; export var DownloadTracker = new (class extends EventEmitter {
var DownloadTracker = new (class extends EventEmitter {
constructor() { constructor() {
super(); super();
@ -99,7 +81,7 @@ var DownloadTracker = new (class extends EventEmitter {
})(); })();
/** Provides common logic between page and browser actions */ /** Provides common logic between page and browser actions */
class ExtensionActionHelper { export class ExtensionActionHelper {
constructor({ constructor({
tabTracker, tabTracker,
windowTracker, windowTracker,
@ -203,7 +185,7 @@ class EmbedderPort {
} }
} }
class GeckoViewConnection { export class GeckoViewConnection {
constructor(sender, target, nativeApp, allowContentMessaging) { constructor(sender, target, nativeApp, allowContentMessaging) {
this.sender = sender; this.sender = sender;
this.target = target; this.target = target;
@ -631,7 +613,7 @@ class MobileWindowTracker extends EventEmitter {
} }
} }
var mobileWindowTracker = new MobileWindowTracker(); export var mobileWindowTracker = new MobileWindowTracker();
async function updatePromptHandler(aInfo) { async function updatePromptHandler(aInfo) {
const oldPerms = aInfo.existingAddon.userPermissions; const oldPerms = aInfo.existingAddon.userPermissions;
@ -671,7 +653,7 @@ async function updatePromptHandler(aInfo) {
} }
} }
var GeckoViewWebExtension = { export var GeckoViewWebExtension = {
observe(aSubject, aTopic, aData) { observe(aSubject, aTopic, aData) {
debug`observe ${aTopic}`; debug`observe ${aTopic}`;

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

@ -7,7 +7,7 @@
EXTRA_JS_MODULES += [ EXTRA_JS_MODULES += [
"AndroidLog.jsm", "AndroidLog.jsm",
"BrowserUsageTelemetry.jsm", "BrowserUsageTelemetry.jsm",
"ChildCrashHandler.jsm", "ChildCrashHandler.sys.mjs",
"DelayedInit.jsm", "DelayedInit.jsm",
"GeckoViewActorChild.sys.mjs", "GeckoViewActorChild.sys.mjs",
"GeckoViewActorManager.sys.mjs", "GeckoViewActorManager.sys.mjs",
@ -15,7 +15,7 @@ EXTRA_JS_MODULES += [
"GeckoViewAutocomplete.jsm", "GeckoViewAutocomplete.jsm",
"GeckoViewAutofill.jsm", "GeckoViewAutofill.jsm",
"GeckoViewChildModule.jsm", "GeckoViewChildModule.jsm",
"GeckoViewConsole.jsm", "GeckoViewConsole.sys.mjs",
"GeckoViewContent.sys.mjs", "GeckoViewContent.sys.mjs",
"GeckoViewContentBlocking.sys.mjs", "GeckoViewContentBlocking.sys.mjs",
"GeckoViewMediaControl.sys.mjs", "GeckoViewMediaControl.sys.mjs",
@ -23,17 +23,17 @@ EXTRA_JS_MODULES += [
"GeckoViewNavigation.sys.mjs", "GeckoViewNavigation.sys.mjs",
"GeckoViewProcessHangMonitor.sys.mjs", "GeckoViewProcessHangMonitor.sys.mjs",
"GeckoViewProgress.sys.mjs", "GeckoViewProgress.sys.mjs",
"GeckoViewPushController.jsm", "GeckoViewPushController.sys.mjs",
"GeckoViewRemoteDebugger.jsm", "GeckoViewRemoteDebugger.sys.mjs",
"GeckoViewSelectionAction.sys.mjs", "GeckoViewSelectionAction.sys.mjs",
"GeckoViewSessionStore.jsm", "GeckoViewSessionStore.sys.mjs",
"GeckoViewSettings.sys.mjs", "GeckoViewSettings.sys.mjs",
"GeckoViewStorageController.jsm", "GeckoViewStorageController.sys.mjs",
"GeckoViewTab.sys.mjs", "GeckoViewTab.sys.mjs",
"GeckoViewTelemetry.jsm", "GeckoViewTelemetry.jsm",
"GeckoViewTestUtils.jsm", "GeckoViewTestUtils.jsm",
"GeckoViewUtils.sys.mjs", "GeckoViewUtils.sys.mjs",
"GeckoViewWebExtension.jsm", "GeckoViewWebExtension.sys.mjs",
"LoadURIDelegate.jsm", "LoadURIDelegate.jsm",
"MediaUtils.jsm", "MediaUtils.jsm",
"Messaging.sys.mjs", "Messaging.sys.mjs",

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

@ -6,19 +6,12 @@
const EXPORTED_SYMBOLS = ["AppUiTestDelegate"]; const EXPORTED_SYMBOLS = ["AppUiTestDelegate"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", EventDispatcher: "resource://gre/modules/Messaging.sys.mjs",
GeckoViewTabBridge: "resource://gre/modules/GeckoViewTab.sys.mjs", GeckoViewTabBridge: "resource://gre/modules/GeckoViewTab.sys.mjs",
}); mobileWindowTracker: "resource://gre/modules/GeckoViewWebExtension.sys.mjs",
XPCOMUtils.defineLazyModuleGetters(lazy, {
mobileWindowTracker: "resource://gre/modules/GeckoViewWebExtension.jsm",
}); });
const TEST_SUPPORT_EXTENSION_ID = "test-runner-support@tests.mozilla.org"; const TEST_SUPPORT_EXTENSION_ID = "test-runner-support@tests.mozilla.org";

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

@ -28,6 +28,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
AsyncShutdown: "resource://gre/modules/AsyncShutdown.sys.mjs", AsyncShutdown: "resource://gre/modules/AsyncShutdown.sys.mjs",
DeferredTask: "resource://gre/modules/DeferredTask.sys.mjs", DeferredTask: "resource://gre/modules/DeferredTask.sys.mjs",
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.sys.mjs", DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.sys.mjs",
GeckoViewConnection: "resource://gre/modules/GeckoViewWebExtension.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
}); });
@ -36,7 +37,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
BroadcastConduit: "resource://gre/modules/ConduitsParent.jsm", BroadcastConduit: "resource://gre/modules/ConduitsParent.jsm",
ExtensionData: "resource://gre/modules/Extension.jsm", ExtensionData: "resource://gre/modules/Extension.jsm",
ExtensionActivityLog: "resource://gre/modules/ExtensionActivityLog.jsm", ExtensionActivityLog: "resource://gre/modules/ExtensionActivityLog.jsm",
GeckoViewConnection: "resource://gre/modules/GeckoViewWebExtension.jsm",
MessageManagerProxy: "resource://gre/modules/MessageManagerProxy.jsm", MessageManagerProxy: "resource://gre/modules/MessageManagerProxy.jsm",
NativeApp: "resource://gre/modules/NativeMessaging.jsm", NativeApp: "resource://gre/modules/NativeMessaging.jsm",
PerformanceCounters: "resource://gre/modules/PerformanceCounters.jsm", PerformanceCounters: "resource://gre/modules/PerformanceCounters.jsm",