I am working on a helper library called Ozai to make web workers easier, but am running in to a problem in firefox. I create a web worker from a URL Blob and attempt to post this payload to it:
msg = {
"id":"0fae0ff8-bfd1-49ea-8139-3d03fb9584e4",
"fn":"fn",
"args":[100,200]
}
Using this code:
worker.postMessage(msg)
But it throws a DataCloneError
exception. It looks like Firefox's implementation of structured cloning is failing on a very simple object. The code runs without problems on Chrome and Safari, but fails in the latest version of Firefox. Am I missing something here? How do I get around this (preferably without stringifying the payload)?
Here's a fiddle: http://jsfiddle.net/V8aCy/6/
And a pic of Firelord Ozai: