Bug 658909 - Set args at XPCCallContext construct time in XPC_WN_GetterSetter. r=mrbkap

It's not clear to me why it's done this way, but it confuses our ability to
determine during wrapper lookup whether we're doing a set or a get. This aligns
the behavior with XPC_WN_CallMethod, including passing JSID_VOID for the name
(which is safe because XPCCallContext explicitly special-cases JSID_VOID and
doesn't call SetName in that case).
This commit is contained in:
Bobby Holley 2013-03-16 22:58:13 -07:00
parent 3e05c5d01b
commit 0ac4a08fc8

View File

@ -1441,7 +1441,7 @@ XPC_WN_GetterSetter(JSContext *cx, unsigned argc, jsval *vp)
if (IS_SLIM_WRAPPER(obj) && !MorphSlimWrapper(cx, obj)) if (IS_SLIM_WRAPPER(obj) && !MorphSlimWrapper(cx, obj))
return Throw(NS_ERROR_XPC_BAD_OP_ON_WN_PROTO, cx); return Throw(NS_ERROR_XPC_BAD_OP_ON_WN_PROTO, cx);
XPCCallContext ccx(JS_CALLER, cx, obj, funobj); XPCCallContext ccx(JS_CALLER, cx, obj, funobj, JSID_VOID, argc, JS_ARGV(cx, vp), vp);
XPCWrappedNative* wrapper = ccx.GetWrapper(); XPCWrappedNative* wrapper = ccx.GetWrapper();
THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper); THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper);
@ -1451,7 +1451,6 @@ XPC_WN_GetterSetter(JSContext *cx, unsigned argc, jsval *vp)
if (!XPCNativeMember::GetCallInfo(funobj, &iface, &member)) if (!XPCNativeMember::GetCallInfo(funobj, &iface, &member))
return Throw(NS_ERROR_XPC_CANT_GET_METHOD_INFO, cx); return Throw(NS_ERROR_XPC_CANT_GET_METHOD_INFO, cx);
ccx.SetArgsAndResultPtr(argc, JS_ARGV(cx, vp), vp);
if (argc && member->IsWritableAttribute()) { if (argc && member->IsWritableAttribute()) {
ccx.SetCallInfo(iface, member, true); ccx.SetCallInfo(iface, member, true);
JSBool retval = XPCWrappedNative::SetAttribute(ccx); JSBool retval = XPCWrappedNative::SetAttribute(ccx);