Bug 1358921: Lazily load RemotePrompt.jsm when first needed. r=florian

MozReview-Commit-ID: 95u2FozBiqk

--HG--
extra : rebase_source : 940bcb1eb94b3ccc3481e3a8bcbaf8d0b8bad0a2
This commit is contained in:
Kris Maglione 2017-04-23 13:00:46 -07:00
Родитель 2e8e2cf455
Коммит 9c4e5dce20
2 изменённых файлов: 12 добавлений и 10 удалений

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

@ -138,6 +138,7 @@ const listeners = {
"ContentSearch": ["ContentSearch"],
"FormValidation:ShowPopup": ["FormValidationHandler"],
"FormValidation:HidePopup": ["FormValidationHandler"],
"Prompt:Open": ["RemotePrompt"],
"rtcpeer:CancelRequest": ["webrtcUI"],
"rtcpeer:Request": ["webrtcUI"],
"webrtc:CancelRequest": ["webrtcUI"],
@ -587,7 +588,6 @@ BrowserGlue.prototype = {
BrowserUsageTelemetry.init();
BrowserUITelemetry.init();
RemotePrompt.init();
Feeds.init();
ContentPrefServiceParent.init();

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

@ -11,17 +11,19 @@ var Cu = Components.utils;
this.EXPORTED_SYMBOLS = [ "RemotePrompt" ];
Cu.import("resource:///modules/PlacesUIUtils.jsm");
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/SharedPromptUtils.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUIUtils",
"resource:///modules/PlacesUIUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PromptUtils",
"resource://gre/modules/SharedPromptUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
var RemotePrompt = {
init() {
let mm = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager);
mm.addMessageListener("Prompt:Open", this);
},
// Listeners are added in nsBrowserGlue.js
receiveMessage(message) {
switch (message.name) {
case "Prompt:Open":