The goog.net.xpc.CrossPageChannel Class

goog.net.xpc.CrossPageChannel
> goog.messaging.AbstractChannel
> goog.Disposable

goog.net.xpc.CrossPageChannel(cfg, opt_domHelper)

A communication channel between two documents from different domains. Provides asynchronous messaging.

cfg {Object}
Channel configuration object.
opt_domHelper {goog.dom.DomHelper=}
The optional dom helper to use for looking up elements in the dom.

.addOnDisposeCallback(callback, opt_scope)

Inherited from goog.Disposable .

Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.

callback {!Function}
The callback function.
opt_scope {Object=}
An optional scope to call the callback in.

.close()

Closes the channel.

.connect(opt_connectCb)

Initiates connecting the channel. When this method is called, all the information needed to connect the channel has to be available.

opt_connectCb {Function=}
The function to be called when the channel has been connected and is ready to be used.

.createPeerIframe(parentElm, opt_configureIframeCb, opt_addCfgParam)

Creates the iframe containing the peer page in a specified parent element. This method does not connect the channel, connect() still has to be called separately.

parentElm {!Element}
The container element the iframe is appended to.
opt_configureIframeCb {Function=}
If present, this function gets called with the iframe element as parameter to allow setting properties on it before it gets added to the DOM. If absent, the iframe's width and height are set to '100%'.
opt_addCfgParam {boolean=}
Whether to add the peer configuration as URL parameter (default: true).
returns {!HTMLIFrameElement}
The iframe element.

.creationStack {string}

Inherited from goog.Disposable .

If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.

.dispose()

Inherited from goog.Disposable .

Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.

returns {void}
Nothing.

.getPeerConfiguration()

returns {Object}
Configuration-object to be used by the peer to initialize the channel.

.getPeerUri(opt_addCfgParam)

Returns the peer URI, with an optional URL parameter for configuring the peer window.

opt_addCfgParam {boolean=}
Whether to add the peer configuration as URL parameter (default: true).
returns {!goog.Uri}
The peer URI.

.getPeerWindowObject()

Returns the window object the foreign document resides in. Package private.

returns {Object}
The window object of the peer.

.getRole()

Returns the role of this channel (either inner or outer).

returns {number}
The role of this channel.

.getTransportName()

Returns the tranport name in use for this channel.

returns {string}
The transport name.

.getTransportType()

Returns the transport type in use for this channel.

returns {number}
Transport-type identifier.

.isConnected()

Always returns true. If subclasses have configuration that needs to happen before the channel is connected, they should override this and {@link #connect}.

returns {boolean}
Whether the channel is connected.

.isDisposed()

Inherited from goog.Disposable .

returns {boolean}
Whether the object has been disposed of.

.isPeerAvailable()

Determines whether the peer window is available (e.g. not closed). Package private.

returns {boolean}
Whether the peer window is available.

.name {string}

The name of the channel.

.notifyConnected(opt_delay)

Package-private. Called by the transport when the channel is connected.

opt_delay {number=}
Delay this number of milliseconds before calling the connection callback. Usage is discouraged, but can be used to paper over timing vulnerabilities when there is no alternative.

.registerDefaultService()

Inherited from goog.messaging.AbstractChannel .

.registerDisposable(disposable)

Inherited from goog.Disposable .

Associates a disposable object with this object so that they will be disposed together.

disposable {goog.disposable.IDisposable}
that will be disposed when this object is disposed.

.registerService()

Inherited from goog.messaging.AbstractChannel .

.safeDeliver(serviceName, payload, opt_origin)

Delivers messages to the appropriate service-handler.

serviceName {string}
The name of the port.
payload {string}
The payload.
opt_origin {string=}
An optional origin for the message, where the underlying transport makes that available. If this is specified, and the PEER_HOSTNAME parameter was provided, they must match or the message will be rejected.

.send()

.setPeerWindowObject(peerWindowObject)

Sets the window object the foreign document resides in.

peerWindowObject {Object}
The window object of the peer.