Bug 993889 part 4. Remove the scope argument of xpc_FastGetCachedWrapper. r=bholley

This commit is contained in:
Boris Zbarsky 2014-04-10 00:58:42 -04:00
parent cd175a1557
commit adc450e8a7
5 changed files with 9 additions and 9 deletions

View File

@ -5651,9 +5651,7 @@ nsContentUtils::WrapNative(JSContext *cx, nsISupports *native,
return NS_OK;
}
JS::Rooted<JSObject*> scope(cx, JS::CurrentGlobalOrNull(cx));
JSObject *wrapper = xpc_FastGetCachedWrapper(cache, scope, vp);
JSObject *wrapper = xpc_FastGetCachedWrapper(cx, cache, vp);
if (wrapper) {
return NS_OK;
}
@ -5665,6 +5663,7 @@ nsContentUtils::WrapNative(JSContext *cx, nsISupports *native,
}
nsresult rv = NS_OK;
JS::Rooted<JSObject*> scope(cx, JS::CurrentGlobalOrNull(cx));
AutoPushJSContext context(cx);
rv = sXPConnect->WrapNativeToJSVal(context, scope, native, cache, aIID,
aAllowWrapping, vp);

View File

@ -563,12 +563,12 @@ WrapNative(JSContext *cx, nsISupports *native,
return NS_OK;
}
JS::Rooted<JSObject*> scope(cx, JS::CurrentGlobalOrNull(cx));
JSObject *wrapper = xpc_FastGetCachedWrapper(cache, scope, vp);
JSObject *wrapper = xpc_FastGetCachedWrapper(cx, cache, vp);
if (wrapper) {
return NS_OK;
}
JS::Rooted<JSObject*> scope(cx, JS::CurrentGlobalOrNull(cx));
return nsDOMClassInfo::XPConnect()->WrapNativeToJSVal(cx, scope, native,
cache, aIID,
aAllowWrapping, vp);

View File

@ -1167,7 +1167,8 @@ WrapObject(JSContext* cx, JS::Handle<JSObject*> scope, T* p,
nsWrapperCache* cache, const nsIID* iid,
JS::MutableHandle<JS::Value> rval)
{
if (xpc_FastGetCachedWrapper(cache, scope, rval))
MOZ_ASSERT(js::IsObjectInContextCompartment(scope, cx));
if (xpc_FastGetCachedWrapper(cx, cache, rval))
return true;
qsObjectHelper helper(p, cache);
return XPCOMObjectToJsval(cx, scope, helper, iid, true, rval);

View File

@ -706,7 +706,7 @@ def writeResultConv(f, type, jsvalPtr, jsvalRef):
" return true;\n"
" }\n"
" nsWrapperCache* cache = xpc_qsGetWrapperCache(result);\n"
" if (xpc_FastGetCachedWrapper(cache, obj, %s)) {\n"
" if (xpc_FastGetCachedWrapper(cx, cache, %s)) {\n"
" return true;\n"
" }\n"
" // After this point do not use 'result'!\n"

View File

@ -144,12 +144,12 @@ struct RuntimeStats;
#define XPCONNECT_GLOBAL_FLAGS XPCONNECT_GLOBAL_FLAGS_WITH_EXTRA_SLOTS(0)
inline JSObject*
xpc_FastGetCachedWrapper(nsWrapperCache *cache, JSObject *scope, JS::MutableHandleValue vp)
xpc_FastGetCachedWrapper(JSContext *cx, nsWrapperCache *cache, JS::MutableHandleValue vp)
{
if (cache) {
JSObject* wrapper = cache->GetWrapper();
if (wrapper &&
js::GetObjectCompartment(wrapper) == js::GetObjectCompartment(scope))
js::GetObjectCompartment(wrapper) == js::GetContextCompartment(cx))
{
vp.setObject(*wrapper);
return wrapper;