From 7e3d374e077e6b817834423e5a9ff22cb3c57177 Mon Sep 17 00:00:00 2001 From: Alessandro Castellani Date: Wed, 6 Dec 2023 23:43:09 +0000 Subject: [PATCH] Bug 1866725 - Convert remaining Actors to ES modules. r=freaktechnik Differential Revision: https://phabricator.services.mozilla.com/D195322 Depends on D195615 --HG-- rename : mail/actors/LinkClickHandlerChild.jsm => mail/actors/LinkClickHandlerChild.sys.mjs rename : mail/actors/LinkClickHandlerParent.jsm => mail/actors/LinkClickHandlerParent.sys.mjs rename : mail/actors/MailLinkChild.jsm => mail/actors/MailLinkChild.sys.mjs rename : mail/actors/MailLinkParent.jsm => mail/actors/MailLinkParent.sys.mjs rename : mail/actors/PromptParent.jsm => mail/actors/PromptParent.sys.mjs rename : mail/actors/VCardChild.jsm => mail/actors/VCardChild.sys.mjs rename : mail/actors/VCardParent.jsm => mail/actors/VCardParent.sys.mjs extra : rebase_source : 20ec6c453fb4207fe0ebf841a1eb1c60f0136cfb --- ...hild.jsm => LinkClickHandlerChild.sys.mjs} | 15 +++--------- mail/actors/LinkClickHandlerParent.jsm | 23 ------------------- mail/actors/LinkClickHandlerParent.sys.mjs | 14 +++++++++++ ...ailLinkChild.jsm => MailLinkChild.sys.mjs} | 6 +---- ...lLinkParent.jsm => MailLinkParent.sys.mjs} | 10 ++------ ...{PromptParent.jsm => PromptParent.sys.mjs} | 6 +---- .../{VCardChild.jsm => VCardChild.sys.mjs} | 6 +---- .../{VCardParent.jsm => VCardParent.sys.mjs} | 6 +---- mail/actors/moz.build | 14 +++++------ mail/components/MailGlue.jsm | 18 +++++++-------- 10 files changed, 39 insertions(+), 79 deletions(-) rename mail/actors/{LinkClickHandlerChild.jsm => LinkClickHandlerChild.sys.mjs} (93%) delete mode 100644 mail/actors/LinkClickHandlerParent.jsm create mode 100644 mail/actors/LinkClickHandlerParent.sys.mjs rename mail/actors/{MailLinkChild.jsm => MailLinkChild.sys.mjs} (91%) rename mail/actors/{MailLinkParent.jsm => MailLinkParent.sys.mjs} (91%) rename mail/actors/{PromptParent.jsm => PromptParent.sys.mjs} (98%) rename mail/actors/{VCardChild.jsm => VCardChild.sys.mjs} (86%) rename mail/actors/{VCardParent.jsm => VCardParent.sys.mjs} (79%) diff --git a/mail/actors/LinkClickHandlerChild.jsm b/mail/actors/LinkClickHandlerChild.sys.mjs similarity index 93% rename from mail/actors/LinkClickHandlerChild.jsm rename to mail/actors/LinkClickHandlerChild.sys.mjs index 18e367248f..b1c61b8810 100644 --- a/mail/actors/LinkClickHandlerChild.jsm +++ b/mail/actors/LinkClickHandlerChild.sys.mjs @@ -3,16 +3,7 @@ * 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"; - -const EXPORTED_SYMBOLS = [ - "LinkClickHandlerChild", - "StrictLinkClickHandlerChild", -]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; @@ -74,7 +65,7 @@ function hRefForClickEvent(aEvent) { * * This actor applies to browsers in the "single-site" message manager group. */ -class LinkClickHandlerChild extends JSWindowActorChild { +export class LinkClickHandlerChild extends JSWindowActorChild { handleEvent(event) { // Don't handle events that: // a) are in the parent process (handled by onclick), @@ -139,7 +130,7 @@ class LinkClickHandlerChild extends JSWindowActorChild { * * This actor applies to browsers in the "single-page" message manager group. */ -class StrictLinkClickHandlerChild extends JSWindowActorChild { +export class StrictLinkClickHandlerChild extends JSWindowActorChild { handleEvent(event) { // Don't handle events that: // a) are in the parent process (handled by onclick), diff --git a/mail/actors/LinkClickHandlerParent.jsm b/mail/actors/LinkClickHandlerParent.jsm deleted file mode 100644 index 4df7bd850b..0000000000 --- a/mail/actors/LinkClickHandlerParent.jsm +++ /dev/null @@ -1,23 +0,0 @@ -/* vim: set ts=2 sw=2 et tw=80: */ -/* 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"; - -const EXPORTED_SYMBOLS = [ - "LinkClickHandlerParent", - "StrictLinkClickHandlerParent", -]; - -const { openLinkExternally } = ChromeUtils.importESModule( - "resource:///modules/LinkHelper.sys.mjs" -); - -class LinkClickHandlerParent extends JSWindowActorParent { - receiveMessage({ data }) { - openLinkExternally(data); - } -} - -class StrictLinkClickHandlerParent extends LinkClickHandlerParent {} diff --git a/mail/actors/LinkClickHandlerParent.sys.mjs b/mail/actors/LinkClickHandlerParent.sys.mjs new file mode 100644 index 0000000000..a087a63138 --- /dev/null +++ b/mail/actors/LinkClickHandlerParent.sys.mjs @@ -0,0 +1,14 @@ +/* vim: set ts=2 sw=2 et tw=80: */ +/* 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/. */ + +import { openLinkExternally } from "resource:///modules/LinkHelper.sys.mjs"; + +export class LinkClickHandlerParent extends JSWindowActorParent { + receiveMessage({ data }) { + openLinkExternally(data); + } +} + +export class StrictLinkClickHandlerParent extends LinkClickHandlerParent {} diff --git a/mail/actors/MailLinkChild.jsm b/mail/actors/MailLinkChild.sys.mjs similarity index 91% rename from mail/actors/MailLinkChild.jsm rename to mail/actors/MailLinkChild.sys.mjs index 6f3bf93b3f..cb5ce8302b 100644 --- a/mail/actors/MailLinkChild.jsm +++ b/mail/actors/MailLinkChild.sys.mjs @@ -3,13 +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/. */ -"use strict"; - -const EXPORTED_SYMBOLS = ["MailLinkChild"]; - const PROTOCOLS = ["mailto:", "mid:", "news:", "snews:"]; -class MailLinkChild extends JSWindowActorChild { +export class MailLinkChild extends JSWindowActorChild { handleEvent(event) { const href = event.target.href; const location = this.document.location; diff --git a/mail/actors/MailLinkParent.jsm b/mail/actors/MailLinkParent.sys.mjs similarity index 91% rename from mail/actors/MailLinkParent.jsm rename to mail/actors/MailLinkParent.sys.mjs index a6dcee64d5..2b525fdcb9 100644 --- a/mail/actors/MailLinkParent.jsm +++ b/mail/actors/MailLinkParent.sys.mjs @@ -3,13 +3,7 @@ * 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"; - -const EXPORTED_SYMBOLS = ["MailLinkParent"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; @@ -22,7 +16,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { MailUtils: "resource:///modules/MailUtils.jsm", }); -class MailLinkParent extends JSWindowActorParent { +export class MailLinkParent extends JSWindowActorParent { receiveMessage(value) { switch (value.name) { case "imap:": diff --git a/mail/actors/PromptParent.jsm b/mail/actors/PromptParent.sys.mjs similarity index 98% rename from mail/actors/PromptParent.jsm rename to mail/actors/PromptParent.sys.mjs index 57625850de..804fb1843f 100644 --- a/mail/actors/PromptParent.jsm +++ b/mail/actors/PromptParent.sys.mjs @@ -3,10 +3,6 @@ * 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 = ["PromptParent"]; - const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { @@ -30,7 +26,7 @@ ChromeUtils.defineESModuleGetters(lazy, { */ const gBrowserPrompts = new WeakMap(); -class PromptParent extends JSWindowActorParent { +export class PromptParent extends JSWindowActorParent { didDestroy() { // In the event that the subframe or tab crashed, make sure that // we close any active Prompts. diff --git a/mail/actors/VCardChild.jsm b/mail/actors/VCardChild.sys.mjs similarity index 86% rename from mail/actors/VCardChild.jsm rename to mail/actors/VCardChild.sys.mjs index db43b6c145..426b726975 100644 --- a/mail/actors/VCardChild.jsm +++ b/mail/actors/VCardChild.sys.mjs @@ -3,11 +3,7 @@ * 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"; - -const EXPORTED_SYMBOLS = ["VCardChild"]; - -class VCardChild extends JSWindowActorChild { +export class VCardChild extends JSWindowActorChild { handleEvent(event) { // This link comes from VCardMimeConverter.convertToHTML in VCardUtils.jsm. if (event.target.classList.contains("moz-vcard-badge")) { diff --git a/mail/actors/VCardParent.jsm b/mail/actors/VCardParent.sys.mjs similarity index 79% rename from mail/actors/VCardParent.jsm rename to mail/actors/VCardParent.sys.mjs index fd11ac6b72..2358e49c44 100644 --- a/mail/actors/VCardParent.jsm +++ b/mail/actors/VCardParent.sys.mjs @@ -3,11 +3,7 @@ * 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"; - -const EXPORTED_SYMBOLS = ["VCardParent"]; - -class VCardParent extends JSWindowActorParent { +export class VCardParent extends JSWindowActorParent { receiveMessage({ data, target }) { target.browsingContext.topChromeWindow.toAddressBook([ "cmd_newCard", diff --git a/mail/actors/moz.build b/mail/actors/moz.build index fb2638c923..d22b895077 100644 --- a/mail/actors/moz.build +++ b/mail/actors/moz.build @@ -13,12 +13,12 @@ FINAL_TARGET_FILES.actors += [ "ChatActionChild.sys.mjs", "ChatActionParent.sys.mjs", "ContextMenuParent.sys.mjs", - "LinkClickHandlerChild.jsm", - "LinkClickHandlerParent.jsm", + "LinkClickHandlerChild.sys.mjs", + "LinkClickHandlerParent.sys.mjs", "LinkHandlerParent.sys.mjs", - "MailLinkChild.jsm", - "MailLinkParent.jsm", - "PromptParent.jsm", - "VCardChild.jsm", - "VCardParent.jsm", + "MailLinkChild.sys.mjs", + "MailLinkParent.sys.mjs", + "PromptParent.sys.mjs", + "VCardChild.sys.mjs", + "VCardParent.sys.mjs", ] diff --git a/mail/components/MailGlue.jsm b/mail/components/MailGlue.jsm index 6a962f6e8f..fa8fcf284b 100644 --- a/mail/components/MailGlue.jsm +++ b/mail/components/MailGlue.jsm @@ -147,10 +147,10 @@ const JSWINDOWACTORS = { LinkClickHandler: { parent: { - moduleURI: "resource:///actors/LinkClickHandlerParent.jsm", + esModuleURI: "resource:///actors/LinkClickHandlerParent.sys.mjs", }, child: { - moduleURI: "resource:///actors/LinkClickHandlerChild.jsm", + esModuleURI: "resource:///actors/LinkClickHandlerChild.sys.mjs", events: { click: {}, }, @@ -207,10 +207,10 @@ const JSWINDOWACTORS = { MailLink: { parent: { - moduleURI: "resource:///actors/MailLinkParent.jsm", + esModuleURI: "resource:///actors/MailLinkParent.sys.mjs", }, child: { - moduleURI: "resource:///actors/MailLinkChild.jsm", + esModuleURI: "resource:///actors/MailLinkChild.sys.mjs", events: { click: {}, }, @@ -231,7 +231,7 @@ const JSWINDOWACTORS = { Prompt: { parent: { - moduleURI: "resource:///actors/PromptParent.jsm", + esModuleURI: "resource:///actors/PromptParent.sys.mjs", }, includeChrome: true, allFrames: true, @@ -239,10 +239,10 @@ const JSWINDOWACTORS = { StrictLinkClickHandler: { parent: { - moduleURI: "resource:///actors/LinkClickHandlerParent.jsm", + esModuleURI: "resource:///actors/LinkClickHandlerParent.sys.mjs", }, child: { - moduleURI: "resource:///actors/LinkClickHandlerChild.jsm", + esModuleURI: "resource:///actors/LinkClickHandlerChild.sys.mjs", events: { click: {}, }, @@ -253,10 +253,10 @@ const JSWINDOWACTORS = { VCard: { parent: { - moduleURI: "resource:///actors/VCardParent.jsm", + esModuleURI: "resource:///actors/VCardParent.sys.mjs", }, child: { - moduleURI: "resource:///actors/VCardChild.jsm", + esModuleURI: "resource:///actors/VCardChild.sys.mjs", events: { click: {}, },