Re: scopes, execution contexts, and scripts

Boris Zbarsky <[email protected]> Mon, 25 Jan 2010 22:40:56 -0500
Newsgroups gmane.comp.mozilla.devel.jsdebugger
Message-ID <[email protected]>
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)?

-Boris