Bug 1140573 part 4. Drop the parent argument from js::NewFunctionByIdWithReserved. r=waldo

This commit is contained in:
Boris Zbarsky 2015-03-09 12:50:08 -04:00
parent 47026f3bb1
commit c008103de3
7 changed files with 9 additions and 12 deletions

View File

@ -984,8 +984,7 @@ static JSObject*
XrayCreateFunction(JSContext* cx, JS::Handle<JSObject*> wrapper,
JSNativeWrapper native, unsigned nargs, JS::Handle<jsid> id)
{
JSFunction* fun = js::NewFunctionByIdWithReserved(cx, native.op, nargs, 0,
/* parent = */nullptr, id);
JSFunction* fun = js::NewFunctionByIdWithReserved(cx, native.op, nargs, 0, id);
if (!fun) {
return nullptr;
}

View File

@ -341,7 +341,7 @@ nsXBLProtoImplField::InstallAccessors(JSContext* aCx,
JS::Rooted<JSObject*> get(aCx,
JS_GetFunctionObject(js::NewFunctionByIdWithReserved(aCx, FieldGetter,
0, 0, scopeObject, id)));
0, 0, id)));
if (!get) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -351,7 +351,7 @@ nsXBLProtoImplField::InstallAccessors(JSContext* aCx,
JS::Rooted<JSObject*> set(aCx,
JS_GetFunctionObject(js::NewFunctionByIdWithReserved(aCx, FieldSetter,
1, 0, scopeObject, id)));
1, 0, id)));
if (!set) {
return NS_ERROR_OUT_OF_MEMORY;
}

View File

@ -440,18 +440,16 @@ js::NewFunctionWithReserved(JSContext *cx, JSNative native, unsigned nargs, unsi
}
JS_FRIEND_API(JSFunction *)
js::NewFunctionByIdWithReserved(JSContext *cx, JSNative native, unsigned nargs, unsigned flags, JSObject *parentArg,
js::NewFunctionByIdWithReserved(JSContext *cx, JSNative native, unsigned nargs, unsigned flags,
jsid id)
{
RootedObject parent(cx, parentArg);
MOZ_ASSERT(JSID_IS_STRING(id));
MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment()));
CHECK_REQUEST(cx);
assertSameCompartment(cx, parent);
RootedAtom atom(cx, JSID_TO_ATOM(id));
JSFunction::Flags funFlags = JSAPIToJSFunctionFlags(flags);
return NewFunction(cx, NullPtr(), native, nargs, funFlags, parent, atom,
return NewFunction(cx, NullPtr(), native, nargs, funFlags, NullPtr(), atom,
JSFunction::ExtendedFinalizeKind);
}

View File

@ -740,7 +740,7 @@ NewFunctionWithReserved(JSContext *cx, JSNative call, unsigned nargs, unsigned f
JS_FRIEND_API(JSFunction *)
NewFunctionByIdWithReserved(JSContext *cx, JSNative native, unsigned nargs, unsigned flags,
JSObject *parent, jsid id);
jsid id);
JS_FRIEND_API(const JS::Value &)
GetFunctionNativeReserved(JSObject *fun, size_t which);

View File

@ -1263,7 +1263,7 @@ js::proxy_revocable(JSContext *cx, unsigned argc, Value *vp)
RootedValue proxyVal(cx, args.rval());
MOZ_ASSERT(proxyVal.toObject().is<ProxyObject>());
RootedObject revoker(cx, NewFunctionByIdWithReserved(cx, RevokeProxy, 0, 0, cx->global(),
RootedObject revoker(cx, NewFunctionByIdWithReserved(cx, RevokeProxy, 0, 0,
AtomToId(cx->names().revoke)));
if (!revoker)
return false;

View File

@ -328,7 +328,7 @@ NewFunctionForwarder(JSContext *cx, HandleId idArg, HandleObject callable,
id = GetRTIdByIndex(cx, XPCJSRuntime::IDX_EMPTYSTRING);
JSFunction *fun = js::NewFunctionByIdWithReserved(cx, FunctionForwarder,
0,0, JS::CurrentGlobalOrNull(cx), id);
0, 0, id);
if (!fun)
return false;

View File

@ -85,7 +85,7 @@ XPCNativeMember::Resolve(XPCCallContext& ccx, XPCNativeInterface* iface,
callback = XPC_WN_GetterSetter;
}
JSFunction *fun = js::NewFunctionByIdWithReserved(ccx, callback, argc, 0, nullptr, GetName());
JSFunction *fun = js::NewFunctionByIdWithReserved(ccx, callback, argc, 0, GetName());
if (!fun)
return false;