mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 993889 part 4. Remove the scope argument of xpc_FastGetCachedWrapper. r=bholley
This commit is contained in:
parent
cd175a1557
commit
adc450e8a7
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user