Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What can cause a Chrome browser extension to crash?

My browser extension is crashing occasionally. The problem is, I cannot find a good, comprehensive list of things that can cause an extension to crash, and thus am having a hard time creating a checklist of things to work with.

My assumption is that anything that causes a standard Chrome tab to crash would cause the extension to crash when run in the Background.html file.

Off the top of my head, I'm assuming the following could cause problems...

  • Infinite loops or other instances of a script becoming unresponsive
  • Uncaught exceptions (eg, a JSON.parse with no try/catch)
  • Database storage errors
  • Excessive resource usage (??)

That's really all I can think of. I'm having a heck of a time trying to debug my extension and would really appreciate any help creating a checklist...

like image 469
Zane Claes Avatar asked Sep 01 '12 16:09

Zane Claes


People also ask

How do I fix a broken Chrome extension?

Re-enable Malfunctioning Extensions Head to More tools > Extensions. Use the toggle for each extension to turn it off. Restart Chrome and go back to the extensions list. Re-enable the extensions.

What links can crash Chrome?

But if you use Chrome Web browser, it turns out there is a simpler way to crash it. Just enter in a specific 16-character string in the address bar of Chrome and it will disappear as if it saw a ghost. Entering in the following 16-character link "http://a/%%30%30" (without the quotes) crashes Chrome.


1 Answers

I'm coming back to this question about 3 months after asking it because a 2nd extension of mine was also crashing. In this case, though, the extension was far simpler -- only about 40 lines of code in the background.js script.

2 operations seemed to be possible culprits: writing to localStorage and using console.log

I have previously observed that it is possible to crash a normal chrome tab by using console.log repeatedly with large objects in a website if you leave the page open for an extended period. Because background.js is always open, it seems like a likely culprit here.

tl;dr Don't use console.log in production. Ever.

like image 80
Zane Claes Avatar answered Oct 13 '22 01:10

Zane Claes