In Gecko, if an iframe uses the `mozbrowser` attribute, from the point of view of
the inner windows, the iframe is the top level window.
In these iframes, this is true: window.parent === window.
And we often use that to determine if a window is the top level window.
(bug 896523 & 897960).
In Firefox OS, the mozbrowser attribute is used often.
>From MDN:
> <iframe mozbrowser>
> Indicates that the frame is to appear like a top-level browser window
> to the embedded content. This means that window.top, window.parent,
> window.frameElement, etc. will not reflect the frame hierarchy. This
> allows for a web browser UI to be implemented entirely with web
> technology, given the right permissions. See Using the Browser API for
> details. Available in Gecko 13.0 and later.
Instead, it's better to use the docshell hierarchy (see nsIDocShellTreeItem).
Some example:
http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/LayoutHelpers.jsm#367
-- Paul