Alert () sometimes causes an error in Chrome

I used alert() for debugging when I encoded some lines in JavaScript / jQuery (I know this is a bad style). Now I see strange behavior in Google Chrome.

HTML

  <html> <head> <script src="my_script.js"></script> </head> <body> <p>Test</p> </body> </html> 

my_script.js

It is really easy.

  alert("hello world"); 

Error

When I load the page, it works fine, but when I reload the page, sometimes the following error occurs in Google Chrome:

Uncaught TypeError: unable to read the "impl" property from undefined extensions :: messaging: 184

Checking this several times, I found that

  • alert() window will appear
  • the error does not occur every time, and sometimes
  • an error occurs (when this happens) after closing the alert() window
  • the error does not seem to occur if I wait for the alert() window to close or between two reboots

The error message points to this piece of code:

  // In case the extension never invokes the responseCallback, and also // doesn't keep a reference to it, we need to clean up the port. Do // so by attaching to the garbage collection of the responseCallback // using some native hackery. messagingNatives.BindToGC(responseCallback, function() { if (port) { privates(port).impl.destroy_(); port = null; } }); 

But I could not even figure out which file was exactly affected and in which folder it was placed.

Google just found one other description, obviously of the same error: https://teamtreehouse.com/forum/anyone-else-getting-error-cannot-read-property-impl-of-undefined

The author of this page assumes that a fact, an error occurs only sometimes, indicates a problem with an asynchronous process that does not end, sometimes the page reloads.

I solved my debugging tasks by switching to using console.log() . But I'm completely interested in what happens with the error, and how I could avoid it in order to return to my bad debugging style using the alert() function.

+4
source share
1 answer

Hi (: I found a possible explanation of your question on this forum ( https://teamtreehouse.com/forum/anyone-else-getting-error-cannot-read-property-impl-of-undefined ). Quote: 'undefined is coming back to the impl property. Since this happens periodically, it tells me that privates (port) is an asynchronous operation that allows another code to continue working, sometimes individuals finish before accessing the implant, sometimes it wins, t. 'End of quote Although this is just an assumption, I find it rational.

0
source

All Articles