Fixing bug 418776. Don't resolve standard classes on non-global objects. r+sr=mrbkap@gmail.com
authorjst@mozilla.org
Tue, 18 Mar 2008 13:42:19 -0700
changeset 13266 9f4d8d7f95304bf1679634e7ff093a5b1a9782cb
parent 13265 7ae1806d484e32756537f18d847266dfa9bb0742
child 13267 3d4062588c0f5187e90cd962c70750c62c03f18a
push idunknown
push userunknown
push dateunknown
bugs418776
milestone1.9b5pre
Fixing bug 418776. Don't resolve standard classes on non-global objects. r+sr=mrbkap@gmail.com
dom/src/base/nsDOMClassInfo.cpp
--- a/dom/src/base/nsDOMClassInfo.cpp
+++ b/dom/src/base/nsDOMClassInfo.cpp
@@ -5787,18 +5787,22 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp
   // for this case.
 
   JSBool did_resolve = JS_FALSE;
   PRBool doSecurityCheckInAddProperty = sDoSecurityCheckInAddProperty;
   sDoSecurityCheckInAddProperty = PR_FALSE;
 
   JSAutoRequest ar(my_cx);
 
-  // Don't resolve standard classes on XPCNativeWrapper.
-  JSBool ok = !ObjectIsNativeWrapper(cx, obj) ?
+  JSObject *realObj;
+  wrapper->GetJSObject(&realObj);
+
+  // Don't resolve standard classes on XPCNativeWrapper etc, only
+  // resolve them if we're resolving on the real global object.
+  JSBool ok = obj == realObj ?
               ::JS_ResolveStandardClass(my_cx, obj, id, &did_resolve) :
               JS_TRUE;
 
   sDoSecurityCheckInAddProperty = doSecurityCheckInAddProperty;
 
   if (!ok) {
     // Trust the JS engine (or the script security manager) to set
     // the exception in the JS engine.