Subj : Re: JS_EvaluateScriptForPrincipals() vs JS_EvaluateScript() To : Oystein Hallaraker From : Brendan Eich Date : Wed Jun 30 2004 08:26 pm Oystein Hallaraker wrote: > that's a possibility... but I really want to understand what is going on! http://lxr.mozilla.org/mozilla/ is your friend. > This is what I believe is going on between spidermonkey and the dom, > please correct me where I am wrong (I assume that will be alot...): > > The dom will first initialize a runtime, Actually, xpconnect does that: http://lxr.mozilla.org/mozilla/source/js/src/xpconnect/src/xpcruntimesvc.cpp#106. > the global object and the > standard ecma objects (date,boolean etc). But when are all the dom > objects initialized in spiderMonkey as JSObjects and XPCWrappedNative's? > Does this happen in the initialization process or when a script tries to > access a property that has not been initialized as a JSObject? See http://lxr.mozilla.org/mozilla/source/dom/src/base/nsDOMClassInfo.cpp#4160 among other hits for http://lxr.mozilla.org/mozilla/search?string=JS_ResolveStandardClass. > As far as > I have understood this, all dom objects will be registered as JSObjects > and XPCWrappedNative objects in spidermonkey, You're mixing things. JSObject is SpiderMonkey's type. XPCWrappedNative is XPConnect's type for a C++ type that has a JS object wrapping it. They are not both registered "in spidermonkey". > with callbacks back to the DOM. > > I can see that the Principals are used in the DOM, but I cannot see > where the principals are used in spidermonkey... Maybe it's just me, but > I have been looking at that for weeks... Did you look at JSPRINCIPALS_HOLD as I suggested? http://lxr.mozilla.org/mozilla/search?string=JSPRINCIPALS_HOLD, in particular http://lxr.mozilla.org/mozilla/source/js/src/jsscript.c#1104. /be .