mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-29 02:17:45 -10:00
Lazily load AndroidLog.jsm since we only need it for debug logging, and logging is normally turned off in GeckoView code. MozReview-Commit-ID: 5HNzYTwujMS
54 lines
1.4 KiB
JavaScript
54 lines
1.4 KiB
JavaScript
/* 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";
|
|
|
|
this.EXPORTED_SYMBOLS = ["GeckoViewContentModule"];
|
|
|
|
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
|
|
|
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
|
|
XPCOMUtils.defineLazyModuleGetter(this, "EventDispatcher",
|
|
"resource://gre/modules/Messaging.jsm");
|
|
|
|
XPCOMUtils.defineLazyGetter(this, "dump", () =>
|
|
Cu.import("resource://gre/modules/AndroidLog.jsm",
|
|
{}).AndroidLog.d.bind(null, "ViewContentModule"));
|
|
|
|
function debug(aMsg) {
|
|
// dump(aMsg);
|
|
}
|
|
|
|
class GeckoViewContentModule {
|
|
constructor(aModuleName, aMessageManager) {
|
|
this.moduleName = aModuleName;
|
|
this.messageManager = aMessageManager;
|
|
this.eventDispatcher = EventDispatcher.forMessageManager(aMessageManager);
|
|
|
|
this.messageManager.addMessageListener(
|
|
"GeckoView:Register",
|
|
aMsg => {
|
|
if (aMsg.data.module == this.moduleName) {
|
|
this.register();
|
|
}
|
|
}
|
|
);
|
|
this.messageManager.addMessageListener(
|
|
"GeckoView:Unregister",
|
|
aMsg => {
|
|
if (aMsg.data.module == this.moduleName) {
|
|
this.unregister();
|
|
}
|
|
}
|
|
);
|
|
|
|
this.init();
|
|
}
|
|
|
|
init() {}
|
|
register() {}
|
|
unregister() {}
|
|
}
|