Zane Claes
Zane Claes

Reputation: 14954

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

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

Upvotes: 9

Views: 5111

Answers (1)

Zane Claes
Zane Claes

Reputation: 14954

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.

Upvotes: 17

Related Questions