Bug 1798635 - Converted WebChannel JSM modules to ESM. r=kpatenio,Standard8

Differential Revision: https://phabricator.services.mozilla.com/D167216
This commit is contained in:
Bilal 2023-01-19 18:07:33 +00:00
Родитель 1ed66b32d6
Коммит ea77d6c67f
5 изменённых файлов: 10 добавлений и 21 удалений

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

@ -3,16 +3,9 @@
* 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/. */
/* eslint no-unused-vars: ["error", {args: "none"}] */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
var EXPORTED_SYMBOLS = ["WebChannelChild"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { ContentDOMReference } = ChromeUtils.importESModule(
"resource://gre/modules/ContentDOMReference.sys.mjs"
);
import { ContentDOMReference } from "resource://gre/modules/ContentDOMReference.sys.mjs";
// Preference containing the list (space separated) of origins that are
// allowed to send non-string values through a WebChannel, mainly for
@ -31,7 +24,7 @@ XPCOMUtils.defineLazyPreferenceGetter(
() => (_cachedWhitelist = null)
);
class WebChannelChild extends JSWindowActorChild {
export class WebChannelChild extends JSWindowActorChild {
handleEvent(event) {
if (event.type === "WebChannelMessageToChrome") {
return this._onMessageToChrome(event);

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

@ -3,16 +3,12 @@
* 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/. */
var EXPORTED_SYMBOLS = ["WebChannelParent"];
const { WebChannelBroker } = ChromeUtils.importESModule(
"resource://gre/modules/WebChannel.sys.mjs"
);
import { WebChannelBroker } from "resource://gre/modules/WebChannel.sys.mjs";
const ERRNO_MISSING_PRINCIPAL = 1;
const ERRNO_NO_SUCH_CHANNEL = 2;
class WebChannelParent extends JSWindowActorParent {
export class WebChannelParent extends JSWindowActorParent {
receiveMessage(msg) {
let data = msg.data.contentData;
let sendingContext = {

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

@ -80,6 +80,6 @@ FINAL_TARGET_FILES.actors += [
"ViewSourceChild.sys.mjs",
"ViewSourcePageChild.sys.mjs",
"ViewSourcePageParent.sys.mjs",
"WebChannelChild.jsm",
"WebChannelParent.jsm",
"WebChannelChild.sys.mjs",
"WebChannelParent.sys.mjs",
]

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

@ -458,10 +458,10 @@ let JSWINDOWACTORS = {
WebChannel: {
parent: {
moduleURI: "resource://gre/actors/WebChannelParent.jsm",
esModuleURI: "resource://gre/actors/WebChannelParent.sys.mjs",
},
child: {
moduleURI: "resource://gre/actors/WebChannelChild.jsm",
esModuleURI: "resource://gre/actors/WebChannelChild.sys.mjs",
events: {
WebChannelMessageToChrome: { capture: true, wantUntrusted: true },
},

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

@ -332,7 +332,7 @@ avoid-blacklist-and-whitelist:
- testing/web-platform/tests/docs/writing-tests/lint-tool.md
- testing/web-platform/tests/tools/manifest/tests/test_manifest.py
- toolkit/actors/RemotePageChild.jsm
- toolkit/actors/WebChannelChild.jsm
- toolkit/actors/WebChannelChild.sys.mjs
- toolkit/components/aboutperformance/content/aboutPerformance.js
- toolkit/components/antitracking/StorageAccessAPIHelper.cpp
- toolkit/components/antitracking/PurgeTrackerService.jsm