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…
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.