Bug 565230 - Don't try to resolve standard classes if an XPCNativeWrapper is resolving through us. r=gal
☠☠ backed out by 9e3bd9e9da72 ☠ ☠
authorBlake Kaplan <mrbkap@gmail.com>
Thu, 10 Jun 2010 14:48:19 -0700
changeset 47477 5e948055cc43ead9b9948bbbabbfe8c18ed7962d
parent 47476 7edf86f575bd19661a641730826a457ad60edf76
child 47478 5596ecfb9ad2a696d722f0c9433ac9a6320d96e2
child 47482 9e3bd9e9da725ec0c1279e82fa1b0d17539596de
push idunknown
push userunknown
push dateunknown
reviewersgal
bugs565230
milestone1.9.3a5pre
Bug 565230 - Don't try to resolve standard classes if an XPCNativeWrapper is resolving through us. r=gal
js/src/xpconnect/src/xpcruntimesvc.cpp
js/src/xpconnect/tests/unit/test_bug565230.js
--- a/js/src/xpconnect/src/xpcruntimesvc.cpp
+++ b/js/src/xpconnect/src/xpcruntimesvc.cpp
@@ -67,21 +67,27 @@ NS_IMPL_THREADSAFE_RELEASE(BackstagePass
 
 /* PRBool newResolve (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in jsval id, in PRUint32 flags, out JSObjectPtr objp); */
 NS_IMETHODIMP
 BackstagePass::NewResolve(nsIXPConnectWrappedNative *wrapper,
                           JSContext * cx, JSObject * obj,
                           jsval id, PRUint32 flags, 
                           JSObject * *objp, PRBool *_retval)
 {
-    JSBool resolved;
+    JSObject *realObj;
+    wrapper->GetJSObject(&realObj);
 
-    *_retval = JS_ResolveStandardClass(cx, obj, id, &resolved);
-    if(*_retval && resolved)
-        *objp = obj;
+    if(obj == realObj)
+    {
+        JSBool resolved;
+        *_retval = JS_ResolveStandardClass(cx, obj, id, &resolved);
+        if(*_retval && resolved)
+            *objp = obj;
+    }
+
     return NS_OK;
 }
 
 /***************************************************************************/
 /* void getInterfaces (out PRUint32 count, [array, size_is (count), retval] 
                        out nsIIDPtr array); */
 NS_IMETHODIMP 
 BackstagePass::GetInterfaces(PRUint32 *aCount, nsIID * **aArray)
new file mode 100644
--- /dev/null
+++ b/js/src/xpconnect/tests/unit/test_bug565230.js
@@ -0,0 +1,1 @@
+do_check_eq(new XPCNativeWrapper(this).valueOf, undefined);