mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 862446 - Use CallArgs in XPC_WN_Helper_{Call,Construct}; r=bholley
This commit is contained in:
parent
c5d7d7efaf
commit
2b71cc307b
@ -3413,6 +3413,8 @@ BaseStubConstructor(nsIWeakReference* aWeakOwner,
|
||||
const nsGlobalNameStruct *name_struct, JSContext *cx,
|
||||
JSObject *obj, unsigned argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
MOZ_ASSERT(obj);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISupports> native;
|
||||
if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor) {
|
||||
@ -3928,11 +3930,7 @@ nsDOMConstructor::Construct(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
|
||||
JSObject * obj, uint32_t argc, jsval * argv,
|
||||
jsval * vp, bool *_retval)
|
||||
{
|
||||
JSObject* class_obj = JSVAL_TO_OBJECT(argv[-2]);
|
||||
if (!class_obj) {
|
||||
NS_ERROR("nsDOMConstructor::Construct couldn't get constructor object.");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
MOZ_ASSERT(obj);
|
||||
|
||||
const nsGlobalNameStruct *name_struct = GetNameStruct();
|
||||
NS_ENSURE_TRUE(name_struct, NS_ERROR_FAILURE);
|
||||
@ -7431,6 +7429,8 @@ nsDOMConstructorSH::Call(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, uint32_t argc, jsval *argv, jsval *vp,
|
||||
bool *_retval)
|
||||
{
|
||||
MOZ_ASSERT(obj);
|
||||
|
||||
nsDOMConstructor *wrapped =
|
||||
static_cast<nsDOMConstructor *>(wrapper->Native());
|
||||
|
||||
@ -7450,6 +7450,8 @@ nsDOMConstructorSH::Construct(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, uint32_t argc, jsval *argv,
|
||||
jsval *vp, bool *_retval)
|
||||
{
|
||||
MOZ_ASSERT(obj);
|
||||
|
||||
nsDOMConstructor *wrapped =
|
||||
static_cast<nsDOMConstructor *>(wrapper->Native());
|
||||
|
||||
|
@ -956,11 +956,12 @@ XPC_WN_Helper_CheckAccess(JSContext *cx, JSHandleObject obj, JSHandleId id,
|
||||
static JSBool
|
||||
XPC_WN_Helper_Call(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
// N.B. we want obj to be the callee, not JS_THIS(cx, vp)
|
||||
RootedObject obj(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));
|
||||
RootedObject obj(cx, &args.callee());
|
||||
|
||||
XPCCallContext ccx(JS_CALLER, cx, obj, NullPtr(), JSID_VOIDHANDLE,
|
||||
argc, JS_ARGV(cx, vp), vp);
|
||||
XPCCallContext ccx(JS_CALLER, cx, obj, NullPtr(), JSID_VOIDHANDLE, args.length(),
|
||||
args.array(), args.rval().address());
|
||||
if (!ccx.IsValid())
|
||||
return false;
|
||||
|
||||
@ -968,19 +969,20 @@ XPC_WN_Helper_Call(JSContext *cx, unsigned argc, jsval *vp)
|
||||
|
||||
SLIM_LOG_WILL_MORPH(cx, obj);
|
||||
PRE_HELPER_STUB_NO_SLIM
|
||||
Call(wrapper, cx, obj, argc, JS_ARGV(cx, vp), vp, &retval);
|
||||
Call(wrapper, cx, obj, args.length(), args.array(), args.rval().address(), &retval);
|
||||
POST_HELPER_STUB
|
||||
}
|
||||
|
||||
static JSBool
|
||||
XPC_WN_Helper_Construct(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
RootedObject obj(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
RootedObject obj(cx, &args.callee());
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
XPCCallContext ccx(JS_CALLER, cx, obj, NullPtr(), JSID_VOIDHANDLE,
|
||||
argc, JS_ARGV(cx, vp), vp);
|
||||
XPCCallContext ccx(JS_CALLER, cx, obj, NullPtr(), JSID_VOIDHANDLE, args.length(),
|
||||
args.array(), args.rval().address());
|
||||
if (!ccx.IsValid())
|
||||
return false;
|
||||
|
||||
@ -988,7 +990,7 @@ XPC_WN_Helper_Construct(JSContext *cx, unsigned argc, jsval *vp)
|
||||
|
||||
SLIM_LOG_WILL_MORPH(cx, obj);
|
||||
PRE_HELPER_STUB_NO_SLIM
|
||||
Construct(wrapper, cx, obj, argc, JS_ARGV(cx, vp), vp, &retval);
|
||||
Construct(wrapper, cx, obj, args.length(), args.array(), args.rval().address(), &retval);
|
||||
POST_HELPER_STUB
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user