getBrowserIndexForDocument( document )
Type: integer
Returns the index of the browser for the specified document.
Anyone know what I can expect about the index? Unique to tab? Depends on
tab order?
jjb
I've never quite understood these methods "documented" in a vacuum on
MDC....
The returned index is the index of the <browser> containing the document
(in the sense that its contentDocument is the given document) in the
tabbrowser's list of browsers. It would depend on the tab order,
absolutely. All it's good for is passing to other tabbrowser APIs
(selectTabAtIndex, getBrowserAtIndex are the only ones I see offhand; of
course the latter can just use getBrowserForDocument) or maintaining a
list of something in the same order as the tabs (e.g. sessionstore),
unless you make nasty assumptions about the tabbrowser's guts (like
browser.js does).
-Boris
I updated
https://developer.mozilla.org/en/XUL/Method/getBrowserIndexForDocument
Firebug uses it
http://code.google.com/p/fbug/source/browse/branches/firebug1.5/content/firebug/firebug.js#1757
in a seeming roundabout way
http://code.google.com/p/fbug/source/browse/branches/firebug1.5/content/firebug/firebug.js#1780
to get the linkedpanel which is more of an tag for the tab.
jjb
linkedPanel currently happens to be an id that is guaranteed to be
unique, sort of. Only sort of; scripted tab open/close operations can
trigger duplicate ids without too much trouble, I suspect (it's just
based on Date.now() and tab position).
You could probably replace tabBrowser.tabContainer.childNodes with
tabBrowser.mTabs if you wanted, but it wouldn't really change much about
this code. Please file bugs on tabbrowser not exposing the apis you need
here to make this work sanely?
-Boris
Bug 529477 - Provide a unique-per-session id for a tab in a tabbrowser
I suppose we should have a meta-bug for multiprocess blockers.
jjb
> I updated https://developer.mozilla.org/en/XUL/Method/getBrowserIndexForDocument
The system works!
Eric Shepherd
Developer Documentation Lead
Mozilla Corporation
http://www.bitstampede.com/
Apparently not. My edits were removed.
jjb
And replaced with text that's fundamentally incorrect, I should note.
-Boris
The page
https://developer.mozilla.org/en/XUL%3aMethod%3agetBrowserForDocument
and its siblings ought to be deleted so that searches give this instead:
https://developer.mozilla.org/en/XUL%3atabbrowser#m-getBrowserIndexForDocument
which is what I wished I had cited in my post. At least then it would be
clear that the function is a method of tabbrowser and it's part of a
system of methods.
jjb
I've reverted your edit accidentally removed by Ryan.
Phil
--
Philip Chee <phi...@aleytys.pc.my>, <phili...@gmail.com>
http://flashblock.mozdev.org/ http://xsidebar.mozdev.org
Guard us from the she-wolf and the wolf, and guard us from the thief,
oh Night, and so be good for us to pass.
--
Mook
P.S. I don't think Ryan's change was accidental, given the change summary.
Awesome, I needed a good laugh!
jjb
Which page appears higher in searches? I'd hope the second page...
-Boris
The second page does not appear in the top 40 results from google or
bing for "getBrowserIndexForDocument".
jjb