Re: scopes, execution contexts, and scripts
"John J. Barton" <[email protected]> Mon, 25 Jan 2010 21:10:49 -0800
| Newsgroups | gmane.comp.mozilla.devel.jsdebugger |
|---|---|
| Message-ID | <[email protected]> |
Boris Zbarsky wrote:
> On 1/25/10 9:10 PM, John J Barton wrote:
>>> if (win instanceof ChromeWindow) {
>>> /* It's a chrome window */
>>> }
>>
>> Thanks, but I want the reverse test, I want to know it is a content
>> window (since I guess there may be Window objects that are not
>> ChromeWindow objects and not content windows.
>
> if (win instanceof Window && !(win instanceof ChromeWindow))) {
> }
>
> Though you might need Components.interfaces.nsIDOMWindow and
> nsIDOMChromeWindow respectively, depending on whether Window and
> ChromeWindow do the right thing for cross-scope access.
>
>> Good question! The one I am trying to answer now! For content windows,
>> pagehide or unload handlers; for ChromeWindows, unload handlers; for
>> non-windows, my only story so far is exit the app.
>
> Hmm... How common is the non-window case for Firebug (not Chromebug)?
Can't happen by design. There is no path to the context-creation except
from APIs that give nsIDOMWindow.
>
> -Boris
>