ozone-development/ozp-iwc — pull request #185 by MidnightJava (2014-12-16 22:35:12+00:00)
Title: feat: Optimize Structured Cloen Support

refs #184

Implement a "safe" postMessage method which tests for browser support of structured clones, stringifies the message if structured clones are not supported, and automatically falls back to JSON.stringify if the browser does not support structured clones or if the client is attempting to send a non-cloneable message.

Change all invocations of postMessage (2 instances) to use the safe method above.

Remove the method for returning a payload to be sent via postMessage, which is no longer needed.

Tested with Chrome 39.0 and Firefox 31.3, which support structured clones, and with Firefox 24.8, which does not support structured clones.