Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

getBrowserIndexForDocument

35 views
Skip to first unread message

John J Barton

unread,
Nov 17, 2009, 7:34:44 PM11/17/09
to
All that MDC says about getBrowserIndexForDocument is:

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

Boris Zbarsky

unread,
Nov 17, 2009, 9:35:47 PM11/17/09
to

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

John J. Barton

unread,
Nov 18, 2009, 12:04:57 AM11/18/09
to

Boris Zbarsky

unread,
Nov 18, 2009, 12:16:04 AM11/18/09
to
On 11/18/09 12:04 AM, John J. Barton wrote:
> 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.

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

John J. Barton

unread,
Nov 18, 2009, 12:53:49 AM11/18/09
to

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

Sheppy

unread,
Nov 18, 2009, 9:17:38 AM11/18/09
to
On Nov 18, 12:04 am, "John J. Barton" <johnjbar...@johnjbarton.com>
wrote:

> I updated https://developer.mozilla.org/en/XUL/Method/getBrowserIndexForDocument

The system works!

Eric Shepherd
Developer Documentation Lead
Mozilla Corporation
http://www.bitstampede.com/

John J. Barton

unread,
Nov 18, 2009, 12:21:14 PM11/18/09
to
Sheppy wrote:
> On Nov 18, 12:04 am, "John J. Barton" <johnjbar...@johnjbarton.com>
> wrote:
>
>> I updated https://developer.mozilla.org/en/XUL/Method/getBrowserIndexForDocument
>
> The system works!


Apparently not. My edits were removed.

jjb

Boris Zbarsky

unread,
Nov 18, 2009, 12:12:16 PM11/18/09
to
On 11/18/09 12:21 PM, John J. Barton wrote:
> Apparently not. My edits were removed.

And replaced with text that's fundamentally incorrect, I should note.

-Boris

John J. Barton

unread,
Nov 18, 2009, 12:35:44 PM11/18/09
to

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

Philip Chee

unread,
Nov 18, 2009, 12:44:43 PM11/18/09
to

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

unread,
Nov 19, 2009, 12:17:59 AM11/19/09
to
Due to the magical way devmo works, the first page is actually
_included_ into the second page - that's why there's many pages that
don't make sense outside of the context of the container page, and
random other pages (such as XUL/panel#m-openPopup) which doesn't quite
make sense because the text came from XUL/menupopup#m-openPopup.

--
Mook

P.S. I don't think Ryan's change was accidental, given the change summary.

John J. Barton

unread,
Nov 19, 2009, 12:54:44 AM11/19/09
to

Awesome, I needed a good laugh!
jjb

Boris Zbarsky

unread,
Nov 19, 2009, 12:45:15 AM11/19/09
to
> Due to the magical way devmo works, the first page is actually
> _included_ into the second page

Which page appears higher in searches? I'd hope the second page...

-Boris

John J. Barton

unread,
Nov 19, 2009, 1:05:01 AM11/19/09
to

The second page does not appear in the top 40 results from google or
bing for "getBrowserIndexForDocument".

jjb

0 new messages