How to debug the background page's body onload function?

1,866 views
Skip to first unread message

Amanda

unread,
Jan 24, 2011, 9:28:25 PM1/24/11
to Chromium-extensions
Here is my backgournd page code. The body onload function "init()" is
defined in a javascript. How can I debug this function?

<html>
<head>
<script type="text/javascript" src="js/background.js"></script>
</head>

<body onload="init()">
</body>
</html>


Although I can set breakpoint at this function. But I have no chance
to stop at it because it run when my extension is loaded.

Could someone share some idea?

Amanda

unread,
Jan 25, 2011, 2:34:23 AM1/25/11
to Chromium-extensions
I have to use console.log to trace the code ;-(

Arne Roomann-Kurrik

unread,
Jan 25, 2011, 12:59:51 PM1/25/11
to Amanda, Chromium-extensions
On the mac if you inspect the background page, set a breakpoint, and press Apple-R in the developer tools, the background page will reload and the breakpoint will fire.  I believe this will work on other platforms as well (just use the key combo for reloading the page on that platform).

~Arne


On Mon, Jan 24, 2011 at 11:34 PM, Amanda <mengdo...@hotmail.com> wrote:
I have to use console.log to trace the code ;-(

--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.


Arne Roomann-Kurrik

unread,
Jan 25, 2011, 1:47:26 PM1/25/11
to Gildas, Chromium-extensions
+ chromium extensions list

On Tue, Jan 25, 2011 at 10:42 AM, Gildas <gildas....@gmail.com> wrote:
You can also use the "debugger" keyword to insert programmatically a
breakpoint.
 
Right on, that's a good suggestion as well.

~Arne


Reply all
Reply to author
Forward
0 new messages