Subj : Re: Notification when leaving a scope, and attaching custom data To : Benjamin D. Smedberg From : Brendan Eich Date : Sat Jun 26 2004 07:59 pm Benjamin D. Smedberg wrote: > I have been looking at the > netscape.security.PrivilegeManager.enablePrivilege() functionality, and > I'm trying to figure out how it is implemented within spidermonkey. This > function must keep "state" information about the currently active script > context, and presumably is notified when a script reaches the end of the > current block/function. Is this correct? What API does it use? Excellent question. In the 4.x codebase and JIT'ed JVMs, we had hooks to downgrade privileges on return from a Java method that had enabled. It used jsdbgapi.h, in particular JS_SetFrameAnnotation etc. (http://lxr.mozilla.org/mozilla/search?string=FrameAnnotation). See also http://lxr.mozilla.org/mozilla/source/caps/src/nsPrincipal.cpp#418 and http://lxr.mozilla.org/mozilla/search?string=mAnnotations. Cc'ing caillon. /be .