If I open up the JavaScript console in Chrome Developer Tools to debug my extension's content scripts, I don't get the context of the content scripts. For example, jQuery isn't accessible, and I can't get access to my global variables unless I go to the debugger and set up a breakpoint.
Am I just missing something? It would be great to be able to check my global variables from the JS console or invoke jQuery.
It is not possible at the moment to perform evaluations in context of a content script except the described way of setting a breakpoint/inserting debugger statement and pausing inside the script. I filed a bug on this, You can add yourself to the CC list to track its progress.
You can achieve this indirectly by triggering the debugger in the isolated world of the content script:
chrome.tabs.executeScript(undefined, {'code': 'debugger'})
You should also be able to use the debugger
keyword directly in your content script, if there's a place in the execution that you wish to inspect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With