Ananize Scott
Ananize Scott

Reputation: 911

How do you test/debug a Chrome extension's event/background page?

I have an extension that has the following files: content.js, background.js, manifest.json, mystyles.css, jquery-2.0.3.js and icon.png.

I can set breakpoints in the content.js file via the Chrome Debug Tool via the "Sources" tab and via the "Content Scripts" tab. My problem is that I can't find a reference to the "background.js" file, so I can set a breakpoint in it. Can someone tell me what I am overlooking or doing wrong?

References:

Upvotes: 3

Views: 1310

Answers (1)

CarstenOSU
CarstenOSU

Reputation: 131

If you open up a new tab and go to chrome://extensions, you will see a list of installed plugins, including your own. Next to your plugin, there will be a link to "Inspect Views" pointing to a background.html page or a generated one in your case. This will launch a new debug window in Chrome that will allow you to browse to your background.js file and set breakpoints (by clicking on the line number)!

Upvotes: 4

Related Questions