Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

nsIMessageBroadcaster

This article needs a technical review. How you can help.

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.

See Message Manager interfaces for more details on the distinction between message senders and message broadcasters.

Methods

void broadcastAsyncMessage([optional] in AString messageName,
                      [optional] in jsval obj,
                      [optional] in jsval objects);
nsIMessageListenerManager getChildAt(in unsigned long aIndex);

broadcastAsyncMessage()

Like sendAsyncMessage(), but also broadcasts this message to all "child" message managers of this message manager.

See nsIMessageListener::receiveMessage() for the format of the data delivered to listeners.

WARNING: broadcasting messages can be very expensive and leak sensitive data.  Use with extreme caution.

Throws NS_ERROR_NOT_INITIALIZED if the sender is not initialized.  For example, we will throw NS_ERROR_NOT_INITIALIZED if we try to send a message to a cross-process frame but the other process has not yet been set up.

Throws NS_ERROR_FAILURE when the message receiver cannot be found.  For example, we will throw NS_ERROR_FAILURE if we try to send a message to a cross-process frame whose process has crashed.

Parameters

Name Type Description
messageName String

The name of the message. Optional.

This becomes the name property of the received message.

obj Object.

The message payload.

A structured clone of this becomes the data property of the received message.

objects Object.

An object each of whose properties is an object.

This becomes the objects property of the received message, with each original object replaced with a cross process object wrapper for it.

getChildAt()

Return a single subordinate message manager.

Parameters

Name Type Description
aIndex Number The index of the subordinate message manager to retrieve.

Returns

nsIMessageListenerManager: the message manager at the given index.

Attributes

childCount

Number: the number of subordinate message managers. Read only.

Document Tags and Contributors

 Contributors to this page: wbamberg
 Last updated by: wbamberg,