Don't try to waive Xray wrapper for primitives (604361, r=mrbkap).
Don't try to waive Xray wrapper for primitives (604361, r=mrbkap).
--- 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;