jpillora / xdomain

A pure JavaScript CORS alternative
https://jpillora.com/xdomain/
3.12k stars 270 forks source link

Gracefully handle non-JSON postMessages #37

Closed jamessharp closed 10 years ago

jamessharp commented 10 years ago

I came across this when using a browserified version of node's process.nextTick which uses postMessage to trigger an efficient equivalent to setTimeout(0)

In this case the event data is "process-tick" or similar which throws an exception in xdomain. I think it would be better if xdomain just ignored the message if it can't parse it as JSON

jpillora commented 10 years ago

Hey thanks for the PR! Though I just released 0.6, which adds a bunch of stuff and fixes this. See this similar issue: https://github.com/jpillora/xdomain/issues/35

jamessharp commented 10 years ago

Ah excellent. Thanks!

On Saturday, February 1, 2014, Jaime Pillora notifications@github.com wrote:

Closed #37 https://github.com/jpillora/xdomain/pull/37.

Reply to this email directly or view it on GitHubhttps://github.com/jpillora/xdomain/pull/37 .