Kim Strauss
Kim Strauss

Reputation: 329

Firefox addon global object vs. firebug console global object

Firebug is a great addon and I would love to use it while developing Firefox extensions, unfortunetly it requires a little bit of acrobatics - it seems like it was made mostly with web pages, and not chrome scripts in mind.

I would like to use Firebug console to inspect and manipulate objects created by my extension. Unfortunately, when typing "this" into console I get that the current global object is

Window <url here>

while dumping "this" from my addon scope, I get

Window browser.xul

and this is where my addon, and all it's objects reside. How can I access this object from Firebug console (or the other way - access what is known as "this" to the console from my addon)?

There is a way to do something similar described on MDN:

https://developer.mozilla.org/en/Working_with_windows_in_chrome_code#Accessing_the_elements_of_the_top-level_document_from_a_child_window

but it requires the calling script to be a privileged window, which console apparently is not. Running this code snippet in console results in:

Error: Permission denied for <http://siteurl> to create wrapper for object of     class UnnamedClass
[Break On This Error]   

.getInterface(Components.interfaces.nsIWebNavigation)

Upvotes: 0

Views: 559

Answers (1)

muzuiget
muzuiget

Reputation: 1087

You can try Chromebug.

Another way is open chrome://browser/content/browser.xul, then you will see a Firefox browser window in tab, open the parent window Firebug, the window object is what you want.

Upvotes: 0

Related Questions