зеркало из https://github.com/mozilla/pjs.git
bug 580128 - Fix getting doubled wrapped objects in XPConnect. r=mrbkap
This commit is contained in:
Родитель
e5837bfacc
Коммит
763715fac1
|
@ -1363,9 +1363,20 @@ mozJSComponentLoader::Import(const nsACString & registryLocation)
|
|||
targetObject = JS_GetGlobalForObject(cx, targetObject);
|
||||
}
|
||||
|
||||
JSAutoEnterCompartment ac;
|
||||
if (!ac.enter(cx, targetObject)) {
|
||||
NS_ERROR("can't enter compartment");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
JSObject *globalObj = nsnull;
|
||||
rv = ImportInto(registryLocation, targetObject, cc, &globalObj);
|
||||
|
||||
if (!JS_WrapObject(cx, &globalObj)) {
|
||||
NS_ERROR("can't wrap return value");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
jsval *retval = nsnull;
|
||||
cc->GetRetValPtr(&retval);
|
||||
if (retval)
|
||||
|
|
|
@ -186,6 +186,10 @@ GetDoubleWrappedJSObject(XPCCallContext& ccx, XPCWrappedNative* wrapper)
|
|||
jsid id = ccx.GetRuntime()->
|
||||
GetStringID(XPCJSRuntime::IDX_WRAPPED_JSOBJECT);
|
||||
|
||||
JSAutoEnterCompartment ac;
|
||||
if(!ac.enter(ccx, mainObj))
|
||||
return NULL;
|
||||
|
||||
jsval val;
|
||||
if(JS_GetPropertyById(ccx, mainObj, id, &val) &&
|
||||
!JSVAL_IS_PRIMITIVE(val))
|
||||
|
@ -258,7 +262,7 @@ XPC_WN_DoubleWrappedGetter(JSContext *cx, uintN argc, jsval *vp)
|
|||
}
|
||||
}
|
||||
*vp = OBJECT_TO_JSVAL(realObject);
|
||||
return JS_TRUE;
|
||||
return JS_WrapValue(cx, vp);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
|
Загрузка…
Ссылка в новой задаче