ozone-development/ozp-iwc — pull request #114 by MidnightJava (2014-10-16 21:43:15+00:00)
Title: Feature relax clone support check

Refs #89

Relax clone support test to handle case were the browser supports structured clones, but a specific object cannot be successfully cloned. This is intended specifically to address a Firefox bug (https://bugzilla.mozilla.org/show_bug.cgi?id=722126) wherein File objects cannot be cloned even though the browser supports structured clones.

The method ozpIwc.util.structuredCloneSupport() was previously called by clients to indicate structured clone support. The method usually returns quickly because the result, being only a function of the browser being used, is cached after the first invocation.

To enable testing of specific object cloning, while retaining the efficiency described above as much as possible, clients should now call ozpIwc.util.getPostmessagePayload(msg) with the message to be sent via window.postMessage(). This method will call ozpIwc.util.structuredCloneSupport() to determine browser support. If the browser supports structured clones, and msg is not an instance of File, sg is returned as-is. Otherwise, the ability to clone msg is tested explicitly, and if it is not clonable, a stringified version is returned.

Client code was modified to use ozpIwc.util.getPostmessagePayload(msg), and ozpIwc.util.structuredCloneSupport() has been annotated as deprecated.

Unit and integration tests were run against Chrome 36.0 (stable) and Firefox 24.7