Don't try to waive Xray wrapper for primitives (604361, r=mrbkap).
authorAndreas Gal <gal@mozilla.com>
Thu, 14 Oct 2010 13:41:52 -0700
changeset 55815 4666d67cba753b5d4f84c15c56561e9ed1055619
parent 55814 cb298b961fe24bed883d0fe2599f913a5450f0f8
child 55816 ed24c21e64978e5cefc02e7b46ad46836feaa864
push idunknown
push userunknown
push dateunknown
reviewersmrbkap
bugs604361
milestone2.0b8pre
Don't try to waive Xray wrapper for primitives (604361, r=mrbkap).
js/jsd/jsd_val.c
js/src/xpconnect/wrappers/WrapperFactory.cpp
--- a/js/jsd/jsd_val.c
+++ b/js/jsd/jsd_val.c
@@ -672,17 +672,17 @@ jsd_GetValueParent(JSDContext* jsdc, JSD
         JSObject* parent;
         JS_ASSERT(!jsdval->parent);
         SET_BIT_FLAG(jsdval->flags, GOT_PARENT);
         if(!JSVAL_IS_OBJECT(jsdval->val))
             return NULL;
         if(!(obj = JSVAL_TO_OBJECT(jsdval->val)))
             return NULL;
         JS_BeginRequest(jsdc->dumbContext);
-        call = JS_EnterCrossCompartmentCall(jsdc->dumbContext, jsdc->glob);
+        call = JS_EnterCrossCompartmentCall(jsdc->dumbContext,obj);
         if(!call) {
             JS_EndRequest(jsdc->dumbContext);
             
             return NULL;
         }
         parent = JS_GetParent(jsdc->dumbContext,obj);
         JS_LeaveCrossCompartmentCall(call);
         JS_EndRequest(jsdc->dumbContext);
--- a/js/src/xpconnect/wrappers/WrapperFactory.cpp
+++ b/js/src/xpconnect/wrappers/WrapperFactory.cpp
@@ -278,18 +278,18 @@ WrapperFactory::WrapLocationObject(JSCon
         return NULL;
     wrapperObj->setProxyExtra(js::ObjectValue(*xrayHolder));
     return wrapperObj;
 }
 
 bool
 WrapperFactory::WaiveXrayAndWrap(JSContext *cx, jsval *vp)
 {
-    if (!JSVAL_IS_OBJECT(*vp))
-        return true;
+    if (JSVAL_IS_PRIMITIVE(*vp))
+        return JS_WrapValue(cx, vp);
 
     JSObject *obj = JSVAL_TO_OBJECT(*vp)->unwrap();
 
     // We have to make sure that if we're wrapping an outer window, that
     // the .wrappedJSObject also wraps the outer window.
     OBJ_TO_OUTER_OBJECT(cx, obj);
     if (!obj)
         return false;