Frage

I'm trying to understand how webconsole.js is imported into the Firefox Devtools - It should be imported in toolbar.xul, but I couldn't see were, in either the DOM inspector or Venkman JS debugger.

To be more specific, I'm trying to call JSTerm.execute(command, callback) from the inspector.xul context, similar to what happens when you enter somehting in the Web Console. These objects should be in inspector's parent window (the Dev tools main toolbar), but I can't seem to find the reference.

War es hilfreich?

Lösung

Inspector and Web Console are two separate tools that normally don't interact. In fact, it's possible for Inspector to be loaded while Web Console isn't. What gets loaded into the browser is chrome://browser/content/devtools/framework/toolbox.xul - that's the toolbar displaying all registered tools (there is a generic API to register tools). When a particular tool is selected, it gets loaded into an <iframe> inside toolbox.xul, this can be inspector.xul or webconsole.xul. The latter loads webconsole.js then.

In other words, you cannot really use functionality of the web console from the inspector, at least not reliably. The best solution would be copying the parts you need from webconsole.js into your code - that way it will work regardless of how developer tools change in future.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top