On Apr 30, 11:53 am, Peter Valdemar Mørch <[email protected]> wrote:
> I'm writing an extension[1]. The user selects a tab (which I remember)
> and I would like it to write to exactly that tab's Firebug Console if
> it is active.
>
> During activation, I get and store the current window like so [2]:
>
>         var contentWindow = Components.classes['[email protected]/appshell/
> window-mediator;1']
>             .getService(Components.interfaces.nsIWindowMediator);
>         remotecontrol.controlledWindow = wm.getMostRecentWindow(
>                 'navigator:browser'
>             ).getBrowser().contentWindow;
>
> So now that I have contentWindow, is it possible to print to exactly
> that window's console? How? Firebug.Console.log writes to what happens
> to be the current window now, not my stored contentWindow.
>
> I find it challenging to find the definition of Firebug.Console.log
> (searching for "log" or "Console" gives very many hits!) and I don't
> understand what a "context" is, which makes it uphill.

A 'context' is debugger metadata for a web page.
Firebug.currentContext is the context object for the selected window.
context.window is the Web page top level Window for the context.

To get the context for |controlledWindow| use
Firebug.TabWatcher.getContextByWindow(controlledWindow); then pass the
result context object to Firebug.Console.logFormatted.

jjb

>
> Thank you for reading this far.
>
> Peter
>
> 1:https://addons.mozilla.org/en-US/firefox/addon/remote-control/
> 2:https://github.com/pmorch/FF-Remote-Control/blob/V_0.1/chrome/content...

-- 
You received this message because you are subscribed to the Google Groups 
"Firebug" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/firebug?hl=en.

Reply via email to