zendesk / cross-storage

Cross domain local storage, with permissions
Apache License 2.0
2.22k stars 180 forks source link

fix json parse and split not defined issues #23

Closed tehdb closed 8 years ago

tehdb commented 8 years ago

the problem is, that "window.addEventListener('message', listener, false)" attached to all "message" events, that will be triggered on hubs window and it is possible, that some other modules calls "postMessage" on hub, so following errors shows up on the browser console:

Example: $("#CrossStorageClient-XXX")[0].contentWindow.postMessage("bla", "http://localhost") Error: Uncaught SyntaxError: Unexpected token br._listener @ xshub:11

or

Example: $("#CrossStorageClient-XXX")[0].contentWindow.postMessage('{"bla":"bla"}', "http://localhost") Error: Uncaught TypeError: Cannot read property 'split' of undefinedr._listener @ xshub:11

danielstjules commented 8 years ago

Looks good, thanks!

tehdb commented 8 years ago

Thanks for the speedy feedback, can you please bump the bower and npm version, build and publish?