Files
firefox/mobile/android/modules/geckoview/GeckoViewContentModule.jsm
T
Jim Chen c65b793a26 Bug 1394580 - 3. Lazy-load AndroidLog.jsm; r=droeh
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
2017-09-05 21:26:31 -04:00

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() {}
}