mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 776825 - Separate message managers into senders and broadcasters. r=smaug
--HG-- rename : content/base/public/nsIFrameMessageManager.idl => content/base/public/nsIMessageManager.idl
This commit is contained in:
parent
ab543cc2ee
commit
d158b5747c
@ -49,7 +49,7 @@ XPCOMUtils.defineLazyGetter(this, 'DebuggerServer', function() {
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIFrameMessageManager);
|
||||
.getService(Ci.nsIMessageListenerManager);
|
||||
});
|
||||
|
||||
function getContentWindow() {
|
||||
|
@ -14,7 +14,8 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIMessageSender);
|
||||
});
|
||||
|
||||
function log(aMsg) {
|
||||
|
@ -14,7 +14,7 @@ Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
|
||||
const messageManager = Cc["@mozilla.org/globalmessagemanager;1"]
|
||||
.getService(Ci.nsIChromeFrameMessageManager);
|
||||
.getService(Ci.nsIMessageBroadcaster);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
@ -70,19 +70,19 @@ MozKeyboard.prototype = {
|
||||
},
|
||||
|
||||
setSelectedOption: function mozKeyboardSetSelectedOption(index) {
|
||||
messageManager.sendAsyncMessage("Forms:Select:Choice", {
|
||||
messageManager.broadcastAsyncMessage("Forms:Select:Choice", {
|
||||
"index": index
|
||||
});
|
||||
},
|
||||
|
||||
setValue: function mozKeyboardSetValue(value) {
|
||||
messageManager.sendAsyncMessage("Forms:Input:Value", {
|
||||
messageManager.broadcastAsyncMessage("Forms:Input:Value", {
|
||||
"value": value
|
||||
});
|
||||
},
|
||||
|
||||
setSelectedOptions: function mozKeyboardSetSelectedOptions(indexes) {
|
||||
messageManager.sendAsyncMessage("Forms:Select:Choice", {
|
||||
messageManager.broadcastAsyncMessage("Forms:Select:Choice", {
|
||||
"indexes": indexes || []
|
||||
});
|
||||
},
|
||||
|
@ -360,7 +360,7 @@ const gSessionHistoryObserver = {
|
||||
fwdCommand.setAttribute("disabled", "true");
|
||||
|
||||
// Hide session restore button on about:home
|
||||
window.messageManager.sendAsyncMessage("Browser:HideSessionRestoreButton");
|
||||
window.messageManager.broadcastAsyncMessage("Browser:HideSessionRestoreButton");
|
||||
|
||||
if (gURLBar) {
|
||||
// Clear undo history of the URL bar
|
||||
|
@ -81,7 +81,7 @@ XPIDLSRCS = \
|
||||
nsIFrameLoader.idl \
|
||||
nsIXMLHttpRequest.idl \
|
||||
nsIContentSecurityPolicy.idl \
|
||||
nsIFrameMessageManager.idl \
|
||||
nsIMessageManager.idl \
|
||||
nsIWebSocket.idl \
|
||||
nsIEventSource.idl \
|
||||
$(NULL)
|
||||
|
@ -8,7 +8,7 @@
|
||||
interface nsIDocShell;
|
||||
interface nsIURI;
|
||||
interface nsIFrame;
|
||||
interface nsIChromeFrameMessageManager;
|
||||
interface nsIMessageSender;
|
||||
interface nsIVariant;
|
||||
interface nsIDOMElement;
|
||||
|
||||
@ -108,7 +108,7 @@ interface nsIContentViewManager : nsISupports
|
||||
readonly attribute nsIContentView rootContentView;
|
||||
};
|
||||
|
||||
[scriptable, uuid(fc338eea-47dc-475e-add7-a3933fcfa07c)]
|
||||
[scriptable, uuid(f234c232-bb17-4450-b324-bf1ef5ccfd34)]
|
||||
interface nsIFrameLoader : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -177,7 +177,7 @@ interface nsIFrameLoader : nsISupports
|
||||
void activateFrameEvent(in AString aType, in boolean capture);
|
||||
|
||||
// Note, when frameloaders are swapped, also messageManagers are swapped.
|
||||
readonly attribute nsIChromeFrameMessageManager messageManager;
|
||||
readonly attribute nsIMessageSender messageManager;
|
||||
|
||||
/**
|
||||
* @see nsIDOMWindowUtils sendKeyEvent.
|
||||
|
@ -1,120 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMWindow;
|
||||
interface nsIDocShell;
|
||||
interface nsIContent;
|
||||
|
||||
[scriptable, function, uuid(938fcb95-3d63-46be-aa72-94d08fd3b418)]
|
||||
interface nsIFrameMessageListener : nsISupports
|
||||
{
|
||||
/**
|
||||
* This is for JS only.
|
||||
* receiveMessage is called with one parameter, which has the following
|
||||
* properties:
|
||||
* {
|
||||
* target: %the target of the message. Either an element owning
|
||||
* the message manager, or message manager itself if no
|
||||
* element owns it%
|
||||
* name: %message name%,
|
||||
* sync: %true or false%.
|
||||
* json: %structured clone of the sent message data%,
|
||||
* json: %same as .data, deprecated%,
|
||||
* objects: %array of handles or null, always null if sync is false%
|
||||
* }
|
||||
* @note objects property isn't implemented yet.
|
||||
*
|
||||
* if the message is synchronous, possible return value is sent back
|
||||
* as JSON (will be changed to use structured clones).
|
||||
*
|
||||
* When the listener is called, 'this' value is the target of the message.
|
||||
*/
|
||||
void receiveMessage();
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(9be42627-a5db-456f-8de2-9097da45a8c3)]
|
||||
interface nsIFrameMessageManager : nsISupports
|
||||
{
|
||||
void addMessageListener(in AString aMessage, in nsIFrameMessageListener aListener);
|
||||
void removeMessageListener(in AString aMessage, in nsIFrameMessageListener aListener);
|
||||
[implicit_jscontext,optional_argc]
|
||||
void sendAsyncMessage([optional] in AString messageName, [optional] in jsval obj);
|
||||
[notxpcom] boolean markForCC();
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(28a36ac7-2868-4fa0-ae24-be957d7dce10)]
|
||||
interface nsISyncMessageSender : nsIFrameMessageManager
|
||||
{
|
||||
/**
|
||||
* Returns an array of JSON objects.
|
||||
*/
|
||||
[implicit_jscontext,optional_argc]
|
||||
jsval sendSyncMessage([optional] in AString messageName, [optional] in jsval obj);
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(a83f4393-e3cf-44da-8867-1f9174c2c595)]
|
||||
interface nsIContentFrameMessageManager : nsISyncMessageSender
|
||||
{
|
||||
/**
|
||||
* The current top level window in the frame or null.
|
||||
*/
|
||||
readonly attribute nsIDOMWindow content;
|
||||
|
||||
/**
|
||||
* The top level docshell or null.
|
||||
*/
|
||||
readonly attribute nsIDocShell docShell;
|
||||
|
||||
/**
|
||||
* Print a string to stdout.
|
||||
*/
|
||||
void dump(in DOMString aStr);
|
||||
|
||||
/**
|
||||
* If leak detection is enabled, print a note to the leak log that this
|
||||
* process will intentionally crash.
|
||||
*/
|
||||
void privateNoteIntentionalCrash();
|
||||
|
||||
/**
|
||||
* Ascii base64 data to binary data and vice versa
|
||||
*/
|
||||
DOMString atob(in DOMString aAsciiString);
|
||||
DOMString btoa(in DOMString aBase64Data);
|
||||
};
|
||||
|
||||
[uuid(f0936c56-e92c-4927-a85b-e289c3d4a01c)]
|
||||
interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager
|
||||
{
|
||||
[notxpcom] nsIContent getOwnerContent();
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(09f79e8c-101b-432b-a494-02f9b5e111c0)]
|
||||
interface nsITreeItemFrameMessageManager : nsIFrameMessageManager
|
||||
{
|
||||
readonly attribute unsigned long childCount;
|
||||
nsITreeItemFrameMessageManager getChildAt(in unsigned long aIndex);
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(a51597f0-d669-4260-83e6-1d426a8ac802)]
|
||||
interface nsIChromeFrameMessageManager : nsITreeItemFrameMessageManager
|
||||
{
|
||||
/**
|
||||
* Load a script in the (remote) frame. aURL must be the absolute URL.
|
||||
* data: URLs are also supported. For example data:,dump("foo\n");
|
||||
* If aAllowDelayedLoad is true, script will be loaded when the
|
||||
* remote frame becomes available. Otherwise the script will be loaded
|
||||
* only if the frame is already available.
|
||||
*/
|
||||
void loadFrameScript(in AString aURL, in boolean aAllowDelayedLoad);
|
||||
|
||||
/**
|
||||
* Removes aURL from the list of scripts which support delayed load.
|
||||
*/
|
||||
void removeDelayedFrameScript(in AString aURL);
|
||||
};
|
||||
|
330
content/base/public/nsIMessageManager.idl
Normal file
330
content/base/public/nsIMessageManager.idl
Normal file
@ -0,0 +1,330 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMWindow;
|
||||
interface nsIDocShell;
|
||||
interface nsIContent;
|
||||
|
||||
/**
|
||||
* Message managers provide a way for chrome-privileged JS code to
|
||||
* communicate with each other, even across process boundaries.
|
||||
*
|
||||
* Message managers are separated into "parent side" and "child side".
|
||||
* These don't always correspond to process boundaries, but can. For
|
||||
* each child-side message manager, there is always exactly one
|
||||
* corresponding parent-side message manager that it sends messages
|
||||
* to. However, for each parent-side message manager, there may be
|
||||
* either one or many child-side managers it can message.
|
||||
*
|
||||
* Message managers that always have exactly one "other side" are of
|
||||
* type nsIMessageSender. Parent-side message managers that have many
|
||||
* "other sides" are of type nsIMessageBroadcaster.
|
||||
*
|
||||
* Child-side message managers can send synchronous messages to their
|
||||
* parent side, but not the other way around.
|
||||
*
|
||||
* There are two realms of message manager hierarchies. One realm
|
||||
* approximately corresponds to DOM elements, the other corresponds to
|
||||
* process boundaries.
|
||||
*
|
||||
* Message managers corresponding to DOM elements
|
||||
* ==============================================
|
||||
*
|
||||
* In this realm of message managers, there are
|
||||
* - "frame message managers" which correspond to frame elements
|
||||
* - "window message managers" which correspond to top-level chrome
|
||||
* windows
|
||||
* - the "global message manager", on the parent side. See below.
|
||||
*
|
||||
* The DOM-realm message managers can communicate in the ways shown by
|
||||
* the following diagram. The parent side and child side can
|
||||
* correspond to process boundaries, but don't always.
|
||||
*
|
||||
* Parent side Child side
|
||||
* ------------- ------------
|
||||
* global MMg
|
||||
* |
|
||||
* +-->window MMw1
|
||||
* | |
|
||||
* | +-->frame MMp1_1<------------>frame MMc1_1
|
||||
* | |
|
||||
* | +-->frame MMp1_2<------------>frame MMc1_2
|
||||
* | ...
|
||||
* |
|
||||
* +-->window MMw2
|
||||
* ...
|
||||
*
|
||||
* For example: a message sent from MMc1_1, from the child side, is
|
||||
* sent only to MMp1_1 on the parent side. However, note that all
|
||||
* message managers in the hierarchy above MMp1_1, in this diagram
|
||||
* MMw1 and MMg, will also notify their message listeners when the
|
||||
* message arrives.
|
||||
|
||||
* For example: a message broadcast through the global MMg on the
|
||||
* parent side would be broadcast to MMw1, which would transitively
|
||||
* broadcast it to MMp1_1, MM1p_2". The message would next be
|
||||
* broadcast to MMw2, and so on down the hierarchy.
|
||||
*
|
||||
* ***** PERFORMANCE AND SECURITY WARNING *****
|
||||
* Messages broadcast through the global MM and window MMs can result
|
||||
* in messages being dispatched across many OS processes, and to many
|
||||
* processes with different permissions. Great care should be taken
|
||||
* when broadcasting.
|
||||
*
|
||||
* Interfaces
|
||||
* ----------
|
||||
*
|
||||
* The global MMg and window MMw's are message broadcasters implementing
|
||||
* nsIMessageBroadcaster while the frame MMp's are simple message senders
|
||||
* (nsIMessageSender). Their counterparts in the content processes are
|
||||
* message senders implementing nsIContentFrameMessageManager.
|
||||
*
|
||||
* nsIMessageListenerManager
|
||||
* / \
|
||||
* nsIMessageSender nsIMessageBroadcaster
|
||||
* |
|
||||
* nsISyncMessageSender (content process/in-process only)
|
||||
* |
|
||||
* nsIContentFrameMessageManager (content process/in-process only)
|
||||
* |
|
||||
* nsIInProcessContentFrameMessageManager (in-process only)
|
||||
*
|
||||
*
|
||||
* Message managers in the chrome process can also be QI'ed to nsIFrameScriptLoader.
|
||||
*
|
||||
*
|
||||
* Message managers corresponding to process boundaries
|
||||
* ====================================================
|
||||
*
|
||||
* The second realm of message managers is the "process message
|
||||
* managers". With one exception, these always correspond to process
|
||||
* boundaries. The picture looks like
|
||||
*
|
||||
* Parent process Child processes
|
||||
* ---------------- -----------------
|
||||
* global PPMM
|
||||
* |
|
||||
* +<----> child PPMM
|
||||
* |
|
||||
* +-->parent PMM1<------------------>child process CMM1
|
||||
* |
|
||||
* +-->parent PMM2<------------------>child process PMM2
|
||||
* ...
|
||||
*
|
||||
* For example: the parent-process PMM1 sends messages directly to
|
||||
* only the child-process CMM1.
|
||||
*
|
||||
* For example: CMM1 sends messages directly to PMM1. The global PPMM
|
||||
* will also notify their message listeners when the message arrives.
|
||||
*
|
||||
* For example: messages sent through the global PPMM will be
|
||||
* dispatched to the listeners of the same-process, "child PPMM".
|
||||
* They will also be broadcast to PPM1, PPM2, etc.
|
||||
*
|
||||
* ***** PERFORMANCE AND SECURITY WARNING *****
|
||||
* Messages broadcast through the global PPMM can result in messages
|
||||
* being dispatched across many OS processes, and to many processes
|
||||
* with different permissions. Great care should be taken when
|
||||
* broadcasting.
|
||||
*
|
||||
* Requests sent to parent-process message listeners should usually
|
||||
* have replies scoped to the requesting CPMM. The following pattern
|
||||
* is common
|
||||
*
|
||||
* const ParentProcessListener = {
|
||||
* receiveMessage: function(aMessage) {
|
||||
* let childMM = aMessage.target.QueryInterface(Ci.nsIMessageSender);
|
||||
* switch (aMessage.name) {
|
||||
* case "Foo:Request":
|
||||
* // service request
|
||||
* childMM.sendAsyncMessage("Foo:Response", { data });
|
||||
* }
|
||||
* }
|
||||
* };
|
||||
*/
|
||||
|
||||
[scriptable, function, uuid(2b44eb57-a9c6-4773-9a1e-fe0818739a4c)]
|
||||
interface nsIMessageListener : nsISupports
|
||||
{
|
||||
/**
|
||||
* This is for JS only.
|
||||
* receiveMessage is called with one parameter, which has the following
|
||||
* properties:
|
||||
* {
|
||||
* target: %the target of the message. Either an element owning
|
||||
* the message manager, or message manager itself if no
|
||||
* element owns it%
|
||||
* name: %message name%,
|
||||
* sync: %true or false%.
|
||||
* data: %structured clone of the sent message data%,
|
||||
* json: %same as .data, deprecated%,
|
||||
* objects: %array of handles or null, always null if sync is false%
|
||||
* }
|
||||
* @note objects property isn't implemented yet.
|
||||
*
|
||||
* Each listener is invoked with its own copy of the message
|
||||
* parameter.
|
||||
*
|
||||
* When the listener is called, 'this' value is the target of the message.
|
||||
*
|
||||
* If the message is synchronous, the possible return value is
|
||||
* returned as JSON (will be changed to use structured clones).
|
||||
* When there are multiple listeners to sync messages, each
|
||||
* listener's return value is sent back as an array. |undefined|
|
||||
* return values show up as undefined values in the array.
|
||||
*/
|
||||
void receiveMessage();
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(9c37a142-3de3-4902-a1a4-133f37d5980a)]
|
||||
interface nsIMessageListenerManager : nsISupports
|
||||
{
|
||||
/**
|
||||
* Register |listener| to receive |messageName|. All listener
|
||||
* callbacks for a particular message are invoked when that message
|
||||
* is received.
|
||||
*
|
||||
* The message manager holds a strong ref to |listener|.
|
||||
*
|
||||
* If the same listener registers twice for the same message, the
|
||||
* second registration is ignored.
|
||||
*/
|
||||
void addMessageListener(in AString messageName,
|
||||
in nsIMessageListener listener);
|
||||
|
||||
/**
|
||||
* No longer invoke |listener| when |messageName| is received, after
|
||||
* the first time removeMessageListener() is called.
|
||||
*/
|
||||
void removeMessageListener(in AString messageName,
|
||||
in nsIMessageListener listener);
|
||||
|
||||
[notxpcom] boolean markForCC();
|
||||
};
|
||||
|
||||
/**
|
||||
* Message "senders" have a single "other side" to which messages are
|
||||
* sent. For example, a child-process message manager will send
|
||||
* messages that are only delivered to its one parent-process message
|
||||
* manager.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(7f23767d-0f39-40c1-a22d-d3ab8a481f9d)]
|
||||
interface nsIMessageSender : nsIMessageListenerManager
|
||||
{
|
||||
/**
|
||||
* Send |messageName| and |obj| to the "other side" of this message
|
||||
* manager. This invokes listeners who registered for
|
||||
* |messageName|.
|
||||
*
|
||||
* See nsIMessageListener::receiveMessage() for the format of the
|
||||
* data delivered to listeners.
|
||||
*/
|
||||
[implicit_jscontext, optional_argc]
|
||||
void sendAsyncMessage([optional] in AString messageName,
|
||||
[optional] in jsval obj);
|
||||
};
|
||||
|
||||
/**
|
||||
* Message "broadcasters" don't have a single "other side" that they
|
||||
* send messages to, but rather a set of subordinate message managers.
|
||||
* For example, broadcasting a message through a window message
|
||||
* manager will broadcast the message to all frame message managers
|
||||
* within its window.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(d36346b9-5d3b-497d-9c28-ffbc3e4f6d0d)]
|
||||
interface nsIMessageBroadcaster : nsIMessageListenerManager
|
||||
{
|
||||
/**
|
||||
* Like |sendAsyncMessage()|, but also broadcasts this message to
|
||||
* all "child" message managers of this message manager. See long
|
||||
* comment above for details.
|
||||
*
|
||||
* WARNING: broadcasting messages can be very expensive and leak
|
||||
* sensitive data. Use with extreme caution.
|
||||
*/
|
||||
[implicit_jscontext, optional_argc]
|
||||
void broadcastAsyncMessage([optional] in AString messageName,
|
||||
[optional] in jsval obj);
|
||||
|
||||
/**
|
||||
* Number of subordinate message managers.
|
||||
*/
|
||||
readonly attribute unsigned long childCount;
|
||||
|
||||
/**
|
||||
* Return a single subordinate message manager.
|
||||
*/
|
||||
nsIMessageListenerManager getChildAt(in unsigned long aIndex);
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(83be5862-2996-4685-ae7d-ae25bd795d50)]
|
||||
interface nsISyncMessageSender : nsIMessageSender
|
||||
{
|
||||
/**
|
||||
* Like |sendAsyncMessage()|, except blocks the sender until all
|
||||
* listeners of the message have been invoked. Returns an array
|
||||
* containing return values from each listener invoked.
|
||||
*/
|
||||
[implicit_jscontext, optional_argc]
|
||||
jsval sendSyncMessage([optional] in AString messageName,
|
||||
[optional] in jsval obj);
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(894ff2d4-39a3-4df8-9d76-8ee329975488)]
|
||||
interface nsIContentFrameMessageManager : nsISyncMessageSender
|
||||
{
|
||||
/**
|
||||
* The current top level window in the frame or null.
|
||||
*/
|
||||
readonly attribute nsIDOMWindow content;
|
||||
|
||||
/**
|
||||
* The top level docshell or null.
|
||||
*/
|
||||
readonly attribute nsIDocShell docShell;
|
||||
|
||||
/**
|
||||
* Print a string to stdout.
|
||||
*/
|
||||
void dump(in DOMString aStr);
|
||||
|
||||
/**
|
||||
* If leak detection is enabled, print a note to the leak log that this
|
||||
* process will intentionally crash.
|
||||
*/
|
||||
void privateNoteIntentionalCrash();
|
||||
|
||||
/**
|
||||
* Ascii base64 data to binary data and vice versa
|
||||
*/
|
||||
DOMString atob(in DOMString aAsciiString);
|
||||
DOMString btoa(in DOMString aBase64Data);
|
||||
};
|
||||
|
||||
[uuid(a2325927-9c0c-437d-9215-749c79235031)]
|
||||
interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager
|
||||
{
|
||||
[notxpcom] nsIContent getOwnerContent();
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(a54acd34-4141-46f5-b71b-e2ca32879b08)]
|
||||
interface nsIFrameScriptLoader : nsISupports
|
||||
{
|
||||
/**
|
||||
* Load a script in the (remote) frame. aURL must be the absolute URL.
|
||||
* data: URLs are also supported. For example data:,dump("foo\n");
|
||||
* If aAllowDelayedLoad is true, script will be loaded when the
|
||||
* remote frame becomes available. Otherwise the script will be loaded
|
||||
* only if the frame is already available.
|
||||
*/
|
||||
void loadFrameScript(in AString aURL, in boolean aAllowDelayedLoad);
|
||||
|
||||
/**
|
||||
* Removes aURL from the list of scripts which support delayed load.
|
||||
*/
|
||||
void removeDelayedFrameScript(in AString aURL);
|
||||
};
|
@ -21,7 +21,7 @@ MessageWakeupService.prototype =
|
||||
get messageManager() {
|
||||
if (!this._messageManager)
|
||||
this._messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"].
|
||||
getService(Ci.nsIFrameMessageManager);
|
||||
getService(Ci.nsIMessageListenerManager);
|
||||
return this._messageManager;
|
||||
},
|
||||
|
||||
@ -39,7 +39,7 @@ MessageWakeupService.prototype =
|
||||
let data = this.messagesData[aMessage.name];
|
||||
// TODO: When bug 593407 is ready, stop doing the wrappedJSObject hack
|
||||
// and use this line instead:
|
||||
// QueryInterface(Ci.nsIFrameMessageListener);
|
||||
// QueryInterface(Ci.nsIMessageListener);
|
||||
let service = Cc[data.cid][data.method](Ci[data.iid]).
|
||||
wrappedJSObject;
|
||||
|
||||
|
@ -92,7 +92,7 @@ MarkUserDataHandler(void* aNode, nsIAtom* aKey, void* aValue, void* aData)
|
||||
static void
|
||||
MarkMessageManagers()
|
||||
{
|
||||
nsCOMPtr<nsIChromeFrameMessageManager> globalMM =
|
||||
nsCOMPtr<nsIMessageBroadcaster> globalMM =
|
||||
do_GetService("@mozilla.org/globalmessagemanager;1");
|
||||
if (!globalMM) {
|
||||
return;
|
||||
@ -102,20 +102,22 @@ MarkMessageManagers()
|
||||
uint32_t childCount = 0;
|
||||
globalMM->GetChildCount(&childCount);
|
||||
for (uint32_t i = 0; i < childCount; ++i) {
|
||||
nsCOMPtr<nsITreeItemFrameMessageManager> windowMM;
|
||||
globalMM->GetChildAt(i, getter_AddRefs(windowMM));
|
||||
if (!windowMM) {
|
||||
nsCOMPtr<nsIMessageListenerManager> childMM;
|
||||
globalMM->GetChildAt(i, getter_AddRefs(childMM));
|
||||
if (!childMM) {
|
||||
continue;
|
||||
}
|
||||
nsCOMPtr<nsIMessageBroadcaster> windowMM = do_QueryInterface(childMM);
|
||||
windowMM->MarkForCC();
|
||||
uint32_t tabChildCount = 0;
|
||||
windowMM->GetChildCount(&tabChildCount);
|
||||
for (uint32_t j = 0; j < tabChildCount; ++j) {
|
||||
nsCOMPtr<nsITreeItemFrameMessageManager> tabMM;
|
||||
windowMM->GetChildAt(j, getter_AddRefs(tabMM));
|
||||
if (!tabMM) {
|
||||
nsCOMPtr<nsIMessageListenerManager> childMM;
|
||||
windowMM->GetChildAt(j, getter_AddRefs(childMM));
|
||||
if (!childMM) {
|
||||
continue;
|
||||
}
|
||||
nsCOMPtr<nsIMessageSender> tabMM = do_QueryInterface(childMM);
|
||||
tabMM->MarkForCC();
|
||||
//XXX hack warning, but works, since we know that
|
||||
// callback data is frameloader.
|
||||
|
@ -2244,7 +2244,7 @@ bool SendAsyncMessageToChild(void* aCallbackData,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetMessageManager(nsIChromeFrameMessageManager** aManager)
|
||||
nsFrameLoader::GetMessageManager(nsIMessageSender** aManager)
|
||||
{
|
||||
EnsureMessageManager();
|
||||
if (mMessageManager) {
|
||||
@ -2336,13 +2336,13 @@ nsFrameLoader::EnsureMessageManager()
|
||||
|
||||
nsCOMPtr<nsIDOMChromeWindow> chromeWindow =
|
||||
do_QueryInterface(GetOwnerDoc()->GetWindow());
|
||||
nsCOMPtr<nsIChromeFrameMessageManager> parentManager;
|
||||
nsCOMPtr<nsIMessageBroadcaster> parentManager;
|
||||
if (chromeWindow) {
|
||||
chromeWindow->GetMessageManager(getter_AddRefs(parentManager));
|
||||
}
|
||||
|
||||
if (ShouldUseRemoteProcess()) {
|
||||
mMessageManager = new nsFrameMessageManager(true,
|
||||
mMessageManager = new nsFrameMessageManager(true, /* aChrome */
|
||||
nullptr,
|
||||
SendAsyncMessageToChild,
|
||||
LoadScript,
|
||||
@ -2350,7 +2350,7 @@ nsFrameLoader::EnsureMessageManager()
|
||||
static_cast<nsFrameMessageManager*>(parentManager.get()),
|
||||
cx);
|
||||
} else {
|
||||
mMessageManager = new nsFrameMessageManager(true,
|
||||
mMessageManager = new nsFrameMessageManager(true, /* aChrome */
|
||||
nullptr,
|
||||
SendAsyncMessageToChild,
|
||||
LoadScript,
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIJSRuntimeService.h"
|
||||
#include "nsIDOMClassInfo.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
@ -64,7 +65,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsFrameMessageManager)
|
||||
tmp->mListeners.Clear();
|
||||
for (int32_t i = tmp->mChildManagers.Count(); i > 0; --i) {
|
||||
for (PRInt32 i = tmp->mChildManagers.Count(); i > 0; --i) {
|
||||
static_cast<nsFrameMessageManager*>(tmp->mChildManagers[i - 1])->
|
||||
Disconnect(false);
|
||||
}
|
||||
@ -74,30 +75,48 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameMessageManager)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContentFrameMessageManager)
|
||||
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIFrameMessageManager,
|
||||
(mChrome ?
|
||||
static_cast<nsIFrameMessageManager*>(
|
||||
static_cast<nsIChromeFrameMessageManager*>(this)) :
|
||||
static_cast<nsIFrameMessageManager*>(
|
||||
static_cast<nsIContentFrameMessageManager*>(this))))
|
||||
|
||||
/* nsFrameMessageManager implements nsIMessageSender and nsIMessageBroadcaster,
|
||||
* both of which descend from nsIMessageListenerManager. QI'ing to
|
||||
* nsIMessageListenerManager is therefore ambiguous and needs explicit casts
|
||||
* depending on which child interface applies. */
|
||||
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIMessageListenerManager,
|
||||
(mIsBroadcaster ?
|
||||
static_cast<nsIMessageListenerManager*>(
|
||||
static_cast<nsIMessageBroadcaster*>(this)) :
|
||||
static_cast<nsIMessageListenerManager*>(
|
||||
static_cast<nsIMessageSender*>(this))))
|
||||
|
||||
/* Message managers in child process implement nsIMessageSender and
|
||||
nsISyncMessageSender. Message managers in the chrome process are
|
||||
either broadcasters (if they have subordinate/child message
|
||||
managers) or they're simple message senders. */
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsISyncMessageSender, !mChrome)
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIMessageSender, !mChrome || !mIsBroadcaster)
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIMessageBroadcaster, mChrome && mIsBroadcaster)
|
||||
|
||||
/* nsIContentFrameMessageManager is accessible only in TabChildGlobal. */
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIContentFrameMessageManager,
|
||||
!mChrome && !mIsProcessManager)
|
||||
/* Message managers in child process support nsISyncMessageSender. */
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsISyncMessageSender, !mChrome)
|
||||
/* Message managers in chrome process support nsITreeItemFrameMessageManager. */
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsITreeItemFrameMessageManager, mChrome)
|
||||
/* Process message manager doesn't support nsIChromeFrameMessageManager. */
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIChromeFrameMessageManager,
|
||||
|
||||
/* Frame message managers (non-process message managers) support nsIFrameScriptLoader. */
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIFrameScriptLoader,
|
||||
mChrome && !mIsProcessManager)
|
||||
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_CONDITIONAL(ChromeMessageBroadcaster,
|
||||
mChrome && mIsBroadcaster)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_CONDITIONAL(ChromeMessageSender,
|
||||
mChrome && !mIsBroadcaster)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsFrameMessageManager)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsFrameMessageManager)
|
||||
|
||||
// nsIMessageListenerManager
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::AddMessageListener(const nsAString& aMessage,
|
||||
nsIFrameMessageListener* aListener)
|
||||
nsIMessageListener* aListener)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> message = do_GetAtom(aMessage);
|
||||
uint32_t len = mListeners.Length();
|
||||
@ -116,7 +135,7 @@ nsFrameMessageManager::AddMessageListener(const nsAString& aMessage,
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::RemoveMessageListener(const nsAString& aMessage,
|
||||
nsIFrameMessageListener* aListener)
|
||||
nsIMessageListener* aListener)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> message = do_GetAtom(aMessage);
|
||||
uint32_t len = mListeners.Length();
|
||||
@ -130,6 +149,8 @@ nsFrameMessageManager::RemoveMessageListener(const nsAString& aMessage,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIFrameScriptLoader
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::LoadFrameScript(const nsAString& aURL,
|
||||
bool aAllowDelayedLoad)
|
||||
@ -152,7 +173,7 @@ nsFrameMessageManager::LoadFrameScript(const nsAString& aURL,
|
||||
NS_ENSURE_TRUE(mLoadScriptCallback(mCallbackData, aURL), NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < mChildManagers.Count(); ++i) {
|
||||
for (PRInt32 i = 0; i < mChildManagers.Count(); ++i) {
|
||||
nsRefPtr<nsFrameMessageManager> mm =
|
||||
static_cast<nsFrameMessageManager*>(mChildManagers[i]);
|
||||
if (mm) {
|
||||
@ -208,6 +229,9 @@ GetParamsForMessage(JSContext* aCx,
|
||||
return WriteStructuredClone(aCx, val, aBuffer, aClosure);
|
||||
}
|
||||
|
||||
|
||||
// nsISyncMessageSender
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::SendSyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
@ -257,26 +281,30 @@ nsFrameMessageManager::SendSyncMessage(const nsAString& aMessageName,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFrameMessageManager::SendAsyncMessageInternal(const nsAString& aMessage,
|
||||
const StructuredCloneData& aData)
|
||||
nsFrameMessageManager::DispatchAsyncMessageInternal(const nsAString& aMessage,
|
||||
const StructuredCloneData& aData,
|
||||
ShouldBroadcast aBroadcast)
|
||||
{
|
||||
if (mAsyncCallback) {
|
||||
NS_ENSURE_TRUE(mCallbackData, NS_ERROR_NOT_INITIALIZED);
|
||||
mAsyncCallback(mCallbackData, aMessage, aData);
|
||||
}
|
||||
int32_t len = mChildManagers.Count();
|
||||
for (int32_t i = 0; i < len; ++i) {
|
||||
static_cast<nsFrameMessageManager*>(mChildManagers[i])->
|
||||
SendAsyncMessageInternal(aMessage, aData);
|
||||
if (aBroadcast == BROADCAST) {
|
||||
PRInt32 len = mChildManagers.Count();
|
||||
for (PRInt32 i = 0; i < len; ++i) {
|
||||
static_cast<nsFrameMessageManager*>(mChildManagers[i])->
|
||||
DispatchAsyncMessageInternal(aMessage, aData, aBroadcast);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::SendAsyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
uint8_t aArgc)
|
||||
nsresult
|
||||
nsFrameMessageManager::DispatchAsyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
uint8_t aArgc,
|
||||
ShouldBroadcast aBroadcast)
|
||||
{
|
||||
StructuredCloneData data;
|
||||
JSAutoStructuredCloneBuffer buffer;
|
||||
@ -289,9 +317,54 @@ nsFrameMessageManager::SendAsyncMessage(const nsAString& aMessageName,
|
||||
data.mData = buffer.data();
|
||||
data.mDataLength = buffer.nbytes();
|
||||
|
||||
return SendAsyncMessageInternal(aMessageName, data);
|
||||
return DispatchAsyncMessageInternal(aMessageName, data, aBroadcast);
|
||||
}
|
||||
|
||||
|
||||
// nsIMessageSender
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::SendAsyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
uint8_t aArgc)
|
||||
{
|
||||
return DispatchAsyncMessage(aMessageName, aObject, aCx, aArgc, DONT_BROADCAST);
|
||||
}
|
||||
|
||||
|
||||
// nsIMessageBroadcaster
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::BroadcastAsyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
uint8_t aArgc)
|
||||
{
|
||||
return DispatchAsyncMessage(aMessageName, aObject, aCx, aArgc, BROADCAST);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::GetChildCount(uint32_t* aChildCount)
|
||||
{
|
||||
*aChildCount = static_cast<uint32_t>(mChildManagers.Count());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::GetChildAt(uint32_t aIndex,
|
||||
nsIMessageListenerManager** aMM)
|
||||
{
|
||||
*aMM = nullptr;
|
||||
nsCOMPtr<nsIMessageListenerManager> mm =
|
||||
do_QueryInterface(mChildManagers.SafeObjectAt(static_cast<uint32_t>(aIndex)));
|
||||
mm.swap(*aMM);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// nsIContentFrameMessageManager
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::Dump(const nsAString& aStr)
|
||||
{
|
||||
@ -328,24 +401,6 @@ nsFrameMessageManager::GetDocShell(nsIDocShell** aDocShell)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::GetChildCount(uint32_t* aChildCount)
|
||||
{
|
||||
*aChildCount = static_cast<uint32_t>(mChildManagers.Count());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::GetChildAt(uint32_t aIndex,
|
||||
nsITreeItemFrameMessageManager** aMM)
|
||||
{
|
||||
*aMM = nullptr;
|
||||
nsCOMPtr<nsITreeItemFrameMessageManager> mm =
|
||||
do_QueryInterface(mChildManagers.SafeObjectAt(static_cast<uint32_t>(aIndex)));
|
||||
mm.swap(*aMM);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::Btoa(const nsAString& aBinaryData,
|
||||
nsAString& aAsciiBase64String)
|
||||
@ -360,6 +415,7 @@ nsFrameMessageManager::Atob(const nsAString& aAsciiString,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
class MMListenerRemover
|
||||
{
|
||||
public:
|
||||
@ -383,6 +439,9 @@ public:
|
||||
nsRefPtr<nsFrameMessageManager> mMM;
|
||||
};
|
||||
|
||||
|
||||
// nsIMessageListener
|
||||
|
||||
nsresult
|
||||
nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
||||
const nsAString& aMessage,
|
||||
@ -591,17 +650,19 @@ nsFrameMessageManager::Disconnect(bool aRemoveFromParent)
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewGlobalMessageManager(nsIChromeFrameMessageManager** aResult)
|
||||
NS_NewGlobalMessageManager(nsIMessageBroadcaster** aResult)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsChromeProcess(), NS_ERROR_NOT_AVAILABLE);
|
||||
nsFrameMessageManager* mm = new nsFrameMessageManager(true,
|
||||
nsFrameMessageManager* mm = new nsFrameMessageManager(true /* aChrome */,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
true);
|
||||
true /* aGlobal */,
|
||||
false /* aProcessManager */,
|
||||
true /* aBroadcaster */);
|
||||
NS_ENSURE_TRUE(mm, NS_ERROR_OUT_OF_MEMORY);
|
||||
return CallQueryInterface(mm, aResult);
|
||||
}
|
||||
@ -1134,20 +1195,21 @@ bool SendAsyncMessageToSameProcessParent(void* aCallbackData,
|
||||
|
||||
// This creates the global parent process message manager.
|
||||
nsresult
|
||||
NS_NewParentProcessMessageManager(nsIFrameMessageManager** aResult)
|
||||
NS_NewParentProcessMessageManager(nsIMessageBroadcaster** aResult)
|
||||
{
|
||||
NS_ASSERTION(!nsFrameMessageManager::sParentProcessManager,
|
||||
"Re-creating sParentProcessManager");
|
||||
NS_ENSURE_TRUE(IsChromeProcess(), NS_ERROR_NOT_AVAILABLE);
|
||||
nsRefPtr<nsFrameMessageManager> mm = new nsFrameMessageManager(true,
|
||||
nsRefPtr<nsFrameMessageManager> mm = new nsFrameMessageManager(true /* aChrome */,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
false,
|
||||
true);
|
||||
false, /* aGlobal */
|
||||
true /* aProcessManager */,
|
||||
true /* aBroadcaster */);
|
||||
NS_ENSURE_TRUE(mm, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsFrameMessageManager::sParentProcessManager = mm;
|
||||
nsFrameMessageManager::NewProcessMessageManager(nullptr); // Create same process message manager.
|
||||
@ -1158,11 +1220,11 @@ nsFrameMessageManager*
|
||||
nsFrameMessageManager::NewProcessMessageManager(mozilla::dom::ContentParent* aProcess)
|
||||
{
|
||||
if (!nsFrameMessageManager::sParentProcessManager) {
|
||||
nsCOMPtr<nsIFrameMessageManager> dummy;
|
||||
nsCOMPtr<nsIMessageBroadcaster> dummy;
|
||||
NS_NewParentProcessMessageManager(getter_AddRefs(dummy));
|
||||
}
|
||||
|
||||
nsFrameMessageManager* mm = new nsFrameMessageManager(true,
|
||||
nsFrameMessageManager* mm = new nsFrameMessageManager(true /* aChrome */,
|
||||
nullptr,
|
||||
aProcess ? SendAsyncMessageToChildProcess
|
||||
: SendAsyncMessageToSameProcessChild,
|
||||
@ -1171,8 +1233,8 @@ nsFrameMessageManager::NewProcessMessageManager(mozilla::dom::ContentParent* aPr
|
||||
: static_cast<void*>(&nsFrameMessageManager::sChildProcessManager),
|
||||
nsFrameMessageManager::sParentProcessManager,
|
||||
nullptr,
|
||||
false,
|
||||
true);
|
||||
false, /* aGlobal */
|
||||
true /* aProcessManager */);
|
||||
if (!aProcess) {
|
||||
sSameProcessParentManager = mm;
|
||||
}
|
||||
@ -1185,7 +1247,7 @@ NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult)
|
||||
NS_ASSERTION(!nsFrameMessageManager::sChildProcessManager,
|
||||
"Re-creating sChildProcessManager");
|
||||
bool isChrome = IsChromeProcess();
|
||||
nsFrameMessageManager* mm = new nsFrameMessageManager(false,
|
||||
nsFrameMessageManager* mm = new nsFrameMessageManager(false /* aChrome */,
|
||||
isChrome ? SendSyncMessageToSameProcessParent
|
||||
: SendSyncMessageToParentProcess,
|
||||
isChrome ? SendAsyncMessageToSameProcessParent
|
||||
@ -1194,8 +1256,8 @@ NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult)
|
||||
&nsFrameMessageManager::sChildProcessManager,
|
||||
nullptr,
|
||||
nullptr,
|
||||
false,
|
||||
true);
|
||||
false /* aGlobal */,
|
||||
true /* aProcessManager */);
|
||||
NS_ENSURE_TRUE(mm, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsFrameMessageManager::sChildProcessManager = mm;
|
||||
return CallQueryInterface(mm, aResult);
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifndef nsFrameMessageManager_h__
|
||||
#define nsFrameMessageManager_h__
|
||||
|
||||
#include "nsIFrameMessageManager.h"
|
||||
#include "nsIMessageManager.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
@ -35,7 +35,7 @@ struct JSObject;
|
||||
|
||||
struct nsMessageListenerInfo
|
||||
{
|
||||
nsCOMPtr<nsIFrameMessageListener> mListener;
|
||||
nsCOMPtr<nsIMessageListener> mListener;
|
||||
nsCOMPtr<nsIAtom> mMessage;
|
||||
};
|
||||
|
||||
@ -49,7 +49,8 @@ typedef bool (*nsAsyncMessageCallback)(void* aCallbackData,
|
||||
const mozilla::dom::StructuredCloneData& aData);
|
||||
|
||||
class nsFrameMessageManager MOZ_FINAL : public nsIContentFrameMessageManager,
|
||||
public nsIChromeFrameMessageManager
|
||||
public nsIMessageBroadcaster,
|
||||
public nsIFrameScriptLoader
|
||||
{
|
||||
typedef mozilla::dom::StructuredCloneData StructuredCloneData;
|
||||
public:
|
||||
@ -61,10 +62,17 @@ public:
|
||||
nsFrameMessageManager* aParentManager,
|
||||
JSContext* aContext,
|
||||
bool aGlobal = false,
|
||||
bool aProcessManager = false)
|
||||
: mChrome(aChrome), mGlobal(aGlobal), mIsProcessManager(aProcessManager),
|
||||
mHandlingMessage(false), mDisconnected(false), mParentManager(aParentManager),
|
||||
mSyncCallback(aSyncCallback), mAsyncCallback(aAsyncCallback),
|
||||
bool aProcessManager = false,
|
||||
bool aBroadcaster = false)
|
||||
: mChrome(aChrome),
|
||||
mGlobal(aGlobal),
|
||||
mIsProcessManager(aProcessManager),
|
||||
mIsBroadcaster(aBroadcaster),
|
||||
mHandlingMessage(false),
|
||||
mDisconnected(false),
|
||||
mParentManager(aParentManager),
|
||||
mSyncCallback(aSyncCallback),
|
||||
mAsyncCallback(aAsyncCallback),
|
||||
mLoadScriptCallback(aLoadScriptCallback),
|
||||
mCallbackData(aCallbackData),
|
||||
mContext(aContext)
|
||||
@ -105,11 +113,12 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFrameMessageManager,
|
||||
nsIContentFrameMessageManager)
|
||||
NS_DECL_NSIFRAMEMESSAGEMANAGER
|
||||
NS_DECL_NSIMESSAGELISTENERMANAGER
|
||||
NS_DECL_NSIMESSAGESENDER
|
||||
NS_DECL_NSIMESSAGEBROADCASTER
|
||||
NS_DECL_NSISYNCMESSAGESENDER
|
||||
NS_DECL_NSICONTENTFRAMEMESSAGEMANAGER
|
||||
NS_DECL_NSICHROMEFRAMEMESSAGEMANAGER
|
||||
NS_DECL_NSITREEITEMFRAMEMESSAGEMANAGER
|
||||
NS_DECL_NSIFRAMESCRIPTLOADER
|
||||
|
||||
static nsFrameMessageManager*
|
||||
NewProcessMessageManager(mozilla::dom::ContentParent* aProcess);
|
||||
@ -130,8 +139,15 @@ public:
|
||||
void Disconnect(bool aRemoveFromParent = true);
|
||||
void SetCallbackData(void* aData, bool aLoadScripts = true);
|
||||
void* GetCallbackData() { return mCallbackData; }
|
||||
nsresult SendAsyncMessageInternal(const nsAString& aMessage,
|
||||
const StructuredCloneData& aData);
|
||||
enum ShouldBroadcast { BROADCAST, DONT_BROADCAST };
|
||||
nsresult DispatchAsyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
PRUint8 aArgc,
|
||||
ShouldBroadcast aBroadcast);
|
||||
nsresult DispatchAsyncMessageInternal(const nsAString& aMessage,
|
||||
const StructuredCloneData& aData,
|
||||
ShouldBroadcast aBroadcast);
|
||||
JSContext* GetJSContext() { return mContext; }
|
||||
void SetJSContext(JSContext* aCx) { mContext = aCx; }
|
||||
void RemoveFromParent();
|
||||
@ -157,9 +173,10 @@ protected:
|
||||
friend class MMListenerRemover;
|
||||
nsTArray<nsMessageListenerInfo> mListeners;
|
||||
nsCOMArray<nsIContentFrameMessageManager> mChildManagers;
|
||||
bool mChrome;
|
||||
bool mGlobal;
|
||||
bool mIsProcessManager;
|
||||
bool mChrome; // true if we're in the chrome process
|
||||
bool mGlobal; // true if
|
||||
bool mIsProcessManager; // true if the message manager belongs to the process realm
|
||||
bool mIsBroadcaster; // true if the message manager is a broadcaster
|
||||
bool mHandlingMessage;
|
||||
bool mDisconnected;
|
||||
nsFrameMessageManager* mParentManager;
|
||||
|
@ -126,7 +126,7 @@ nsInProcessTabChildGlobal::Init()
|
||||
InitTabChildGlobal();
|
||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
|
||||
"Couldn't initialize nsInProcessTabChildGlobal");
|
||||
mMessageManager = new nsFrameMessageManager(false,
|
||||
mMessageManager = new nsFrameMessageManager(false, /* aChrome */
|
||||
SendSyncMessageToParent,
|
||||
SendAsyncMessageToParent,
|
||||
nullptr,
|
||||
@ -160,7 +160,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsInProcessTabChildGlobal,
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsInProcessTabChildGlobal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIFrameMessageManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMessageListenerManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMessageSender)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISyncMessageSender)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIContentFrameMessageManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIInProcessContentFrameMessageManager)
|
||||
|
@ -33,7 +33,8 @@ public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsInProcessTabChildGlobal,
|
||||
nsDOMEventTargetHelper)
|
||||
NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager)
|
||||
NS_FORWARD_SAFE_NSIMESSAGELISTENERMANAGER(mMessageManager)
|
||||
NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager)
|
||||
NS_IMETHOD SendSyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
|
@ -13,9 +13,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=549682
|
||||
<script type="application/javascript"><![CDATA[
|
||||
var didRunAsync = false;
|
||||
var didRunLocal = false;
|
||||
var global = Components.classes["@mozilla.org/globalmessagemanager;1"].getService(Components.interfaces.nsIChromeFrameMessageManager);
|
||||
var ppm = Components.classes["@mozilla.org/parentprocessmessagemanager;1"].getService(Components.interfaces.nsIFrameMessageManager);
|
||||
var cpm = Components.classes["@mozilla.org/childprocessmessagemanager;1"].getService(Components.interfaces.nsISyncMessageSender);
|
||||
var global = Components.classes["@mozilla.org/globalmessagemanager;1"]
|
||||
.getService(Components.interfaces.nsIMessageBroadcaster);
|
||||
var ppm = Components.classes["@mozilla.org/parentprocessmessagemanager;1"]
|
||||
.getService(Components.interfaces.nsIMessageBroadcaster);
|
||||
var cpm = Components.classes["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Components.interfaces.nsISyncMessageSender);
|
||||
|
||||
var asyncPPML = false;
|
||||
function ppmASL(m) {
|
||||
@ -36,7 +39,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=549682
|
||||
asyncCPML = true;
|
||||
}
|
||||
cpm.addMessageListener("childprocessmessage", cpmASL);
|
||||
ppm.sendAsyncMessage("childprocessmessage", "");
|
||||
ppm.broadcastAsyncMessage("childprocessmessage", "");
|
||||
|
||||
function checkPMMMessages() {
|
||||
opener.wrappedJSObject.ok(asyncPPML, "should have handled async message");
|
||||
|
@ -30,8 +30,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=616841
|
||||
function recvContentReady(m) {
|
||||
for (var i = 0; i < toCompare.length; ++i) {
|
||||
var pair = toCompare[i];
|
||||
messageManager.sendAsyncMessage("cmp",
|
||||
{ i: i, a: pair[0], b: pair[1] });
|
||||
messageManager.broadcastAsyncMessage("cmp",
|
||||
{ i: i, a: pair[0], b: pair[1] });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,6 @@
|
||||
#include "nsDOMNavigationTiming.h"
|
||||
#include "nsITimedChannel.h"
|
||||
#include "mozilla/StartupTimeline.h"
|
||||
#include "nsIFrameMessageManager.h"
|
||||
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "nsISecurityUITelemetry.h"
|
||||
|
@ -12,10 +12,9 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/IndexedDBHelper.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageBroadcaster");
|
||||
|
||||
const EXPORTED_SYMBOLS = [];
|
||||
|
||||
@ -194,7 +193,7 @@ let Activities = {
|
||||
|
||||
// We have no matching activity registered, let's fire an error.
|
||||
if (aResults.options.length === 0) {
|
||||
ppmm.sendAsyncMessage("Activity:FireError", {
|
||||
ppmm.broadcastAsyncMessage("Activity:FireError", {
|
||||
"id": aMsg.id,
|
||||
"error": "NO_PROVIDER"
|
||||
});
|
||||
@ -206,7 +205,7 @@ let Activities = {
|
||||
|
||||
// The user has cancelled the choice, fire an error.
|
||||
if (aChoice === -1) {
|
||||
ppmm.sendAsyncMessage("Activity:FireError", {
|
||||
ppmm.broadcastAsyncMessage("Activity:FireError", {
|
||||
"id": aMsg.id,
|
||||
"error": "USER_ABORT"
|
||||
});
|
||||
@ -231,7 +230,7 @@ let Activities = {
|
||||
Services.io.newURI(result.manifest, null, null));
|
||||
|
||||
if (!result.description.returnValue) {
|
||||
ppmm.sendAsyncMessage("Activity:FireSuccess", {
|
||||
ppmm.broadcastAsyncMessage("Activity:FireSuccess", {
|
||||
"id": aMsg.id,
|
||||
"result": null
|
||||
});
|
||||
@ -266,7 +265,7 @@ let Activities = {
|
||||
},
|
||||
|
||||
receiveMessage: function activities_receiveMessage(aMessage) {
|
||||
let mm = aMessage.target.QueryInterface(Ci.nsIFrameMessageManager);
|
||||
let mm = aMessage.target;
|
||||
let msg = aMessage.json;
|
||||
switch(aMessage.name) {
|
||||
case "Activity:Start":
|
||||
@ -274,10 +273,10 @@ let Activities = {
|
||||
break;
|
||||
|
||||
case "Activity:PostResult":
|
||||
ppmm.sendAsyncMessage("Activity:FireSuccess", msg);
|
||||
ppmm.broadcastAsyncMessage("Activity:FireSuccess", msg);
|
||||
break;
|
||||
case "Activity:PostError":
|
||||
ppmm.sendAsyncMessage("Activity:FireError", msg);
|
||||
ppmm.broadcastAsyncMessage("Activity:FireError", msg);
|
||||
break;
|
||||
|
||||
case "Activities:Register":
|
||||
|
@ -12,11 +12,9 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIFrameMessageManager)
|
||||
.QueryInterface(Ci.nsISyncMessageSender);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsISyncMessageSender");
|
||||
|
||||
function debug(aMsg) {
|
||||
//dump("-- ActivityProxy " + Date.now() + " : " + aMsg + "\n");
|
||||
|
@ -10,11 +10,9 @@ const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIFrameMessageManager)
|
||||
.QueryInterface(Ci.nsISyncMessageSender);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsISyncMessageSender");
|
||||
|
||||
function debug(aMsg) {
|
||||
//dump("-- ActivityRequestHandler.js " + Date.now() + " : " + aMsg + "\n");
|
||||
|
@ -20,9 +20,9 @@ Cu.import("resource://gre/modules/AlarmDB.jsm");
|
||||
|
||||
let EXPORTED_SYMBOLS = ["AlarmService"];
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageListenerManager");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "messenger", function() {
|
||||
return Cc["@mozilla.org/system-message-internal;1"].getService(Ci.nsISystemMessagesInternal);
|
||||
@ -75,7 +75,7 @@ let AlarmService = {
|
||||
receiveMessage: function receiveMessage(aMessage) {
|
||||
debug("receiveMessage(): " + aMessage.name);
|
||||
|
||||
let mm = aMessage.target.QueryInterface(Ci.nsIFrameMessageManager);
|
||||
let mm = aMessage.target.QueryInterface(Ci.nsIMessageSender);
|
||||
let json = aMessage.json;
|
||||
switch (aMessage.name) {
|
||||
case "AlarmsManager:GetAll":
|
||||
|
@ -26,8 +26,7 @@ function AppsService()
|
||||
Cu.import("resource://gre/modules/Webapps.jsm");
|
||||
} else {
|
||||
this.cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIFrameMessageManager)
|
||||
.QueryInterface(Ci.nsISyncMessageSender);
|
||||
.getService(Ci.nsISyncMessageSender);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,9 +12,9 @@ Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsIMessageSender");
|
||||
|
||||
function convertAppsArray(aApps, aWindow) {
|
||||
let apps = Cu.createArrayIn(aWindow);
|
||||
|
@ -23,14 +23,13 @@ XPCOMUtils.defineLazyGetter(this, "NetUtil", function() {
|
||||
return NetUtil;
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageBroadcaster");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsIFrameMessageManager");
|
||||
"nsIMessageSender");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "msgmgr", function() {
|
||||
return Cc["@mozilla.org/system-message-internal;1"]
|
||||
@ -243,7 +242,7 @@ let DOMApplicationRegistry = {
|
||||
if (msg.hasPrivileges)
|
||||
this.getAll(msg);
|
||||
else
|
||||
ppmm.sendAsyncMessage("Webapps:GetAll:Return:KO", msg);
|
||||
ppmm.broadcastAsyncMessage("Webapps:GetAll:Return:KO", msg);
|
||||
break;
|
||||
case "Webapps:InstallPackage":
|
||||
this.installPackage(msg);
|
||||
@ -307,7 +306,7 @@ let DOMApplicationRegistry = {
|
||||
} catch(e) {
|
||||
}
|
||||
}
|
||||
ppmm.sendAsyncMessage("Webapps:Install:Return:KO", aData);
|
||||
ppmm.broadcastAsyncMessage("Webapps:Install:Return:KO", aData);
|
||||
},
|
||||
|
||||
confirmInstall: function(aData, aFromSync, aProfileDir, aOfflineCacheObserver) {
|
||||
@ -365,7 +364,7 @@ let DOMApplicationRegistry = {
|
||||
|
||||
if (!aFromSync)
|
||||
this._saveApps((function() {
|
||||
ppmm.sendAsyncMessage("Webapps:Install:Return:OK", aData);
|
||||
ppmm.broadcastAsyncMessage("Webapps:Install:Return:OK", aData);
|
||||
Services.obs.notifyObservers(this, "webapps-sync-install", appNote);
|
||||
}).bind(this));
|
||||
|
||||
@ -492,7 +491,7 @@ let DOMApplicationRegistry = {
|
||||
try {
|
||||
dir.remove(true);
|
||||
} catch (e) { }
|
||||
ppmm.sendAsyncMessage("Webapps:Install:Return:KO",
|
||||
ppmm.broadcastAsyncMessage("Webapps:Install:Return:KO",
|
||||
{ oid: aData.oid,
|
||||
requestID: aData.requestID,
|
||||
error: aError });
|
||||
@ -584,13 +583,13 @@ let DOMApplicationRegistry = {
|
||||
delete this.webapps[id];
|
||||
|
||||
this._saveApps((function() {
|
||||
ppmm.sendAsyncMessage("Webapps:Uninstall:Return:OK", aData);
|
||||
ppmm.broadcastAsyncMessage("Webapps:Uninstall:Return:OK", aData);
|
||||
Services.obs.notifyObservers(this, "webapps-sync-uninstall", appNote);
|
||||
}).bind(this));
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
ppmm.sendAsyncMessage("Webapps:Uninstall:Return:KO", aData);
|
||||
ppmm.broadcastAsyncMessage("Webapps:Uninstall:Return:KO", aData);
|
||||
}
|
||||
},
|
||||
|
||||
@ -608,7 +607,7 @@ let DOMApplicationRegistry = {
|
||||
this._readManifests(tmp, (function(aResult) {
|
||||
for (let i = 0; i < aResult.length; i++)
|
||||
aData.apps[i].manifest = aResult[i].manifest;
|
||||
ppmm.sendAsyncMessage("Webapps:GetSelf:Return:OK", aData);
|
||||
ppmm.broadcastAsyncMessage("Webapps:GetSelf:Return:OK", aData);
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
@ -627,7 +626,7 @@ let DOMApplicationRegistry = {
|
||||
this._readManifests(tmp, (function(aResult) {
|
||||
for (let i = 0; i < aResult.length; i++)
|
||||
aData.apps[i].manifest = aResult[i].manifest;
|
||||
ppmm.sendAsyncMessage("Webapps:GetInstalled:Return:OK", aData);
|
||||
ppmm.broadcastAsyncMessage("Webapps:GetInstalled:Return:OK", aData);
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
@ -645,7 +644,7 @@ let DOMApplicationRegistry = {
|
||||
this._readManifests(tmp, (function(aResult) {
|
||||
for (let i = 0; i < aResult.length; i++)
|
||||
aData.apps[i].manifest = aResult[i].manifest;
|
||||
ppmm.sendAsyncMessage("Webapps:GetNotInstalled:Return:OK", aData);
|
||||
ppmm.broadcastAsyncMessage("Webapps:GetNotInstalled:Return:OK", aData);
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
@ -665,7 +664,7 @@ let DOMApplicationRegistry = {
|
||||
this._readManifests(tmp, (function(aResult) {
|
||||
for (let i = 0; i < aResult.length; i++)
|
||||
aData.apps[i].manifest = aResult[i].manifest;
|
||||
ppmm.sendAsyncMessage("Webapps:GetAll:Return:OK", aData);
|
||||
ppmm.broadcastAsyncMessage("Webapps:GetAll:Return:OK", aData);
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
@ -783,7 +782,7 @@ let DOMApplicationRegistry = {
|
||||
dir.remove(true);
|
||||
} catch (e) {
|
||||
}
|
||||
ppmm.sendAsyncMessage("Webapps:Uninstall:Return:OK", { origin: origin });
|
||||
ppmm.broadcastAsyncMessage("Webapps:Uninstall:Return:OK", { origin: origin });
|
||||
} else {
|
||||
if (this.webapps[record.id]) {
|
||||
this.webapps[record.id] = record.value;
|
||||
@ -791,7 +790,7 @@ let DOMApplicationRegistry = {
|
||||
} else {
|
||||
let data = { app: record.value };
|
||||
this.confirmInstall(data, true);
|
||||
ppmm.sendAsyncMessage("Webapps:Install:Return:OK", data);
|
||||
ppmm.broadcastAsyncMessage("Webapps:Install:Return:OK", data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -893,7 +892,7 @@ AppcacheObserver.prototype = {
|
||||
let setStatus = function appObs_setStatus(aStatus) {
|
||||
mustSave = (app.status != aStatus);
|
||||
app.status = aStatus;
|
||||
ppmm.sendAsyncMessage("Webapps:OfflineCache", { manifest: app.manifestURL, status: aStatus });
|
||||
ppmm.broadcastAsyncMessage("Webapps:OfflineCache", { manifest: app.manifestURL, status: aStatus });
|
||||
}
|
||||
|
||||
switch (aState) {
|
||||
|
@ -15,9 +15,9 @@ let EXPORTED_SYMBOLS = ["DOMRequestIpcHelper"];
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsIMessageListenerManager");
|
||||
|
||||
function DOMRequestIpcHelper() {
|
||||
}
|
||||
|
@ -461,7 +461,7 @@
|
||||
#include "nsIDOMMozTouchEvent.h"
|
||||
|
||||
#include "nsIEventListenerService.h"
|
||||
#include "nsIFrameMessageManager.h"
|
||||
#include "nsIMessageManager.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsHTMLSelectElement.h"
|
||||
#include "nsHTMLLegendElement.h"
|
||||
@ -640,6 +640,8 @@ DOMCI_DATA_NO_CLASS(Crypto)
|
||||
DOMCI_DATA_NO_CLASS(CRMFObject)
|
||||
DOMCI_DATA_NO_CLASS(SmartCardEvent)
|
||||
DOMCI_DATA_NO_CLASS(ContentFrameMessageManager)
|
||||
DOMCI_DATA_NO_CLASS(ChromeMessageBroadcaster)
|
||||
DOMCI_DATA_NO_CLASS(ChromeMessageSender)
|
||||
|
||||
DOMCI_DATA_NO_CLASS(DOMPrototype)
|
||||
DOMCI_DATA_NO_CLASS(DOMConstructor)
|
||||
@ -1595,8 +1597,13 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(AnimationEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(ContentFrameMessageManager, nsEventTargetSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS | nsIXPCScriptable::IS_GLOBAL_OBJECT)
|
||||
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentFrameMessageManager, nsEventTargetSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::IS_GLOBAL_OBJECT)
|
||||
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ChromeMessageBroadcaster, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ChromeMessageSender, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(FormData, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
@ -4305,13 +4312,26 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ContentFrameMessageManager, nsIContentFrameMessageManager)
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ContentFrameMessageManager, nsISupports)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIFrameMessageManager)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageListenerManager)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageSender)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsISyncMessageSender)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIContentFrameMessageManager)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ChromeMessageBroadcaster, nsISupports)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIFrameScriptLoader)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageListenerManager)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageBroadcaster)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ChromeMessageSender, nsISupports)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIFrameScriptLoader)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageListenerManager)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIMessageSender)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(FormData, nsIDOMFormData)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMFormData)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
@ -475,6 +475,8 @@ DOMCI_CLASS(TransitionEvent)
|
||||
DOMCI_CLASS(AnimationEvent)
|
||||
|
||||
DOMCI_CLASS(ContentFrameMessageManager)
|
||||
DOMCI_CLASS(ChromeMessageBroadcaster)
|
||||
DOMCI_CLASS(ChromeMessageSender)
|
||||
|
||||
DOMCI_CLASS(FormData)
|
||||
|
||||
|
@ -10957,7 +10957,7 @@ nsGlobalChromeWindow::NotifyDefaultButtonLoaded(nsIDOMElement* aDefaultButton)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalChromeWindow::GetMessageManager(nsIChromeFrameMessageManager** aManager)
|
||||
nsGlobalChromeWindow::GetMessageManager(nsIMessageBroadcaster** aManager)
|
||||
{
|
||||
FORWARD_TO_INNER_CHROME(GetMessageManager, (aManager), NS_ERROR_FAILURE);
|
||||
if (!mMessageManager) {
|
||||
@ -10965,16 +10965,19 @@ nsGlobalChromeWindow::GetMessageManager(nsIChromeFrameMessageManager** aManager)
|
||||
NS_ENSURE_STATE(scx);
|
||||
JSContext* cx = scx->GetNativeContext();
|
||||
NS_ENSURE_STATE(cx);
|
||||
nsCOMPtr<nsIChromeFrameMessageManager> globalMM =
|
||||
nsCOMPtr<nsIMessageBroadcaster> globalMM =
|
||||
do_GetService("@mozilla.org/globalmessagemanager;1");
|
||||
mMessageManager =
|
||||
new nsFrameMessageManager(true,
|
||||
new nsFrameMessageManager(true, /* aChrome */
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
static_cast<nsFrameMessageManager*>(globalMM.get()),
|
||||
cx);
|
||||
cx,
|
||||
false, /* aGlobal */
|
||||
false, /* aProcessManager */
|
||||
true /* aBroadcaster */);
|
||||
NS_ENSURE_TRUE(mMessageManager, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
CallQueryInterface(mMessageManager, aManager);
|
||||
|
@ -1135,7 +1135,7 @@ public:
|
||||
nsGlobalWindow)
|
||||
|
||||
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
|
||||
nsCOMPtr<nsIChromeFrameMessageManager> mMessageManager;
|
||||
nsCOMPtr<nsIMessageBroadcaster> mMessageManager;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -19,9 +19,9 @@ XPCOMUtils.defineLazyGetter(Services, "DOMRequest", function() {
|
||||
return Cc["@mozilla.org/dom/dom-request-service;1"].getService(Ci.nsIDOMRequestService);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsIMessageSender");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "mRIL", function () {
|
||||
return Cc["@mozilla.org/telephony/system-worker-manager;1"].getService(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIRadioInterfaceLayer);
|
||||
|
@ -17,9 +17,9 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/ContactDB.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageListenerManager");
|
||||
|
||||
let myGlobal = this;
|
||||
|
||||
@ -54,7 +54,7 @@ let DOMContactManager = {
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
if (DEBUG) debug("Fallback DOMContactManager::receiveMessage " + aMessage.name);
|
||||
let mm = aMessage.target.QueryInterface(Ci.nsIFrameMessageManager);
|
||||
let mm = aMessage.target;
|
||||
let msg = aMessage.data;
|
||||
|
||||
/*
|
||||
|
@ -100,7 +100,7 @@
|
||||
|
||||
let spObserver =
|
||||
comp.classes["@mozilla.org/special-powers-observer;1"]
|
||||
.getService(comp.interfaces.nsIFrameMessageListener);
|
||||
.getService(comp.interfaces.nsIMessageListener);
|
||||
|
||||
mm.addMessageListener("SPPrefService", spObserver);
|
||||
mm.addMessageListener("SPProcessCrashService", spObserver);
|
||||
|
@ -116,7 +116,7 @@ RPWatchContext.prototype = {
|
||||
};
|
||||
|
||||
let DOMIdentity = {
|
||||
// nsIFrameMessageListener
|
||||
// nsIMessageListener
|
||||
receiveMessage: function DOMIdentity_receiveMessage(aMessage) {
|
||||
let msg = aMessage.json;
|
||||
|
||||
@ -200,7 +200,7 @@ let DOMIdentity = {
|
||||
: "removeMessageListener"];
|
||||
|
||||
for (let message of this.messages) {
|
||||
func(message, this);
|
||||
func.call(aWindow.messageManager, message, this);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -420,7 +420,7 @@ function nsDOMIdentityInternal() {
|
||||
}
|
||||
nsDOMIdentityInternal.prototype = {
|
||||
|
||||
// nsIFrameMessageListener
|
||||
// nsIMessageListener
|
||||
receiveMessage: function nsDOMIdentityInternal_receiveMessage(aMessage) {
|
||||
let msg = aMessage.json;
|
||||
// Is this message intended for this window?
|
||||
@ -515,7 +515,7 @@ nsDOMIdentityInternal.prototype = {
|
||||
classID: Components.ID("{8bcac6a3-56a4-43a4-a44c-cdf42763002f}"),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI(
|
||||
[Ci.nsIDOMGlobalPropertyInitializer, Ci.nsIFrameMessageListener]
|
||||
[Ci.nsIDOMGlobalPropertyInitializer, Ci.nsIMessageListener]
|
||||
),
|
||||
|
||||
classInfo: XPCOMUtils.generateCI({
|
||||
|
@ -114,7 +114,7 @@
|
||||
|
||||
let spObserver =
|
||||
comp.classes["@mozilla.org/special-powers-observer;1"]
|
||||
.getService(comp.interfaces.nsIFrameMessageListener);
|
||||
.getService(comp.interfaces.nsIMessageListener);
|
||||
|
||||
mm.addMessageListener("SPPrefService", spObserver);
|
||||
mm.addMessageListener("SPProcessCrashService", spObserver);
|
||||
|
@ -8,9 +8,9 @@
|
||||
interface nsIBrowserDOMWindow;
|
||||
interface nsIDOMElement;
|
||||
interface nsIDOMEvent;
|
||||
interface nsIChromeFrameMessageManager;
|
||||
interface nsIMessageBroadcaster;
|
||||
|
||||
[scriptable, uuid(7cfbc355-cbf9-4408-8e4c-a3c603ff1428)]
|
||||
[scriptable, uuid(6ff5df67-22da-4379-bf57-da775dad19f8)]
|
||||
interface nsIDOMChromeWindow : nsISupports
|
||||
{
|
||||
const unsigned short STATE_MAXIMIZED = 1;
|
||||
@ -43,7 +43,7 @@ interface nsIDOMChromeWindow : nsISupports
|
||||
*/
|
||||
void notifyDefaultButtonLoaded(in nsIDOMElement defaultButton);
|
||||
|
||||
readonly attribute nsIChromeFrameMessageManager messageManager;
|
||||
readonly attribute nsIMessageBroadcaster messageManager;
|
||||
|
||||
/**
|
||||
* On some operating systems, we must allow the window manager to
|
||||
|
@ -1372,7 +1372,7 @@ void
|
||||
TabChildGlobal::Init()
|
||||
{
|
||||
NS_ASSERTION(!mMessageManager, "Re-initializing?!?");
|
||||
mMessageManager = new nsFrameMessageManager(false,
|
||||
mMessageManager = new nsFrameMessageManager(false, /* aChrome */
|
||||
SendSyncMessageToParent,
|
||||
SendAsyncMessageToParent,
|
||||
nullptr,
|
||||
@ -1394,7 +1394,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(TabChildGlobal,
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TabChildGlobal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIFrameMessageManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMessageListenerManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMessageSender)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISyncMessageSender)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIContentFrameMessageManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIScriptContextPrincipal)
|
||||
|
@ -72,7 +72,8 @@ public:
|
||||
void Init();
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, nsDOMEventTargetHelper)
|
||||
NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager)
|
||||
NS_FORWARD_SAFE_NSIMESSAGELISTENERMANAGER(mMessageManager)
|
||||
NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager)
|
||||
NS_IMETHOD SendSyncMessage(const nsAString& aMessageName,
|
||||
const jsval& aObject,
|
||||
JSContext* aCx,
|
||||
|
@ -97,17 +97,16 @@
|
||||
// 1. Test that loading a script works, and that accessing process level mm and
|
||||
// global mm works.
|
||||
var ppm = Components.classes["@mozilla.org/parentprocessmessagemanager;1"]
|
||||
.getService(Components.interfaces.nsIFrameMessageManager);
|
||||
.getService(Components.interfaces.nsIMessageBroadcaster);
|
||||
var gm = Components.classes["@mozilla.org/globalmessagemanager;1"]
|
||||
.getService(Components.interfaces.nsIChromeFrameMessageManager);
|
||||
.getService(Components.interfaces.nsIMessageBroadcaster);
|
||||
var cpm = Components.classes["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Components.interfaces.nsISyncMessageSender);
|
||||
.getService(Components.interfaces.nsISyncMessageSender);
|
||||
|
||||
var tppm = ppm.QueryInterface(Components.interfaces.nsITreeItemFrameMessageManager);
|
||||
if (tppm.childCount != 2) {
|
||||
if (ppm.childCount != 2) {
|
||||
alert("Should have two child processes!");
|
||||
}
|
||||
var childprocessmm = tppm.getChildAt(1); // 0 is the in-process child process mm
|
||||
var childprocessmm = ppm.getChildAt(1); // 0 is the in-process child process mm
|
||||
|
||||
childprocessmm.addMessageListener("ppm-sync",
|
||||
function(m) {
|
||||
@ -161,7 +160,7 @@
|
||||
receiveMessage: function(m) {
|
||||
var s = (m.json.message == "linkclick-received") &&
|
||||
(this.foobarObjectVar) ? "PASS" : "FAIL";
|
||||
messageManager.sendAsyncMessage("chrome-message", { ok : s } );
|
||||
messageManager.broadcastAsyncMessage("chrome-message", { ok : s } );
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -197,7 +196,7 @@
|
||||
function messageSpeed() {
|
||||
speedTestCount = 0;
|
||||
messageManager.addMessageListener("speed-test", speedHandler);
|
||||
messageManager.sendAsyncMessage("speed-test-start");
|
||||
messageManager.broadcastAsyncMessage("speed-test-start");
|
||||
}
|
||||
|
||||
function speedHandler() {
|
||||
@ -217,7 +216,7 @@
|
||||
if (++addRemoveTestCount == 1) {
|
||||
alert("Expected echo message");
|
||||
messageManager.removeMessageListener("async-echo", echoListener);
|
||||
messageManager.sendAsyncMessage("async-echo");
|
||||
messageManager.broadcastAsyncMessage("async-echo");
|
||||
return;
|
||||
}
|
||||
alert("Unexpected echo message");
|
||||
@ -226,7 +225,7 @@
|
||||
function listenerAddRemove() {
|
||||
addRemoveTestCount = 0;
|
||||
messageManager.addMessageListener("async-echo", echoListener);
|
||||
messageManager.sendAsyncMessage("async-echo");
|
||||
messageManager.broadcastAsyncMessage("async-echo");
|
||||
}
|
||||
|
||||
var MozAfterPaintCount = 0;
|
||||
@ -286,8 +285,10 @@
|
||||
</toolbar>
|
||||
<toolbar><label value="Load a script (URL) to content process:"/>
|
||||
<textbox flex="1" id="script"/><button
|
||||
label="send" oncommand="document.getElementById('page').QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader.
|
||||
messageManager.loadFrameScript(this.previousSibling.value, false);"/>
|
||||
label="send" oncommand="document.getElementById('page')
|
||||
.QueryInterface(Components.interfaces.nsIFrameLoaderOwner)
|
||||
.frameLoader.messageManager
|
||||
.loadFrameScript(this.previousSibling.value, false);"/>
|
||||
</toolbar>
|
||||
<toolbar>
|
||||
<label value="Eval script in chrome context"/>
|
||||
|
@ -49,9 +49,10 @@
|
||||
}
|
||||
Services.obs.addObserver(crashObserver, 'ipc:content-shutdown', false);
|
||||
|
||||
document.getElementById('thebrowser').
|
||||
QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader.
|
||||
messageManager.loadFrameScript('chrome://mochitests/content/chrome/dom/ipc/tests/process_error_contentscript.js', true);
|
||||
document.getElementById('thebrowser')
|
||||
.QueryInterface(Components.interfaces.nsIFrameLoaderOwner)
|
||||
.frameLoader.messageManager
|
||||
.loadFrameScript('chrome://mochitests/content/chrome/dom/ipc/tests/process_error_contentscript.js', true);
|
||||
]]></script>
|
||||
|
||||
</window>
|
||||
|
@ -12,9 +12,9 @@ const Cr = Components.results;
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageBroadcaster");
|
||||
|
||||
// Limit the number of pending messages for a given page.
|
||||
let kMaxPendingMessages;
|
||||
@ -42,9 +42,9 @@ function SystemMessageInternal() {
|
||||
SystemMessageInternal.prototype = {
|
||||
sendMessage: function sendMessage(aType, aMessage, aPageURI, aManifestURI) {
|
||||
debug("Broadcasting " + aType + " " + JSON.stringify(aMessage));
|
||||
ppmm.sendAsyncMessage("SystemMessageManager:Message" , { type: aType,
|
||||
msg: aMessage,
|
||||
manifest: aManifestURI.spec });
|
||||
ppmm.broadcastAsyncMessage("SystemMessageManager:Message" , { type: aType,
|
||||
msg: aMessage,
|
||||
manifest: aManifestURI.spec });
|
||||
|
||||
// Queue the message for pages that registered an handler for this type.
|
||||
this._pages.forEach(function sendMess_openPage(aPage) {
|
||||
|
@ -13,11 +13,9 @@ Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/ObjectWrapper.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIFrameMessageManager)
|
||||
.QueryInterface(Ci.nsISyncMessageSender);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsISyncMessageSender");
|
||||
|
||||
// Limit the number of pending messages for a given type.
|
||||
let kMaxPendingMessages;
|
||||
|
@ -34,9 +34,9 @@ let EXPORTED_SYMBOLS = ["PermissionPromptHelper"];
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageListenerManager");
|
||||
|
||||
var permissionManager = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager);
|
||||
var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
|
||||
@ -77,7 +77,7 @@ let PermissionPromptHelper = {
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
debug("PermissionPromptHelper::receiveMessage " + aMessage.name);
|
||||
let mm = aMessage.target.QueryInterface(Ci.nsIFrameMessageManager);
|
||||
let mm = aMessage.target;
|
||||
let msg = aMessage.data;
|
||||
|
||||
let result;
|
||||
|
@ -17,9 +17,9 @@ let EXPORTED_SYMBOLS = ["SettingsChangeNotifier"];
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageBroadcaster");
|
||||
|
||||
|
||||
let SettingsChangeNotifier = {
|
||||
@ -41,7 +41,7 @@ let SettingsChangeNotifier = {
|
||||
let msg = aMessage.json;
|
||||
switch (aMessage.name) {
|
||||
case "Settings:Changed":
|
||||
ppmm.sendAsyncMessage("Settings:Change:Return:OK", { key: msg.key, value: msg.value });
|
||||
ppmm.broadcastAsyncMessage("Settings:Change:Return:OK", { key: msg.key, value: msg.value });
|
||||
Services.obs.notifyObservers(this, "mozsettings-changed", JSON.stringify({
|
||||
key: msg.key,
|
||||
value: msg.value
|
||||
|
@ -17,9 +17,9 @@ Cu.import("resource://gre/modules/SettingsDB.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsIMessageSender");
|
||||
|
||||
const nsIClassInfo = Ci.nsIClassInfo;
|
||||
const SETTINGSLOCK_CONTRACTID = "@mozilla.org/settingsLock;1";
|
||||
|
@ -66,7 +66,7 @@ const kUssdReceivedTopic = "mobile-connection-ussd-received";
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsIFrameMessageManager");
|
||||
"nsISyncMessageSender");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "gUUIDGenerator",
|
||||
"@mozilla.org/uuid-generator;1",
|
||||
@ -161,8 +161,7 @@ function RILContentHelper() {
|
||||
Services.obs.addObserver(this, "xpcom-shutdown", false);
|
||||
|
||||
// Request initial context.
|
||||
let rilContext = cpmm.QueryInterface(Ci.nsISyncMessageSender)
|
||||
.sendSyncMessage("RIL:GetRilContext")[0];
|
||||
let rilContext = cpmm.sendSyncMessage("RIL:GetRilContext")[0];
|
||||
|
||||
if (!rilContext) {
|
||||
debug("Received null rilContext from chrome process.");
|
||||
@ -508,7 +507,7 @@ RILContentHelper.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
// nsIFrameMessageListener
|
||||
// nsIMessageListener
|
||||
|
||||
fireRequestSuccess: function fireRequestSuccess(requestId, result) {
|
||||
let request = this.takeRequest(requestId);
|
||||
|
@ -79,7 +79,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "gSmsDatabaseService",
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIFrameMessageManager");
|
||||
"nsIMessageBroadcaster");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "gSettingsService",
|
||||
"@mozilla.org/settingsService;1",
|
||||
@ -376,7 +376,7 @@ RadioInterfaceLayer.prototype = {
|
||||
break;
|
||||
case "cardstatechange":
|
||||
this.rilContext.cardState = message.cardState;
|
||||
ppmm.sendAsyncMessage("RIL:CardStateChanged", message);
|
||||
ppmm.broadcastAsyncMessage("RIL:CardStateChanged", message);
|
||||
break;
|
||||
case "sms-received":
|
||||
this.handleSmsReceived(message);
|
||||
@ -428,7 +428,7 @@ RadioInterfaceLayer.prototype = {
|
||||
}
|
||||
break;
|
||||
case "iccmbdn":
|
||||
ppmm.sendAsyncMessage("RIL:VoicemailNumberChanged", message);
|
||||
ppmm.broadcastAsyncMessage("RIL:VoicemailNumberChanged", message);
|
||||
break;
|
||||
case "ussdreceived":
|
||||
debug("ussdreceived " + JSON.stringify(message));
|
||||
@ -454,8 +454,7 @@ RadioInterfaceLayer.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
let mm = msg.target.QueryInterface(Ci.nsIFrameMessageManager);
|
||||
this._messageManagerByRequest[requestId] = mm;
|
||||
this._messageManagerByRequest[requestId] = msg.target;
|
||||
},
|
||||
|
||||
_sendRequestResults: function _sendRequestResults(requestType, options) {
|
||||
@ -466,7 +465,7 @@ RadioInterfaceLayer.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
target.sendAsyncMessage(requestType, options);
|
||||
target.syncAsyncMessage(requestType, options);
|
||||
},
|
||||
|
||||
updateNetworkInfo: function updateNetworkInfo(message) {
|
||||
@ -499,10 +498,10 @@ RadioInterfaceLayer.prototype = {
|
||||
}
|
||||
|
||||
if (voiceMessage || operatorMessage) {
|
||||
ppmm.sendAsyncMessage("RIL:VoiceInfoChanged", voice);
|
||||
ppmm.broadcastAsyncMessage("RIL:VoiceInfoChanged", voice);
|
||||
}
|
||||
if (dataMessage || operatorMessage) {
|
||||
ppmm.sendAsyncMessage("RIL:DataInfoChanged", data);
|
||||
ppmm.broadcastAsyncMessage("RIL:DataInfoChanged", data);
|
||||
}
|
||||
|
||||
if (selectionMessage) {
|
||||
@ -544,7 +543,7 @@ RadioInterfaceLayer.prototype = {
|
||||
}
|
||||
|
||||
if (!newInfo.batch) {
|
||||
ppmm.sendAsyncMessage("RIL:VoiceInfoChanged", voiceInfo);
|
||||
ppmm.broadcastAsyncMessage("RIL:VoiceInfoChanged", voiceInfo);
|
||||
}
|
||||
},
|
||||
|
||||
@ -574,7 +573,7 @@ RadioInterfaceLayer.prototype = {
|
||||
}
|
||||
|
||||
if (!newInfo.batch) {
|
||||
ppmm.sendAsyncMessage("RIL:DataInfoChanged", dataInfo);
|
||||
ppmm.broadcastAsyncMessage("RIL:DataInfoChanged", dataInfo);
|
||||
}
|
||||
|
||||
if (!this.dataCallSettings["enabled"]) {
|
||||
@ -600,7 +599,7 @@ RadioInterfaceLayer.prototype = {
|
||||
voiceInfo.relSignalStrength != message.gsmRelative) {
|
||||
voiceInfo.signalStrength = message.gsmDBM;
|
||||
voiceInfo.relSignalStrength = message.gsmRelative;
|
||||
ppmm.sendAsyncMessage("RIL:VoiceInfoChanged", voiceInfo);
|
||||
ppmm.broadcastAsyncMessage("RIL:VoiceInfoChanged", voiceInfo);
|
||||
}
|
||||
|
||||
let dataInfo = this.rilContext.data;
|
||||
@ -608,7 +607,7 @@ RadioInterfaceLayer.prototype = {
|
||||
dataInfo.relSignalStrength != message.gsmRelative) {
|
||||
dataInfo.signalStrength = message.gsmDBM;
|
||||
dataInfo.relSignalStrength = message.gsmRelative;
|
||||
ppmm.sendAsyncMessage("RIL:DataInfoChanged", dataInfo);
|
||||
ppmm.broadcastAsyncMessage("RIL:DataInfoChanged", dataInfo);
|
||||
}
|
||||
},
|
||||
|
||||
@ -626,12 +625,12 @@ RadioInterfaceLayer.prototype = {
|
||||
|
||||
if (this.networkChanged(message, voice.network)) {
|
||||
voice.network = message;
|
||||
ppmm.sendAsyncMessage("RIL:VoiceInfoChanged", voice);
|
||||
ppmm.broadcastAsyncMessage("RIL:VoiceInfoChanged", voice);
|
||||
}
|
||||
|
||||
if (this.networkChanged(message, data.network)) {
|
||||
data.network = message;
|
||||
ppmm.sendAsyncMessage("RIL:DataInfoChanged", data);
|
||||
ppmm.broadcastAsyncMessage("RIL:DataInfoChanged", data);
|
||||
}
|
||||
},
|
||||
|
||||
@ -748,7 +747,7 @@ RadioInterfaceLayer.prototype = {
|
||||
this._activeCall = null;
|
||||
}
|
||||
this.updateCallAudioState();
|
||||
ppmm.sendAsyncMessage("RIL:CallStateChanged", call);
|
||||
ppmm.broadcastAsyncMessage("RIL:CallStateChanged", call);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -761,7 +760,7 @@ RadioInterfaceLayer.prototype = {
|
||||
}
|
||||
this.updateCallAudioState();
|
||||
call.state = nsIRadioInterfaceLayer.CALL_STATE_DISCONNECTED;
|
||||
ppmm.sendAsyncMessage("RIL:CallStateChanged", call);
|
||||
ppmm.broadcastAsyncMessage("RIL:CallStateChanged", call);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -789,7 +788,7 @@ RadioInterfaceLayer.prototype = {
|
||||
*/
|
||||
updateNetworkSelectionMode: function updateNetworkSelectionMode(message) {
|
||||
debug("updateNetworkSelectionMode: " + JSON.stringify(message));
|
||||
ppmm.sendAsyncMessage("RIL:NetworkSelectionModeChanged", message);
|
||||
ppmm.broadcastAsyncMessage("RIL:NetworkSelectionModeChanged", message);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -812,7 +811,7 @@ RadioInterfaceLayer.prototype = {
|
||||
* Handle call error.
|
||||
*/
|
||||
handleCallError: function handleCallError(message) {
|
||||
ppmm.sendAsyncMessage("RIL:CallError", message);
|
||||
ppmm.broadcastAsyncMessage("RIL:CallError", message);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -873,7 +872,7 @@ RadioInterfaceLayer.prototype = {
|
||||
if (mwi) {
|
||||
mwi.returnNumber = message.sender || null;
|
||||
mwi.returnMessage = message.fullBody || null;
|
||||
ppmm.sendAsyncMessage("RIL:VoicemailNotification", mwi);
|
||||
ppmm.broadcastAsyncMessage("RIL:VoicemailNotification", mwi);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -975,7 +974,7 @@ RadioInterfaceLayer.prototype = {
|
||||
|
||||
if (datacall.ifname) {
|
||||
data.connected = (datacall.state == RIL.GECKO_NETWORK_STATE_CONNECTED);
|
||||
ppmm.sendAsyncMessage("RIL:DataInfoChanged", data);
|
||||
ppmm.broadcastAsyncMessage("RIL:DataInfoChanged", data);
|
||||
}
|
||||
|
||||
this._deliverDataCallCallback("dataCallStateChanged",
|
||||
@ -996,7 +995,7 @@ RadioInterfaceLayer.prototype = {
|
||||
|
||||
handleUSSDReceived: function handleUSSDReceived(ussd) {
|
||||
debug("handleUSSDReceived " + JSON.stringify(ussd));
|
||||
ppmm.sendAsyncMessage("RIL:UssdReceived", ussd);
|
||||
ppmm.broadcastAsyncMessage("RIL:UssdReceived", ussd);
|
||||
},
|
||||
|
||||
handleSendUSSD: function handleSendUSSD(message) {
|
||||
|
@ -296,7 +296,6 @@ var interfaceNamesInGlobalScope =
|
||||
"SVGPathSegLinetoHorizontalAbs",
|
||||
"SVGAnimatedRect",
|
||||
"SVGTextContentElement",
|
||||
"SyncMessageSender",
|
||||
"WebGLRenderbuffer",
|
||||
"TreeColumn",
|
||||
"WebGLExtensionStandardDerivatives",
|
||||
@ -402,7 +401,6 @@ var interfaceNamesInGlobalScope =
|
||||
"SVGStyleElement",
|
||||
"XULContainerElement",
|
||||
"DOMTokenList",
|
||||
"FrameMessageManager",
|
||||
"HTMLHRElement",
|
||||
"HTMLFontElement",
|
||||
"SVGFEFloodElement",
|
||||
@ -490,7 +488,6 @@ var interfaceNamesInGlobalScope =
|
||||
"MutationObserver",
|
||||
"RequestService",
|
||||
"Counter",
|
||||
"ContentFrameMessageManager",
|
||||
"SVGAnimatedAngle",
|
||||
"SVGPathSegList",
|
||||
"SVGFEFuncAElement",
|
||||
|
@ -1326,7 +1326,8 @@ let netFromDOM;
|
||||
function WifiWorker() {
|
||||
var self = this;
|
||||
|
||||
this._mm = Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
this._mm = Cc["@mozilla.org/parentprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIMessageListenerManager);
|
||||
const messages = ["WifiManager:setEnabled", "WifiManager:getNetworks",
|
||||
"WifiManager:associate", "WifiManager:forget",
|
||||
"WifiManager:wps", "WifiManager:getState",
|
||||
@ -1889,7 +1890,7 @@ WifiWorker.prototype = {
|
||||
|
||||
receiveMessage: function MessageManager_receiveMessage(aMessage) {
|
||||
let msg = aMessage.json || {};
|
||||
msg.manager = aMessage.target.QueryInterface(Ci.nsIFrameMessageManager);
|
||||
msg.manager = aMessage.target;
|
||||
|
||||
switch (aMessage.name) {
|
||||
case "WifiManager:setEnabled":
|
||||
|
@ -27,7 +27,7 @@ function run_test() {
|
||||
pm.addFromPrincipal(getPrincipalForURI("http://mozilla.net"), "cookie3", pm.ALLOW_ACTION, pm.EXPIRE_TIME, Date.now() + 1000*60*60*24);
|
||||
|
||||
var mM = Cc["@mozilla.org/parentprocessmessagemanager;1"].
|
||||
getService(Ci.nsIFrameMessageManager);
|
||||
getService(Ci.nsIMessageBroadcaster);
|
||||
|
||||
var messageListener = {
|
||||
receiveMessage: function(aMessage) {
|
||||
@ -37,7 +37,7 @@ function run_test() {
|
||||
pm.addFromPrincipal(getPrincipalForURI("http://firefox.org"), "cookie1", pm.ALLOW_ACTION, pm.EXPIRE_NEVER, 0);
|
||||
pm.addFromPrincipal(getPrincipalForURI("http://firefox.com"), "cookie2", pm.DENY_ACTION, pm.EXPIRE_SESSION, 0);
|
||||
pm.addFromPrincipal(getPrincipalForURI("http://firefox.net"), "cookie3", pm.ALLOW_ACTION, pm.EXPIRE_TIME, Date.now() + 1000*60*60*24);
|
||||
mM.sendAsyncMessage("TESTING:Stage2A");
|
||||
mM.broadcastAsyncMessage("TESTING:Stage2A");
|
||||
break;
|
||||
|
||||
case "TESTING:Stage3":
|
||||
|
@ -58,7 +58,7 @@
|
||||
#include "nsTransitionManager.h"
|
||||
#include "nsAnimationManager.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIFrameMessageManager.h"
|
||||
#include "nsIMessageManager.h"
|
||||
#include "FrameLayerBuilder.h"
|
||||
#include "nsDOMMediaQueryList.h"
|
||||
#include "nsSMILAnimationController.h"
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
#include "nsIEventListenerService.h"
|
||||
#include "nsIFrameMessageManager.h"
|
||||
#include "nsIMessageManager.h"
|
||||
|
||||
// Transformiix stuff
|
||||
#include "nsXPathEvaluator.h"
|
||||
@ -422,8 +422,8 @@ nsresult NS_NewTextEncoder(nsIDocumentEncoder** aResult);
|
||||
nsresult NS_NewContentPolicy(nsIContentPolicy** aResult);
|
||||
|
||||
nsresult NS_NewEventListenerService(nsIEventListenerService** aResult);
|
||||
nsresult NS_NewGlobalMessageManager(nsIChromeFrameMessageManager** aResult);
|
||||
nsresult NS_NewParentProcessMessageManager(nsIFrameMessageManager** aResult);
|
||||
nsresult NS_NewGlobalMessageManager(nsIMessageBroadcaster** aResult);
|
||||
nsresult NS_NewParentProcessMessageManager(nsIMessageBroadcaster** aResult);
|
||||
nsresult NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult);
|
||||
|
||||
nsresult NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult);
|
||||
@ -519,9 +519,9 @@ MAKE_CTOR(CreateXMLContentBuilder, nsIXMLContentBuilder, NS_NewXML
|
||||
#endif
|
||||
MAKE_CTOR(CreateContentDLF, nsIDocumentLoaderFactory, NS_NewContentDocumentLoaderFactory)
|
||||
MAKE_CTOR(CreateEventListenerService, nsIEventListenerService, NS_NewEventListenerService)
|
||||
MAKE_CTOR(CreateGlobalMessageManager, nsIChromeFrameMessageManager,NS_NewGlobalMessageManager)
|
||||
MAKE_CTOR(CreateParentMessageManager, nsIFrameMessageManager,NS_NewParentProcessMessageManager)
|
||||
MAKE_CTOR(CreateChildMessageManager, nsISyncMessageSender,NS_NewChildProcessMessageManager)
|
||||
MAKE_CTOR(CreateGlobalMessageManager, nsIMessageBroadcaster, NS_NewGlobalMessageManager)
|
||||
MAKE_CTOR(CreateParentMessageManager, nsIMessageBroadcaster, NS_NewParentProcessMessageManager)
|
||||
MAKE_CTOR(CreateChildMessageManager, nsISyncMessageSender, NS_NewChildProcessMessageManager)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDataDocumentContentPolicy)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsNoDataProtocolContentPolicy)
|
||||
MAKE_CTOR(CreatePluginDocument, nsIDocument, NS_NewPluginDocument)
|
||||
|
@ -36,29 +36,29 @@ function loadURL(url) {
|
||||
}
|
||||
|
||||
function scrollContentBy(dx, dy) {
|
||||
messageManager.sendAsyncMessage("scrollBy",
|
||||
{ dx: dx, dy: dy });
|
||||
messageManager.broadcastAsyncMessage("scrollBy",
|
||||
{ dx: dx, dy: dy });
|
||||
|
||||
}
|
||||
|
||||
function scrollContentTo(x, y) {
|
||||
messageManager.sendAsyncMessage("scrollTo",
|
||||
{ x: x, y: y });
|
||||
messageManager.broadcastAsyncMessage("scrollTo",
|
||||
{ x: x, y: y });
|
||||
}
|
||||
|
||||
function setContentViewport(w, h) {
|
||||
messageManager.sendAsyncMessage("setViewport",
|
||||
{ w: w, h: h });
|
||||
messageManager.broadcastAsyncMessage("setViewport",
|
||||
{ w: w, h: h });
|
||||
}
|
||||
|
||||
function setContentDisplayPort(x, y, w, h) {
|
||||
messageManager.sendAsyncMessage("setDisplayPort",
|
||||
{ x: x, y: y, w: w, h: h });
|
||||
messageManager.broadcastAsyncMessage("setDisplayPort",
|
||||
{ x: x, y: y, w: w, h: h });
|
||||
}
|
||||
|
||||
function setContentResolution(xres, yres) {
|
||||
messageManager.sendAsyncMessage("setResolution",
|
||||
{ xres: xres, yres: yres });
|
||||
messageManager.broadcastAsyncMessage("setResolution",
|
||||
{ xres: xres, yres: yres });
|
||||
}
|
||||
|
||||
// Functions affecting <browser>.
|
||||
@ -107,8 +107,8 @@ function startAnimatedScrollBy(dx, dy) {
|
||||
rootView().scrollBy(ddx, ddy);
|
||||
|
||||
if (!sentScrollBy && 100 <= (now - start)) {
|
||||
messageManager.sendAsyncMessage("scrollBy",
|
||||
{ dx: dx, dy: dy });
|
||||
messageManager.broadcastAsyncMessage("scrollBy",
|
||||
{ dx: dx, dy: dy });
|
||||
sentScrollBy = true;
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ function OnRefTestLoad(win)
|
||||
#endif
|
||||
|
||||
gBrowserMessageManager = gBrowser.QueryInterface(CI.nsIFrameLoaderOwner)
|
||||
.frameLoader.messageManager;
|
||||
.frameLoader.messageManager;
|
||||
// The content script waits for the initial onload, then notifies
|
||||
// us.
|
||||
RegisterMessageListenersAndLoadContentScript();
|
||||
|
@ -4,7 +4,8 @@
|
||||
|
||||
var CapturePickerUI = {
|
||||
init: function() {
|
||||
this.messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
this.messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIMessageListenerManager);
|
||||
this.messageManager.addMessageListener("CapturePicker:Show", this);
|
||||
},
|
||||
|
||||
|
@ -11,7 +11,8 @@ var WebappsUI = {
|
||||
|
||||
init: function() {
|
||||
Cu.import("resource://gre/modules/OpenWebapps.jsm");
|
||||
this.messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||
this.messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIMessageBroadcaster);
|
||||
this.messageManager.addMessageListener("OpenWebapps:Install", this);
|
||||
this.messageManager.addMessageListener("OpenWebapps:GetInstalledBy", this);
|
||||
this.messageManager.addMessageListener("OpenWebapps:AmInstalled", this);
|
||||
@ -96,51 +97,51 @@ var WebappsUI = {
|
||||
},
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
this._browser = aMessage.target.QueryInterface(Ci.nsIFrameMessageManager);
|
||||
this._browser = aMessage.target.QueryInterface(Ci.nsIMessageSender);
|
||||
switch(aMessage.name) {
|
||||
case "OpenWebapps:Install":
|
||||
WebappsUI.show(WebappsUI.convertManifest(aMessage.json));
|
||||
break;
|
||||
case "OpenWebapps:GetInstalledBy":
|
||||
let apps = OpenWebapps.getInstalledBy(aMessage.json.storeURI);
|
||||
this._browser.sendAsyncMessage("OpenWebapps:GetInstalledBy:Return",
|
||||
this._browser.broadcastAsyncMessage("OpenWebapps:GetInstalledBy:Return",
|
||||
{ apps: apps, callbackID: aMessage.json.callbackID });
|
||||
break;
|
||||
case "OpenWebapps:AmInstalled":
|
||||
let app = OpenWebapps.amInstalled(aMessage.json.appURI);
|
||||
this._browser.sendAsyncMessage("OpenWebapps:AmInstalled:Return",
|
||||
this._browser.broadcastAsyncMessage("OpenWebapps:AmInstalled:Return",
|
||||
{ installed: app != null, app: app, callbackID: aMessage.json.callbackID });
|
||||
break;
|
||||
case "OpenWebapps:MgmtList":
|
||||
this.askPermission(aMessage, "openWebappsManage", {
|
||||
cancel: function() {
|
||||
WebappsUI.messageManager.sendAsyncMessage("OpenWebapps:MgmtList:Return",
|
||||
WebappsUI.messageManager.broadcastAsyncMessage("OpenWebapps:MgmtList:Return",
|
||||
{ ok: false, callbackID: aMessage.json.callbackID });
|
||||
},
|
||||
|
||||
allow: function() {
|
||||
let list = OpenWebapps.mgmtList();
|
||||
WebappsUI.messageManager.sendAsyncMessage("OpenWebapps:MgmtList:Return",
|
||||
WebappsUI.messageManager.broadcastAsyncMessage("OpenWebapps:MgmtList:Return",
|
||||
{ ok: true, apps: list, callbackID: aMessage.json.callbackID });
|
||||
}
|
||||
});
|
||||
break;
|
||||
case "OpenWebapps:MgmtLaunch":
|
||||
let res = OpenWebapps.mgmtLaunch(aMessage.json.origin);
|
||||
this._browser.sendAsyncMessage("OpenWebapps:MgmtLaunch:Return",
|
||||
this._browser.broadcastAsyncMessage("OpenWebapps:MgmtLaunch:Return",
|
||||
{ ok: res, callbackID: aMessage.json.callbackID });
|
||||
break;
|
||||
case "OpenWebapps:MgmtUninstall":
|
||||
this.askPermission(aMessage, "openWebappsManage", {
|
||||
cancel: function() {
|
||||
WebappsUI.messageManager.sendAsyncMessage("OpenWebapps:MgmtUninstall:Return",
|
||||
WebappsUI.messageManager.broadcastAsyncMessage("OpenWebapps:MgmtUninstall:Return",
|
||||
{ ok: false, callbackID: aMessage.json.callbackID });
|
||||
},
|
||||
|
||||
allow: function() {
|
||||
let app = OpenWebapps.amInstalled(aMessage.json.origin);
|
||||
let uninstalled = OpenWebapps.mgmtUninstall(aMessage.json.origin);
|
||||
WebappsUI.messageManager.sendAsyncMessage("OpenWebapps:MgmtUninstall:Return",
|
||||
WebappsUI.messageManager.broadcastAsyncMessage("OpenWebapps:MgmtUninstall:Return",
|
||||
{ ok: uninstalled, app: app, callbackID: aMessage.json.callbackID });
|
||||
}
|
||||
});
|
||||
@ -196,7 +197,7 @@ var WebappsUI = {
|
||||
hide: function hide() {
|
||||
this.close();
|
||||
|
||||
this._browser.sendAsyncMessage("OpenWebapps:InstallAborted", { callbackID: this._application.callbackID });
|
||||
this._browser.broadcastAsyncMessage("OpenWebapps:InstallAborted", { callbackID: this._application.callbackID });
|
||||
},
|
||||
|
||||
close: function close() {
|
||||
@ -239,7 +240,7 @@ var WebappsUI = {
|
||||
try {
|
||||
OpenWebapps.install(this._application);
|
||||
let app = OpenWebapps.amInstalled(this._application.appURI);
|
||||
this.messageManager.sendAsyncMessage("OpenWebapps:InstallDone", { app: app, callbackID: this._application.callbackID });
|
||||
this.messageManager.broadcastAsyncMessage("OpenWebapps:InstallDone", { app: app, callbackID: this._application.callbackID });
|
||||
} catch(e) {
|
||||
Cu.reportError(e);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="local-browser" extends="chrome://global/content/bindings/browser.xml#browser">
|
||||
<implementation type="application/javascript" implements="nsIAccessibleProvider, nsIObserver, nsIDOMEventListener, nsIFrameMessageListener">
|
||||
<implementation type="application/javascript" implements="nsIAccessibleProvider, nsIObserver, nsIDOMEventListener, nsIMessageListener">
|
||||
<field name="_securityUI">null</field>
|
||||
<property name="securityUI">
|
||||
<getter><![CDATA[
|
||||
@ -594,7 +594,7 @@
|
||||
</binding>
|
||||
|
||||
<binding id="remote-browser" extends="#local-browser">
|
||||
<implementation type="application/javascript" implements="nsIAccessibleProvider, nsIObserver, nsIDOMEventListener, nsIFrameMessageListener">
|
||||
<implementation type="application/javascript" implements="nsIAccessibleProvider, nsIObserver, nsIDOMEventListener, nsIMessageListener">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
|
@ -71,7 +71,7 @@ LoginManager.prototype = {
|
||||
init : function () {
|
||||
// Add content listener.
|
||||
var messageManager = Cc["@mozilla.org/globalmessagemanager;1"].
|
||||
getService(Ci.nsIChromeFrameMessageManager);
|
||||
getService(Ci.nsIMessageListenerManager);
|
||||
messageManager.loadFrameScript("chrome://browser/content/LoginManagerChild.js", true);
|
||||
messageManager.addMessageListener("PasswordMgr:FormSubmitted", this);
|
||||
messageManager.addMessageListener("PasswordMgr:GetPasswords", this);
|
||||
|
@ -11,11 +11,9 @@ const Cu = Components.utils;
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||
return Cc["@mozilla.org/childprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIFrameMessageManager)
|
||||
.QueryInterface(Ci.nsISyncMessageSender);
|
||||
});
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsISyncMessageSender");
|
||||
|
||||
function AppProtocolHandler() {
|
||||
this._basePath = null;
|
||||
|
@ -115,7 +115,7 @@ function MarionetteDriverActor(aConnection)
|
||||
|
||||
this.conn = aConnection;
|
||||
this.messageManager = Cc["@mozilla.org/globalmessagemanager;1"]
|
||||
.getService(Ci.nsIChromeFrameMessageManager);
|
||||
.getService(Ci.nsIMessageBroadcaster);
|
||||
this.browsers = {}; //holds list of BrowserObjs
|
||||
this.curBrowser = null; // points to current browser
|
||||
this.context = "content";
|
||||
@ -153,7 +153,7 @@ MarionetteDriverActor.prototype = {
|
||||
* Object to send to the listener
|
||||
*/
|
||||
sendAsync: function MDA_sendAsync(name, values) {
|
||||
this.messageManager.sendAsyncMessage("Marionette:" + name + this.curBrowser.curFrameId, values);
|
||||
this.messageManager.broadcastAsyncMessage("Marionette:" + name + this.curBrowser.curFrameId, values);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -367,7 +367,7 @@ MarionetteDriverActor.prototype = {
|
||||
//if there is a content listener, then we just wake it up
|
||||
this.addBrowser(this.getCurrentWindow());
|
||||
this.curBrowser.startSession(false);
|
||||
this.messageManager.sendAsyncMessage("Marionette:restart", {});
|
||||
this.messageManager.broadcastAsyncMessage("Marionette:restart", {});
|
||||
}
|
||||
else {
|
||||
this.sendError("Session already running", 500, null);
|
||||
@ -1299,7 +1299,7 @@ MarionetteDriverActor.prototype = {
|
||||
deleteSession: function MDA_deleteSession() {
|
||||
if (this.curBrowser != null) {
|
||||
if (appName == "B2G") {
|
||||
this.messageManager.sendAsyncMessage("Marionette:sleepSession" + this.curBrowser.mainContentId, {});
|
||||
this.messageManager.broadcastAsyncMessage("Marionette:sleepSession" + this.curBrowser.mainContentId, {});
|
||||
this.curBrowser.knownFrames.splice(this.curBrowser.knownFrames.indexOf(this.curBrowser.mainContentId), 1);
|
||||
}
|
||||
else {
|
||||
@ -1310,7 +1310,7 @@ MarionetteDriverActor.prototype = {
|
||||
//delete session in each frame in each browser
|
||||
for (let win in this.browsers) {
|
||||
for (let i in this.browsers[win].knownFrames) {
|
||||
this.messageManager.sendAsyncMessage("Marionette:deleteSession" + this.browsers[win].knownFrames[i], {});
|
||||
this.messageManager.broadcastAsyncMessage("Marionette:deleteSession" + this.browsers[win].knownFrames[i], {});
|
||||
}
|
||||
}
|
||||
let winEnum = this.getWinEnumerator();
|
||||
@ -1519,8 +1519,8 @@ function BrowserObj(win) {
|
||||
this.curFrameId = null;
|
||||
this.startPage = "about:blank";
|
||||
this.mainContentId = null; // used in B2G to identify the homescreen content page
|
||||
this.messageManager = Cc["@mozilla.org/globalmessagemanager;1"].
|
||||
getService(Ci.nsIChromeFrameMessageManager);
|
||||
this.messageManager = Cc["@mozilla.org/globalmessagemanager;1"]
|
||||
.getService(Ci.nsIMessageBroadcaster);
|
||||
this.newSession = true; //used to set curFrameId upon new session
|
||||
this.elementManager = new ElementManager([SELECTOR, NAME, LINK_TEXT, PARTIAL_LINK_TEXT]);
|
||||
this.setBrowser(win);
|
||||
|
@ -30,7 +30,7 @@ loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserverAPI.js
|
||||
function SpecialPowersObserver() {
|
||||
this._isFrameScriptLoaded = false;
|
||||
this._messageManager = Cc["@mozilla.org/globalmessagemanager;1"].
|
||||
getService(Ci.nsIChromeFrameMessageManager);
|
||||
getService(Ci.nsIMessageBroadcaster);
|
||||
}
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ SpecialPowersObserver.prototype = new SpecialPowersObserverAPI();
|
||||
|
||||
SpecialPowersObserver.prototype._sendAsyncMessage = function(msgname, msg)
|
||||
{
|
||||
this._messageManager.sendAsyncMessage(msgname, msg);
|
||||
this._messageManager.broadcastAsyncMessage(msgname, msg);
|
||||
};
|
||||
|
||||
SpecialPowersObserver.prototype._receiveMessage = function(aMessage) {
|
||||
|
@ -167,7 +167,7 @@ ContentPrefService.prototype = {
|
||||
|
||||
classID: Components.ID("{e6a3f533-4ffa-4615-8eb4-d4e72d883fa7}"),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPrefService,
|
||||
Ci.nsIFrameMessageListener]),
|
||||
Ci.nsIMessageListener]),
|
||||
|
||||
|
||||
//**************************************************************************//
|
||||
|
@ -11,7 +11,7 @@ function run_test() {
|
||||
// 593407 which will clean that up. After that, use
|
||||
// the commented out line below it.
|
||||
messageHandler = cps.wrappedJSObject;
|
||||
//messageHandler = cps.QueryInterface(Ci.nsIFrameMessageListener);
|
||||
//messageHandler = cps.QueryInterface(Ci.nsIMessageListener);
|
||||
|
||||
// Cannot get values
|
||||
do_check_false(messageHandler.receiveMessage({
|
||||
@ -55,7 +55,7 @@ function run_test() {
|
||||
};
|
||||
|
||||
var mM = Cc["@mozilla.org/parentprocessmessagemanager;1"].
|
||||
getService(Ci.nsIFrameMessageManager);
|
||||
getService(Ci.nsIMessageListenerManager);
|
||||
mM.addMessageListener("ContentPref:setPref", messageProxy);
|
||||
mM.addMessageListener("ContentPref:getPref", messageProxy);
|
||||
mM.addMessageListener("ContentPref:QUIT", messageProxy);
|
||||
|
@ -21,7 +21,7 @@ FormHistory.prototype = {
|
||||
classID : Components.ID("{0c1bb408-71a2-403f-854a-3a0659829ded}"),
|
||||
QueryInterface : XPCOMUtils.generateQI([Ci.nsIFormHistory2,
|
||||
Ci.nsIObserver,
|
||||
Ci.nsIFrameMessageListener,
|
||||
Ci.nsIMessageListener,
|
||||
Ci.nsISupportsWeakReference,
|
||||
]),
|
||||
|
||||
@ -104,7 +104,7 @@ FormHistory.prototype = {
|
||||
this.dbStmts = {};
|
||||
|
||||
this.messageManager = Cc["@mozilla.org/globalmessagemanager;1"].
|
||||
getService(Ci.nsIChromeFrameMessageManager);
|
||||
getService(Ci.nsIMessageListenerManager);
|
||||
this.messageManager.loadFrameScript("chrome://satchel/content/formSubmitListener.js", true);
|
||||
this.messageManager.addMessageListener("FormHistory:FormSubmitEntries", this);
|
||||
|
||||
|
@ -25,8 +25,8 @@ const MSG_JAR_FLUSH = "AddonJarFlush";
|
||||
*/
|
||||
function flushJarCache(aJarFile) {
|
||||
Services.obs.notifyObservers(aJarFile, "flush-cache-entry", null);
|
||||
Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIChromeFrameMessageManager)
|
||||
.sendAsyncMessage(MSG_JAR_FLUSH, aJarFile.path);
|
||||
Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageBroadcaster)
|
||||
.broadcastAsyncMessage(MSG_JAR_FLUSH, aJarFile.path);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1025,8 +1025,8 @@ function buildJarURI(aJarfile, aPath) {
|
||||
*/
|
||||
function flushJarCache(aJarFile) {
|
||||
Services.obs.notifyObservers(aJarFile, "flush-cache-entry", null);
|
||||
Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIChromeFrameMessageManager)
|
||||
.sendAsyncMessage(MSG_JAR_FLUSH, aJarFile.path);
|
||||
Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageBroadcaster)
|
||||
.broadcastAsyncMessage(MSG_JAR_FLUSH, aJarFile.path);
|
||||
}
|
||||
|
||||
function flushStartupCache() {
|
||||
|
@ -40,7 +40,7 @@ function amManager() {
|
||||
Components.utils.import("resource://gre/modules/AddonManager.jsm");
|
||||
|
||||
var messageManager = Cc["@mozilla.org/globalmessagemanager;1"].
|
||||
getService(Ci.nsIChromeFrameMessageManager);
|
||||
getService(Ci.nsIMessageListenerManager);
|
||||
|
||||
messageManager.addMessageListener(MSG_INSTALL_ENABLED, this);
|
||||
messageManager.addMessageListener(MSG_INSTALL_ADDONS, this);
|
||||
|
Loading…
Reference in New Issue
Block a user