Re: scopes, execution contexts, and scripts
Boris Zbarsky <[email protected]> Fri, 22 Jan 2010 12:23:24 -0500
| Newsgroups | gmane.comp.mozilla.devel.jsdebugger |
|---|---|
| Message-ID | <[email protected]> |
On 1/22/10 11:26 AM, John J. Barton wrote: >>> If I apply the same correction to the globalObject for jsdIContext we'd >>> have "youngest scope for this context", but that does not make any more >>> sense to me. >> >> Sure. That's because there's no age anything going on there. > > So outermost scope. Or last-to-be-used-for lookup. As it happens, no. Lookups follow the parent and prototype chains. Where those terminate depends on the embedding. In the Firefox case, for example, the outermost scope is the inner window's JSObject (whereas the context's global is the outer window's JSObject). In particular, when you navigate from one page to another the outermost scope becomes a new object whereas the context's global doesn't change object identity (though it does have al tis properties removed). > "That sort of thing" needs to be sorted out. esp setTimeout and > setInterval. setTimeout and setInterval run on the JSContext of the window they were set on. > Chromebug chases the frame.scope to its outermost "global" object and > uses that to find the HTML/DOM/metadata to show the user for a frame. > Firebug does the same, but if the result is not a window, it looks into > older frames until it finds a window. That seems sensible. -Boris