2012-07-03 00:16:55 +00:00
|
|
|
/* 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 Cc = Components.classes;
|
|
|
|
const Ci = Components.interfaces;
|
|
|
|
const Cu = Components.utils;
|
2013-01-18 13:50:01 +00:00
|
|
|
const Cr = Components.results;
|
2012-07-03 00:16:55 +00:00
|
|
|
|
|
|
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
|
|
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
|
|
|
Cu.import("resource://gre/modules/Services.jsm");
|
|
|
|
|
2012-10-09 03:15:47 +00:00
|
|
|
const kSystemMessageInternalReady = "system-message-internal-ready";
|
|
|
|
|
2012-08-27 14:13:02 +00:00
|
|
|
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
|
|
|
"@mozilla.org/childprocessmessagemanager;1",
|
|
|
|
"nsISyncMessageSender");
|
2012-07-03 00:16:55 +00:00
|
|
|
|
2012-08-23 18:56:36 +00:00
|
|
|
function debug(aMsg) {
|
2013-01-18 13:50:01 +00:00
|
|
|
// dump("-- SystemMessageManager " + Date.now() + " : " + aMsg + "\n");
|
2012-07-03 00:16:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Implementation of the DOM API for system messages
|
|
|
|
|
|
|
|
function SystemMessageManager() {
|
2013-06-21 08:17:22 +00:00
|
|
|
// If we have a system message handler registered for messages of type
|
|
|
|
// |type|, this._dispatchers[type] equals {handler, messages, isHandling},
|
|
|
|
// where
|
|
|
|
// - |handler| is the message handler that the page registered,
|
|
|
|
// - |messages| is a list of messages which we've received while
|
|
|
|
// dispatching messages to the handler, but haven't yet sent, and
|
|
|
|
// - |isHandling| indicates whether we're currently dispatching messages
|
|
|
|
// to this handler.
|
|
|
|
this._dispatchers = {};
|
2012-07-03 00:16:55 +00:00
|
|
|
|
|
|
|
// Pending messages for this page, keyed by message type.
|
|
|
|
this._pendings = {};
|
2012-10-09 03:15:47 +00:00
|
|
|
|
2014-03-31 08:04:29 +00:00
|
|
|
// Flag to specify if this process has already registered the manifest URL.
|
|
|
|
this._registerManifestURLReady = false;
|
2012-10-09 03:15:47 +00:00
|
|
|
|
2015-01-13 09:53:22 +00:00
|
|
|
// Used to know if the promise has to be accepted or not.
|
|
|
|
this._isHandling = false;
|
|
|
|
this._promise = null;
|
|
|
|
|
2012-10-09 03:15:47 +00:00
|
|
|
// Flag to determine this process is a parent or child process.
|
|
|
|
let appInfo = Cc["@mozilla.org/xre/app-info;1"];
|
|
|
|
this._isParentProcess =
|
|
|
|
!appInfo || appInfo.getService(Ci.nsIXULRuntime)
|
|
|
|
.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
|
|
|
|
|
|
|
// An oberver to listen to whether the |SystemMessageInternal| is ready.
|
|
|
|
if (this._isParentProcess) {
|
|
|
|
Services.obs.addObserver(this, kSystemMessageInternalReady, false);
|
|
|
|
}
|
2012-07-03 00:16:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SystemMessageManager.prototype = {
|
|
|
|
__proto__: DOMRequestIpcHelper.prototype,
|
|
|
|
|
2015-01-13 09:53:18 +00:00
|
|
|
_dispatchMessage: function(aType, aDispatcher, aMessage, aMessageID) {
|
2013-06-21 08:17:22 +00:00
|
|
|
if (aDispatcher.isHandling) {
|
|
|
|
// Queue up the incomming message if we're currently dispatching a
|
|
|
|
// message; we'll send the message once we finish with the current one.
|
|
|
|
//
|
|
|
|
// _dispatchMethod is reentrant because a page can spin up a nested
|
|
|
|
// event loop from within a system message handler (e.g. via alert()),
|
|
|
|
// and we can then try to send the page another message while it's
|
|
|
|
// inside this nested event loop.
|
2015-01-13 09:53:18 +00:00
|
|
|
aDispatcher.messages.push({ message: aMessage, messageID: aMessageID });
|
2013-06-21 08:17:22 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
aDispatcher.isHandling = true;
|
2015-01-13 09:53:22 +00:00
|
|
|
this._isHandling = true;
|
2013-06-21 08:17:22 +00:00
|
|
|
|
2012-07-20 15:41:30 +00:00
|
|
|
// We get a json blob, but in some cases we want another kind of object
|
2014-03-31 08:14:52 +00:00
|
|
|
// to be dispatched. To do so, we check if we have a valid contract ID of
|
2012-07-20 15:41:30 +00:00
|
|
|
// "@mozilla.org/dom/system-messages/wrapper/TYPE;1" component implementing
|
|
|
|
// nsISystemMessageWrapper.
|
|
|
|
debug("Dispatching " + JSON.stringify(aMessage) + "\n");
|
|
|
|
let contractID = "@mozilla.org/dom/system-messages/wrapper/" + aType + ";1";
|
2012-08-23 18:56:36 +00:00
|
|
|
let wrapped = false;
|
2012-07-20 15:41:30 +00:00
|
|
|
|
|
|
|
if (contractID in Cc) {
|
|
|
|
debug(contractID + " is registered, creating an instance");
|
|
|
|
let wrapper = Cc[contractID].createInstance(Ci.nsISystemMessagesWrapper);
|
|
|
|
if (wrapper) {
|
2012-08-25 04:07:58 +00:00
|
|
|
aMessage = wrapper.wrapMessage(aMessage, this._window);
|
2012-08-23 18:56:36 +00:00
|
|
|
wrapped = true;
|
2012-07-20 15:41:30 +00:00
|
|
|
debug("wrapped = " + aMessage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-13 09:53:26 +00:00
|
|
|
let message = wrapped ? aMessage : Cu.cloneInto(aMessage, this._window);
|
|
|
|
|
|
|
|
let rejectPromise = false;
|
|
|
|
try {
|
|
|
|
aDispatcher.handler.handleMessage(message);
|
|
|
|
} catch(e) {
|
|
|
|
rejectPromise = true;
|
|
|
|
}
|
2013-06-21 08:17:22 +00:00
|
|
|
|
2015-01-13 09:53:22 +00:00
|
|
|
this._isHandling = false;
|
2013-06-21 08:17:22 +00:00
|
|
|
aDispatcher.isHandling = false;
|
2014-03-31 08:14:52 +00:00
|
|
|
|
2015-01-13 09:53:22 +00:00
|
|
|
let self = this;
|
|
|
|
function sendResponse() {
|
|
|
|
// We need to notify the parent one of the system messages has been
|
|
|
|
// handled, so the parent can release the CPU wake lock it took on our
|
|
|
|
// behalf.
|
|
|
|
cpmm.sendAsyncMessage("SystemMessageManager:HandleMessageDone",
|
|
|
|
{ type: aType,
|
|
|
|
manifestURL: self._manifestURL,
|
|
|
|
pageURL: self._pageURL,
|
2015-01-13 09:53:26 +00:00
|
|
|
msgID: aMessageID,
|
|
|
|
rejected: rejectPromise });
|
2015-01-13 09:53:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!this._promise) {
|
|
|
|
debug("No promise set, sending the response immediately.");
|
|
|
|
sendResponse();
|
|
|
|
} else {
|
|
|
|
debug("Using the promise to postpone the response.");
|
2015-01-13 09:53:26 +00:00
|
|
|
this._promise.then(sendResponse, function() {
|
|
|
|
rejectPromise = true;
|
|
|
|
sendResponse();
|
|
|
|
});
|
2015-01-13 09:53:22 +00:00
|
|
|
this._promise = null;
|
|
|
|
}
|
|
|
|
|
2013-06-21 08:17:22 +00:00
|
|
|
if (aDispatcher.messages.length > 0) {
|
2015-01-13 09:53:18 +00:00
|
|
|
let msg = aDispatcher.messages.shift();
|
|
|
|
this._dispatchMessage(aType, aDispatcher, msg.message, msg.messageID);
|
2014-03-31 08:14:52 +00:00
|
|
|
} else {
|
|
|
|
// No more messages that need to be handled, we can notify the
|
2014-08-01 18:02:55 +00:00
|
|
|
// ContentChild to release the CPU wake lock grabbed by the ContentParent
|
|
|
|
// (i.e. NewWakeLockOnBehalfOfProcess()) and reset the process's priority.
|
|
|
|
//
|
|
|
|
// TODO: Bug 874353 - Remove SystemMessageHandledListener in ContentParent
|
2014-03-31 08:14:52 +00:00
|
|
|
Services.obs.notifyObservers(/* aSubject */ null,
|
|
|
|
"handle-system-messages-done",
|
|
|
|
/* aData */ null);
|
2013-06-21 08:17:22 +00:00
|
|
|
}
|
2012-07-20 15:41:30 +00:00
|
|
|
},
|
|
|
|
|
2014-03-31 08:04:11 +00:00
|
|
|
mozSetMessageHandler: function(aType, aHandler) {
|
2013-01-18 13:50:01 +00:00
|
|
|
debug("set message handler for [" + aType + "] " + aHandler);
|
|
|
|
|
|
|
|
if (this._isInBrowserElement) {
|
|
|
|
debug("the app loaded in the browser cannot set message handler");
|
2013-03-08 20:13:12 +00:00
|
|
|
// Don't throw there, but ignore the registration.
|
|
|
|
return;
|
2013-01-18 13:50:01 +00:00
|
|
|
}
|
|
|
|
|
2012-07-03 00:16:55 +00:00
|
|
|
if (!aType) {
|
|
|
|
// Just bail out if we have no type.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-06-21 08:17:22 +00:00
|
|
|
let dispatchers = this._dispatchers;
|
2012-07-03 00:16:55 +00:00
|
|
|
if (!aHandler) {
|
2013-06-21 08:17:22 +00:00
|
|
|
// Setting the dispatcher to null means we don't want to handle messages
|
|
|
|
// for this type anymore.
|
|
|
|
delete dispatchers[aType];
|
2012-07-03 00:16:55 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Last registered handler wins.
|
2013-06-21 08:17:22 +00:00
|
|
|
dispatchers[aType] = { handler: aHandler, messages: [], isHandling: false };
|
2012-07-03 00:16:55 +00:00
|
|
|
|
2012-10-25 18:45:14 +00:00
|
|
|
// Ask for the list of currently pending messages.
|
|
|
|
cpmm.sendAsyncMessage("SystemMessageManager:GetPendingMessages",
|
|
|
|
{ type: aType,
|
2014-03-31 08:04:36 +00:00
|
|
|
pageURL: this._pageURL,
|
2014-03-31 08:04:29 +00:00
|
|
|
manifestURL: this._manifestURL });
|
2012-07-03 00:16:55 +00:00
|
|
|
},
|
|
|
|
|
2014-03-31 08:04:11 +00:00
|
|
|
mozHasPendingMessage: function(aType) {
|
2013-01-18 13:50:01 +00:00
|
|
|
debug("asking pending message for [" + aType + "]");
|
|
|
|
|
|
|
|
if (this._isInBrowserElement) {
|
|
|
|
debug("the app loaded in the browser cannot ask pending message");
|
2013-03-08 20:13:12 +00:00
|
|
|
// Don't throw there, but pretend to have no messages available.
|
|
|
|
return false;
|
2013-01-18 13:50:01 +00:00
|
|
|
}
|
|
|
|
|
2012-07-03 00:16:55 +00:00
|
|
|
// If we have a handler for this type, we can't have any pending message.
|
2013-06-21 08:17:22 +00:00
|
|
|
if (aType in this._dispatchers) {
|
2012-07-03 00:16:55 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-02-11 10:18:32 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* NB: If the system message is fired after we received the cache
|
|
|
|
* and before we registered the pageURL we will get false
|
|
|
|
* negative however this is unlikely and will do no harm.
|
|
|
|
*/
|
|
|
|
let cache = Cc["@mozilla.org/system-message-cache;1"]
|
|
|
|
.getService(Ci.nsISystemMessageCache);
|
|
|
|
|
|
|
|
return cache.hasPendingMessage(aType, this._pageURL, this._manifestURL);
|
2012-07-03 00:16:55 +00:00
|
|
|
},
|
|
|
|
|
2015-01-13 09:53:22 +00:00
|
|
|
mozIsHandlingMessage: function() {
|
|
|
|
debug("is handling message: " + this._isHandling);
|
|
|
|
return this._isHandling;
|
|
|
|
},
|
|
|
|
|
|
|
|
mozSetMessageHandlerPromise: function(aPromise) {
|
|
|
|
debug("setting a promise");
|
|
|
|
|
|
|
|
if (!this._isHandling) {
|
|
|
|
throw "Not in a handleMessage method";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this._promise) {
|
|
|
|
throw "Promise already set";
|
|
|
|
}
|
|
|
|
|
|
|
|
this._promise = aPromise;
|
|
|
|
},
|
|
|
|
|
2014-03-31 08:04:11 +00:00
|
|
|
uninit: function() {
|
2013-06-21 08:17:22 +00:00
|
|
|
this._dispatchers = null;
|
2012-10-09 03:15:47 +00:00
|
|
|
this._pendings = null;
|
2015-01-13 09:53:22 +00:00
|
|
|
this._promise = null;
|
2012-10-09 03:15:47 +00:00
|
|
|
|
|
|
|
if (this._isParentProcess) {
|
|
|
|
Services.obs.removeObserver(this, kSystemMessageInternalReady);
|
|
|
|
}
|
2012-11-07 02:32:09 +00:00
|
|
|
|
2013-01-18 13:50:01 +00:00
|
|
|
if (this._isInBrowserElement) {
|
|
|
|
debug("the app loaded in the browser doesn't need to unregister " +
|
2014-03-31 08:04:29 +00:00
|
|
|
"the manifest URL for listening to the system messages");
|
2013-01-18 13:50:01 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-11-07 02:32:09 +00:00
|
|
|
cpmm.sendAsyncMessage("SystemMessageManager:Unregister",
|
2014-03-31 08:04:29 +00:00
|
|
|
{ manifestURL: this._manifestURL,
|
2014-03-31 08:04:36 +00:00
|
|
|
pageURL: this._pageURL,
|
2013-05-23 09:53:40 +00:00
|
|
|
innerWindowID: this.innerWindowID });
|
2012-07-03 00:16:55 +00:00
|
|
|
},
|
|
|
|
|
2013-05-17 12:18:35 +00:00
|
|
|
// Possible messages:
|
|
|
|
//
|
|
|
|
// - SystemMessageManager:Message
|
|
|
|
// This one will only be received when the child process is alive when
|
|
|
|
// the message is initially sent.
|
|
|
|
//
|
|
|
|
// - SystemMessageManager:GetPendingMessages:Return
|
|
|
|
// This one will be received when the starting child process wants to
|
|
|
|
// retrieve the pending system messages from the parent (i.e. after
|
|
|
|
// sending SystemMessageManager:GetPendingMessages).
|
2014-03-31 08:04:11 +00:00
|
|
|
receiveMessage: function(aMessage) {
|
2012-10-25 18:45:14 +00:00
|
|
|
let msg = aMessage.data;
|
2013-06-01 08:25:59 +00:00
|
|
|
debug("receiveMessage " + aMessage.name + " for [" + msg.type + "] " +
|
2014-03-31 08:04:42 +00:00
|
|
|
"with manifest URL = " + msg.manifestURL +
|
|
|
|
" and page URL = " + msg.pageURL);
|
2013-06-01 08:25:59 +00:00
|
|
|
|
|
|
|
// Multiple windows can share the same target (process), the content
|
|
|
|
// window needs to check if the manifest/page URL is matched. Only
|
|
|
|
// *one* window should handle the system message.
|
2014-03-31 08:04:42 +00:00
|
|
|
if (msg.manifestURL !== this._manifestURL ||
|
|
|
|
msg.pageURL !== this._pageURL) {
|
2013-06-01 08:25:59 +00:00
|
|
|
debug("This page shouldn't handle the messages because its " +
|
2014-03-31 08:04:42 +00:00
|
|
|
"manifest URL = " + this._manifestURL +
|
|
|
|
" and page URL = " + this._pageURL);
|
2013-06-01 08:25:59 +00:00
|
|
|
return;
|
|
|
|
}
|
2012-07-03 00:16:55 +00:00
|
|
|
|
2012-10-25 18:45:14 +00:00
|
|
|
let messages = (aMessage.name == "SystemMessageManager:Message")
|
2015-02-08 09:38:59 +00:00
|
|
|
? [{ msg: msg.msg, msgID: msg.msgID }]
|
2012-10-25 18:45:14 +00:00
|
|
|
: msg.msgQueue;
|
|
|
|
|
2013-05-17 12:18:35 +00:00
|
|
|
// We only dispatch messages when a handler is registered.
|
2013-06-21 08:17:22 +00:00
|
|
|
let dispatcher = this._dispatchers[msg.type];
|
|
|
|
if (dispatcher) {
|
2014-04-03 06:51:30 +00:00
|
|
|
if (aMessage.name == "SystemMessageManager:Message") {
|
|
|
|
// Send an acknowledgement to parent to clean up the pending message
|
|
|
|
// before we dispatch the message to apps, so a re-launched app won't
|
|
|
|
// handle it again, which is redundant.
|
|
|
|
cpmm.sendAsyncMessage("SystemMessageManager:Message:Return:OK",
|
|
|
|
{ type: msg.type,
|
2014-04-09 07:42:47 +00:00
|
|
|
manifestURL: this._manifestURL,
|
|
|
|
pageURL: this._pageURL,
|
2014-04-03 06:51:30 +00:00
|
|
|
msgID: msg.msgID });
|
|
|
|
}
|
|
|
|
|
2013-05-17 12:18:35 +00:00
|
|
|
messages.forEach(function(aMsg) {
|
2015-02-08 09:38:59 +00:00
|
|
|
this._dispatchMessage(msg.type, dispatcher, aMsg.msg, aMsg.msgID);
|
2013-05-17 12:18:35 +00:00
|
|
|
}, this);
|
2015-01-13 09:53:18 +00:00
|
|
|
|
2013-06-21 08:17:22 +00:00
|
|
|
} else {
|
2014-03-31 08:14:52 +00:00
|
|
|
// Since no handlers are registered, we need to notify the parent as if
|
|
|
|
// all the queued system messages have been handled (notice |handledCount:
|
|
|
|
// messages.length|), so the parent can release the CPU wake lock it took
|
|
|
|
// on our behalf.
|
2013-06-21 08:17:22 +00:00
|
|
|
cpmm.sendAsyncMessage("SystemMessageManager:HandleMessagesDone",
|
|
|
|
{ type: msg.type,
|
2014-03-31 08:04:29 +00:00
|
|
|
manifestURL: this._manifestURL,
|
2014-03-31 08:04:36 +00:00
|
|
|
pageURL: this._pageURL,
|
2013-06-21 08:17:22 +00:00
|
|
|
handledCount: messages.length });
|
2013-05-17 12:18:35 +00:00
|
|
|
|
2014-08-01 18:02:55 +00:00
|
|
|
// We also need to notify the ContentChild to release the CPU wake lock
|
|
|
|
// grabbed by the ContentParent (i.e. NewWakeLockOnBehalfOfProcess()) and
|
|
|
|
// reset the process's priority.
|
|
|
|
//
|
|
|
|
// TODO: Bug 874353 - Remove SystemMessageHandledListener in ContentParent
|
2013-06-21 08:17:22 +00:00
|
|
|
Services.obs.notifyObservers(/* aSubject */ null,
|
|
|
|
"handle-system-messages-done",
|
|
|
|
/* aData */ null);
|
|
|
|
}
|
2012-07-03 00:16:55 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
// nsIDOMGlobalPropertyInitializer implementation.
|
2014-03-31 08:04:11 +00:00
|
|
|
init: function(aWindow) {
|
2012-07-03 00:16:55 +00:00
|
|
|
debug("init");
|
2014-03-31 08:04:42 +00:00
|
|
|
this.initDOMRequestHelper(aWindow,
|
|
|
|
["SystemMessageManager:Message",
|
|
|
|
"SystemMessageManager:GetPendingMessages:Return"]);
|
2012-08-13 16:58:38 +00:00
|
|
|
|
|
|
|
let principal = aWindow.document.nodePrincipal;
|
2013-01-18 13:50:01 +00:00
|
|
|
this._isInBrowserElement = principal.isInBrowserElement;
|
2014-03-31 08:04:36 +00:00
|
|
|
this._pageURL = principal.URI.spec;
|
2012-08-13 16:58:38 +00:00
|
|
|
|
|
|
|
let appsService = Cc["@mozilla.org/AppsService;1"]
|
|
|
|
.getService(Ci.nsIAppsService);
|
2014-03-31 08:04:29 +00:00
|
|
|
this._manifestURL = appsService.getManifestURLByLocalId(principal.appId);
|
2012-10-09 03:15:47 +00:00
|
|
|
|
2014-03-31 08:04:29 +00:00
|
|
|
// Two cases are valid to register the manifest URL for the current process:
|
2012-10-09 03:15:47 +00:00
|
|
|
// 1. This is asked by a child process (parent process must be ready).
|
|
|
|
// 2. Parent process has already constructed the |SystemMessageInternal|.
|
|
|
|
// Otherwise, delay to do it when the |SystemMessageInternal| is ready.
|
|
|
|
let readyToRegister = true;
|
|
|
|
if (this._isParentProcess) {
|
|
|
|
let ready = cpmm.sendSyncMessage(
|
|
|
|
"SystemMessageManager:AskReadyToRegister", null);
|
|
|
|
if (ready.length == 0 || !ready[0]) {
|
|
|
|
readyToRegister = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (readyToRegister) {
|
2014-03-31 08:04:29 +00:00
|
|
|
this._registerManifestURL();
|
2012-10-09 03:15:47 +00:00
|
|
|
}
|
|
|
|
|
2012-09-18 17:34:56 +00:00
|
|
|
debug("done");
|
2012-07-03 00:16:55 +00:00
|
|
|
},
|
|
|
|
|
2014-03-31 08:04:11 +00:00
|
|
|
observe: function(aSubject, aTopic, aData) {
|
2012-10-09 03:15:47 +00:00
|
|
|
if (aTopic === kSystemMessageInternalReady) {
|
2014-03-31 08:04:29 +00:00
|
|
|
this._registerManifestURL();
|
2012-10-09 03:15:47 +00:00
|
|
|
}
|
2013-10-18 10:58:24 +00:00
|
|
|
|
|
|
|
// Call the DOMRequestIpcHelper.observe method.
|
|
|
|
this.__proto__.__proto__.observe.call(this, aSubject, aTopic, aData);
|
2012-10-09 03:15:47 +00:00
|
|
|
},
|
|
|
|
|
2014-03-31 08:04:29 +00:00
|
|
|
_registerManifestURL: function() {
|
2013-01-18 13:50:01 +00:00
|
|
|
if (this._isInBrowserElement) {
|
|
|
|
debug("the app loaded in the browser doesn't need to register " +
|
2014-03-31 08:04:29 +00:00
|
|
|
"the manifest URL for listening to the system messages");
|
2013-01-18 13:50:01 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-03-31 08:04:29 +00:00
|
|
|
if (!this._registerManifestURLReady) {
|
2012-10-09 03:15:47 +00:00
|
|
|
cpmm.sendAsyncMessage("SystemMessageManager:Register",
|
2014-03-31 08:04:29 +00:00
|
|
|
{ manifestURL: this._manifestURL,
|
2014-03-31 08:04:36 +00:00
|
|
|
pageURL: this._pageURL,
|
2013-05-23 09:53:40 +00:00
|
|
|
innerWindowID: this.innerWindowID });
|
|
|
|
|
2014-03-31 08:04:29 +00:00
|
|
|
this._registerManifestURLReady = true;
|
2012-10-09 03:15:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2012-07-03 00:16:55 +00:00
|
|
|
classID: Components.ID("{bc076ea0-609b-4d8f-83d7-5af7cbdc3bb2}"),
|
|
|
|
|
|
|
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMNavigatorSystemMessages,
|
2012-10-09 03:15:47 +00:00
|
|
|
Ci.nsIDOMGlobalPropertyInitializer,
|
2013-07-08 21:55:42 +00:00
|
|
|
Ci.nsIObserver,
|
2014-03-18 04:36:31 +00:00
|
|
|
Ci.nsISupportsWeakReference])
|
2012-07-03 00:16:55 +00:00
|
|
|
}
|
|
|
|
|
2012-10-31 16:13:28 +00:00
|
|
|
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SystemMessageManager]);
|