Bug 1790224 - Convert browser/actors/ClickHandler* JSM modules to ESMs. r=mconley

Differential Revision: https://phabricator.services.mozilla.com/D158853
This commit is contained in:
Chengyu Sun 2022-10-11 14:12:33 +00:00
parent 743488f1ab
commit d4e767473d
6 changed files with 13 additions and 25 deletions

View File

@ -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/. */
var EXPORTED_SYMBOLS = ["ClickHandlerChild", "MiddleMousePasteHandlerChild"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -31,7 +27,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs",
});
class MiddleMousePasteHandlerChild extends JSWindowActorChild {
export class MiddleMousePasteHandlerChild extends JSWindowActorChild {
handleEvent(clickEvent) {
if (
clickEvent.defaultPrevented ||
@ -60,7 +56,7 @@ XPCOMUtils.defineLazyPreferenceGetter(
true
);
class ClickHandlerChild extends JSWindowActorChild {
export class ClickHandlerChild extends JSWindowActorChild {
handleEvent(wrapperEvent) {
this.handleClickEvent(wrapperEvent.sourceEvent);
}

View File

@ -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 = ["ClickHandlerParent", "MiddleMousePasteHandlerParent"];
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -25,7 +21,7 @@ ChromeUtils.defineModuleGetter(
let gContentClickListeners = new Set();
class MiddleMousePasteHandlerParent extends JSWindowActorParent {
export class MiddleMousePasteHandlerParent extends JSWindowActorParent {
receiveMessage(message) {
if (message.name == "MiddleClickPaste") {
// This is heavily based on contentAreaClick from browser.js (Bug 903016)
@ -41,7 +37,7 @@ class MiddleMousePasteHandlerParent extends JSWindowActorParent {
}
}
class ClickHandlerParent extends JSWindowActorParent {
export class ClickHandlerParent extends JSWindowActorParent {
static addContentClickListener(listener) {
gContentClickListeners.add(listener);
}

View File

@ -51,8 +51,8 @@ FINAL_TARGET_FILES.actors += [
"BrowserProcessChild.sys.mjs",
"BrowserTabChild.sys.mjs",
"BrowserTabParent.sys.mjs",
"ClickHandlerChild.jsm",
"ClickHandlerParent.jsm",
"ClickHandlerChild.sys.mjs",
"ClickHandlerParent.sys.mjs",
"ContentSearchChild.sys.mjs",
"ContentSearchParent.sys.mjs",
"ContextMenuChild.jsm",

View File

@ -417,10 +417,10 @@ let JSWINDOWACTORS = {
ClickHandler: {
parent: {
moduleURI: "resource:///actors/ClickHandlerParent.jsm",
esModuleURI: "resource:///actors/ClickHandlerParent.sys.mjs",
},
child: {
moduleURI: "resource:///actors/ClickHandlerChild.jsm",
esModuleURI: "resource:///actors/ClickHandlerChild.sys.mjs",
events: {
chromelinkclick: { capture: true, mozSystemGroup: true },
},
@ -437,10 +437,10 @@ let JSWINDOWACTORS = {
*/
MiddleMousePasteHandler: {
parent: {
moduleURI: "resource:///actors/ClickHandlerParent.jsm",
esModuleURI: "resource:///actors/ClickHandlerParent.sys.mjs",
},
child: {
moduleURI: "resource:///actors/ClickHandlerChild.jsm",
esModuleURI: "resource:///actors/ClickHandlerChild.sys.mjs",
events: {
auxclick: { capture: true, mozSystemGroup: true },
},

View File

@ -720,7 +720,7 @@ nsresult EditorEventListener::MouseClick(WidgetMouseEvent* aMouseClickEvent) {
"EventStateManager::HandleMiddleClickPaste() failed, but ignored");
if (status == nsEventStatus_eConsumeNoDefault) {
// We no longer need to StopImmediatePropagation here since
// ClickHandlerChild.jsm checks for and ignores editables, so won't
// ClickHandlerChild.sys.mjs checks for and ignores editables, so won't
// re-handle the event
aMouseClickEvent->PreventDefault();
}

View File

@ -19,17 +19,13 @@ ChromeUtils.defineModuleGetter(
);
ChromeUtils.defineESModuleGetters(lazy, {
UrlbarUtils: "resource:///modules/UrlbarUtils.sys.mjs",
ClickHandlerParent: "resource:///actors/ClickHandlerParent.sys.mjs",
});
ChromeUtils.defineModuleGetter(
lazy,
"WebNavigationFrames",
"resource://gre/modules/WebNavigationFrames.jsm"
);
ChromeUtils.defineModuleGetter(
lazy,
"ClickHandlerParent",
"resource:///actors/ClickHandlerParent.jsm"
);
// Maximum amount of time that can be passed and still consider
// the data recent (similar to how is done in nsNavHistory,