Skip to content

Instantly share code, notes, and snippets.

@3rdp
Last active October 2, 2018 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3rdp/54e7778bac615bee15a6edf4e6cccdf5 to your computer and use it in GitHub Desktop.
Save 3rdp/54e7778bac615bee15a6edf4e6cccdf5 to your computer and use it in GitHub Desktop.
Embed: Error in console from 'embed.js' file
I work on a project for a blog web-site and I'm trying to resolve the issue I constantly get on an article page.
On an article page, we have a subscribe form. When user posts a request to subscribe to our blog, the error from Disqus embed file pops up in user's browser console: "TypeError: c is null" in Firefox, or "TypeError: Cannot read property 'sender' of null" in Chrome.
I tried to debug the issue and I stumbled upon a global (window.addEv...) 'message' event handler which parses 'data' property of its first parameter as JSON. But! This 'data' parsing is via JSON.parse and JSON.parse(null) throws no error and just returns null, meaning that though Disqus developers embedded the parsing procedure in try-catch statement, the code execution continues until on the next line you try to access property 'sender' of a null.
Can you please resolve the issue?
EDIT:
Another way to reproduce this error is to open the page where the Disqus comments are on, in my case it is the article page, and paste this code into browser console "window.postMessage(null, '*')" and then Press Enter to execute. You'll see that the browser returns an error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment