[Project_owners] Getting the panel (tab) id for tabs out of focus

Jesper Staun Hansen jesper at heroes-addon.dk
Fri May 30 12:15:25 PDT 2008


As many already know then I have been trying get the tab id which is 
queue for every tab (panel).
There is no trouble in getting the tab id for the tab in focus with:
    getBrowser().selectedTab.linkedPanel
But having trouble with a working tab.

There is some code in firefox's tabbrowser.xml (see 
http://lxr.mozilla.org/mozilla/source/xpfe/global/resources/content/bindings/tabbrowser.xml#926)
925             var tabBrowser = this.parentNode.parentNode.parentNode;
926             var tab = 
document.getAnonymousElementByAttribute(tabBrowser, "linkedpanel", this.id);

These lines should get the current working tab and not the selected tab. 
But its not working as this.parentNode is not defined.
So I got some info back with this (all other parentNode usage is null):

330        try {
331              var tabBrowser = 
getBrowser().parentNode.parentNode.parentNode.parentNode;
332              var tab = 
document.getAnonymousElementByAttribute(tabBrowser, "linkedpanel", this.id);
333              dump("..."+tab+"\n");
334        } catch (e) { dump("..."+e+"\n"); }

Which returns this:
[Exception... "Could not convert JavaScript argument arg 0 
[nsIDOMDocumentXBL.getAnonymousElementByAttribute]"  nsresult: 
"0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)"  location: "JS frame :: 
chrome://test/content/test.js :: getTab :: line 332"  data: no]

so it seems like there is "something"...


More information about the Project_owners mailing list