Bug 1836715 - Convert GeckoView's components to ESM. r=geckoview-reviewers,ohall

Differential Revision: https://phabricator.services.mozilla.com/D180167
This commit is contained in:
Makoto Kato 2023-06-08 08:51:48 +00:00
Родитель 30895d5c0c
Коммит 1057f41c45
11 изменённых файлов: 37 добавлений и 89 удалений

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

@ -1,13 +1,8 @@
/* 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 = ["ColorPickerDelegate"];
const { GeckoViewUtils } = ChromeUtils.importESModule(
"resource://gre/modules/GeckoViewUtils.sys.mjs"
);
import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
const lazy = {};
@ -17,7 +12,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
const { debug, warn } = GeckoViewUtils.initLogging("ColorPickerDelegate");
class ColorPickerDelegate {
export class ColorPickerDelegate {
// TODO(bug 1805397): Implement default colors
init(aParent, aTitle, aInitialColor, aDefaultColors) {
this._prompt = new lazy.GeckoViewPrompter(aParent);

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

@ -1,13 +1,8 @@
/* 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 = ["FilePickerDelegate"];
const { GeckoViewUtils } = ChromeUtils.importESModule(
"resource://gre/modules/GeckoViewUtils.sys.mjs"
);
import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
const lazy = {};
@ -18,7 +13,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
const { debug, warn } = GeckoViewUtils.initLogging("FilePickerDelegate");
class FilePickerDelegate {
export class FilePickerDelegate {
/* ---------- nsIFilePicker ---------- */
init(aParent, aTitle, aMode) {
if (

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

@ -1,15 +1,10 @@
/* 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 = ["GeckoViewPermission"];
import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
const { GeckoViewUtils } = ChromeUtils.importESModule(
"resource://gre/modules/GeckoViewUtils.sys.mjs"
);
class GeckoViewPermission {
export class GeckoViewPermission {
constructor() {
this.wrappedJSObject = this;
}

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

@ -1,13 +1,8 @@
/* 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 = ["PromptFactory"];
const { GeckoViewUtils } = ChromeUtils.importESModule(
"resource://gre/modules/GeckoViewUtils.sys.mjs"
);
import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
const lazy = {};
@ -18,7 +13,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
const { debug, warn } = GeckoViewUtils.initLogging("GeckoViewPrompt");
class PromptFactory {
export class PromptFactory {
constructor() {
this.wrappedJSObject = this;
}

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

@ -1,13 +1,8 @@
/* 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 = ["PushService"];
const { GeckoViewUtils } = ChromeUtils.importESModule(
"resource://gre/modules/GeckoViewUtils.sys.mjs"
);
import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
const { debug, warn } = GeckoViewUtils.initLogging("GeckoViewPush");
@ -52,7 +47,7 @@ function scopeWithAttrs(scope, attrs) {
return scope + ChromeUtils.originAttributesToSuffix(attrs);
}
class PushService {
export class PushService {
constructor() {
this.wrappedJSObject = this;
}

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

@ -1,13 +1,8 @@
/* 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 = ["GeckoViewStartup"];
const { GeckoViewUtils } = ChromeUtils.importESModule(
"resource://gre/modules/GeckoViewUtils.sys.mjs"
);
import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
const lazy = {};
@ -18,10 +13,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
Preferences: "resource://gre/modules/Preferences.sys.mjs",
});
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { debug, warn } = GeckoViewUtils.initLogging("Startup");
var { DelayedInit } = ChromeUtils.import(
@ -124,7 +115,7 @@ const JSWINDOWACTORS = {
},
};
class GeckoViewStartup {
export class GeckoViewStartup {
/* ---------- nsIObserver ---------- */
observe(aSubject, aTopic, aData) {
debug`observe: ${aTopic}`;

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

@ -1,17 +1,9 @@
/* 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 = ["LoginStorageDelegate"];
const { GeckoViewUtils } = ChromeUtils.importESModule(
"resource://gre/modules/GeckoViewUtils.sys.mjs"
);
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -33,7 +25,7 @@ const LoginStorageHint = {
LOW_CONFIDENCE: 1 << 1,
};
class LoginStorageDelegate {
export class LoginStorageDelegate {
_createMessage({ dismissed, autoSavedLoginGuid }, aLogins) {
let hint = LoginStorageHint.NONE;
if (dismissed) {

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

@ -1,13 +1,8 @@
/* 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 = ["PromptCollection"];
const { GeckoViewUtils } = ChromeUtils.importESModule(
"resource://gre/modules/GeckoViewUtils.sys.mjs"
);
import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
const lazy = {};
@ -17,7 +12,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
const { debug, warn } = GeckoViewUtils.initLogging("PromptCollection");
class PromptCollection {
export class PromptCollection {
confirmRepost(browsingContext) {
const msg = {
type: "repost",

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

@ -1,13 +1,8 @@
/* 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 = ["ShareDelegate"];
const { GeckoViewUtils } = ChromeUtils.importESModule(
"resource://gre/modules/GeckoViewUtils.sys.mjs"
);
import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
const lazy = {};
@ -21,7 +16,7 @@ const domBundle = Services.strings.createBundle(
const { debug, warn } = GeckoViewUtils.initLogging("ShareDelegate");
class ShareDelegate {
export class ShareDelegate {
init(aParent) {
this._openerWindow = aParent;
}

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

@ -8,7 +8,7 @@ Classes = [
{
'cid': '{3e30d2a0-9934-11ea-bb37-0242ac130002}',
'contract_ids': ['@mozilla.org/embedcomp/prompt-collection;1'],
'jsm': 'resource://gre/modules/PromptCollection.jsm',
'esModule': 'resource://gre/modules/PromptCollection.sys.mjs',
'constructor': 'PromptCollection',
},
{
@ -18,52 +18,52 @@ Classes = [
'@mozilla.org/prompter;1',
],
'interfaces': ['nsIPromptService'],
'jsm': 'resource://gre/modules/GeckoViewPrompt.jsm',
'esModule': 'resource://gre/modules/GeckoViewPrompt.sys.mjs',
'constructor': 'PromptFactory',
},
{
'cid': '{8e993c34-fdd6-432c-967e-f995d888777f}',
'contract_ids': ['@mozilla.org/geckoview/startup;1'],
'jsm': 'resource://gre/modules/GeckoViewStartup.jsm',
'esModule': 'resource://gre/modules/GeckoViewStartup.sys.mjs',
'constructor': 'GeckoViewStartup',
},
{
'cid': '{42f3c238-e8e8-4015-9ca2-148723a8afcf}',
'contract_ids': ['@mozilla.org/content-permission/prompt;1'],
'jsm': 'resource://gre/modules/GeckoViewPermission.jsm',
'esModule': 'resource://gre/modules/GeckoViewPermission.sys.mjs',
'constructor': 'GeckoViewPermission',
},
{
'cid': '{a54d84d7-98a4-4fec-b664-e42e512ae9cc}',
'contract_ids': ['@mozilla.org/push/Service;1'],
'jsm': 'resource://gre/modules/GeckoViewPush.jsm',
'esModule': 'resource://gre/modules/GeckoViewPush.sys.mjs',
'constructor': 'PushService',
},
{
'cid': '{fc4bec74-ddd0-4ea8-9a66-9a5081258e32}',
'contract_ids': ['@mozilla.org/parent/colorpicker;1'],
'jsm': 'resource://gre/modules/ColorPickerDelegate.jsm',
'esModule': 'resource://gre/modules/ColorPickerDelegate.sys.mjs',
'constructor': 'ColorPickerDelegate',
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
},
{
'cid': '{25fdbae6-f684-4bf0-b773-ff2b7a6273c8}',
'contract_ids': ['@mozilla.org/parent/filepicker;1'],
'jsm': 'resource://gre/modules/FilePickerDelegate.jsm',
'esModule': 'resource://gre/modules/FilePickerDelegate.sys.mjs',
'constructor': 'FilePickerDelegate',
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
},
{
'cid': '{1201d357-8417-4926-a694-e6408fbedcf8}',
'contract_ids': ['@mozilla.org/sharepicker;1'],
'jsm': 'resource://gre/modules/ShareDelegate.jsm',
'esModule': 'resource://gre/modules/ShareDelegate.sys.mjs',
'constructor': 'ShareDelegate',
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
},
{
'cid': '{3d765750-1c3d-11ea-aaef-0800200c9a66}',
'contract_ids': ['@mozilla.org/login-manager/prompter;1'],
'jsm': 'resource://gre/modules/LoginStorageDelegate.jsm',
'esModule': 'resource://gre/modules/LoginStorageDelegate.sys.mjs',
'constructor': 'LoginStorageDelegate',
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
},

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

@ -34,16 +34,16 @@ EXTRA_COMPONENTS += [
]
EXTRA_JS_MODULES += [
"ColorPickerDelegate.jsm",
"FilePickerDelegate.jsm",
"GeckoViewPermission.jsm",
"GeckoViewPrompt.jsm",
"ColorPickerDelegate.sys.mjs",
"FilePickerDelegate.sys.mjs",
"GeckoViewPermission.sys.mjs",
"GeckoViewPrompt.sys.mjs",
"GeckoViewPrompter.sys.mjs",
"GeckoViewPush.jsm",
"GeckoViewStartup.jsm",
"LoginStorageDelegate.jsm",
"PromptCollection.jsm",
"ShareDelegate.jsm",
"GeckoViewPush.sys.mjs",
"GeckoViewStartup.sys.mjs",
"LoginStorageDelegate.sys.mjs",
"PromptCollection.sys.mjs",
"ShareDelegate.sys.mjs",
]
FINAL_LIBRARY = "xul"