daepark / postmessage

window postmessage plugin for cross-window messaging
http://postmessage.freebaseapps.com
179 stars 55 forks source link

postmessage console log when e.data is empty or contains an undefined property #18

Open mdurling opened 7 years ago

mdurling commented 7 years ago

We are using a package that depends on postmessage. We get multiple warnings in the console log because postmessage complains it can not parse the JSON in the messages. This happens in 2 distinct scenraios:

  1. When e.data is empty '' or undefined, and
  2. When e.data contains a property that is undefined

There should be a way to suppress these warnings as they clutter the console and inhibit debugging. I believe if postmessage can't parse the messages that it should just silently ignore them. Or it should be marking messages that are sent using postmessage and ignoring messages that were sent using window.postMessage directly.

The warnings are for messages sent via window.postMessage that aren't even to/from the package that is depending on postmessage ... the messages that are causing the warnings are coming from the Redux DevTools Chrome extension and Webpack Dev Server.