concord-consortium/iframe-phone — pull request #2 by rklancer (2014-08-07 16:54:45+00:00)
Title: Add "RPC" mechanism

Bumps version to 1.1 See `tests/tests.js` for functionality.

Note that in addition to adding `IframePhoneRpcEndpoint`, this allows the embedded iframe to be initialized before the parent (the first 'hello' will be dropped if the parent is not initialized, but the child will send 'hello' until it gets a reply or times out)

Additionally it includes a slight change to origin checking. The old API is supported, but we now infer the origin of the iframe _once only_, from the value of the src attribute that exists when the IframePhone is created. This might create a problem in an application using IframePhone to talk to an embedded iframe, if it wants to create the IframePhone object after the iframe is created but before the src of the iframe has been set. (This is not the case in Lab)

Note that it was already not possible to just swap out the iframe context entirely without also reinitializing iframePhone, because the 'hello' handshake would not take place with the new context. Therefore there can be no apps that used IframePhone while changing the src of the iframe to a different domain without also reinitializing iframePhone, and therefore the new behavior will not break apps that want to do that.