Bug 1140573 part 3. Drop the parent argument from js::NewFunctionWithReserved. r=waldo

This commit is contained in:
Boris Zbarsky 2015-03-09 12:50:07 -04:00
parent add82dfc14
commit 7c3e3e3096
7 changed files with 12 additions and 17 deletions

View File

@ -1243,7 +1243,7 @@ Console::ProcessCallData(ConsoleCallData* aData)
}
} else {
JSFunction* fun = js::NewFunctionWithReserved(cx, LazyStackGetter, 0, 0,
eventObj, "stacktrace");
"stacktrace");
if (!fun) {
return;
}

View File

@ -425,8 +425,7 @@ CreateConstructor(JSContext* cx, JS::Handle<JSObject*> global, const char* name,
const JSNativeHolder* nativeHolder, unsigned ctorNargs)
{
JSFunction* fun = js::NewFunctionWithReserved(cx, Constructor, ctorNargs,
JSFUN_CONSTRUCTOR, global,
name);
JSFUN_CONSTRUCTOR, name);
if (!fun) {
return nullptr;
}

View File

@ -649,7 +649,7 @@ public:
// DataStore will run this callback when the revisionID is retrieved.
JSFunction* func = js::NewFunctionWithReserved(aCx, JSCallback,
0 /* nargs */, 0 /* flags */,
nullptr, nullptr);
nullptr);
if (!func) {
return;
}

View File

@ -504,12 +504,11 @@ Promise::JSCallbackThenableRejecter(JSContext* aCx,
}
/* static */ JSObject*
Promise::CreateFunction(JSContext* aCx, JSObject* aParent, Promise* aPromise,
int32_t aTask)
Promise::CreateFunction(JSContext* aCx, Promise* aPromise, int32_t aTask)
{
JSFunction* func = js::NewFunctionWithReserved(aCx, JSCallback,
1 /* nargs */, 0 /* flags */,
aParent, nullptr);
nullptr);
if (!func) {
return nullptr;
}
@ -536,7 +535,7 @@ Promise::CreateThenableFunction(JSContext* aCx, Promise* aPromise, uint32_t aTas
JSFunction* func = js::NewFunctionWithReserved(aCx, whichFunc,
1 /* nargs */, 0 /* flags */,
nullptr, nullptr);
nullptr);
if (!func) {
return nullptr;
}
@ -584,7 +583,7 @@ Promise::CallInitFunction(const GlobalObject& aGlobal,
JSContext* cx = aGlobal.Context();
JS::Rooted<JSObject*> resolveFunc(cx,
CreateFunction(cx, aGlobal.Get(), this,
CreateFunction(cx, this,
PromiseCallback::Resolve));
if (!resolveFunc) {
aRv.Throw(NS_ERROR_UNEXPECTED);
@ -592,7 +591,7 @@ Promise::CallInitFunction(const GlobalObject& aGlobal,
}
JS::Rooted<JSObject*> rejectFunc(cx,
CreateFunction(cx, aGlobal.Get(), this,
CreateFunction(cx, this,
PromiseCallback::Reject));
if (!rejectFunc) {
aRv.Throw(NS_ERROR_UNEXPECTED);

View File

@ -291,8 +291,7 @@ private:
JSCallbackThenableRejecter(JSContext *aCx, unsigned aArgc, JS::Value *aVp);
static JSObject*
CreateFunction(JSContext* aCx, JSObject* aParent, Promise* aPromise,
int32_t aTask);
CreateFunction(JSContext* aCx, Promise* aPromise, int32_t aTask);
static JSObject*
CreateThenableFunction(JSContext* aCx, Promise* aPromise, uint32_t aTask);

View File

@ -421,13 +421,11 @@ js::DefineFunctionWithReserved(JSContext *cx, JSObject *objArg, const char *name
JS_FRIEND_API(JSFunction *)
js::NewFunctionWithReserved(JSContext *cx, JSNative native, unsigned nargs, unsigned flags,
JSObject *parentArg, const char *name)
const char *name)
{
RootedObject parent(cx, parentArg);
MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment()));
CHECK_REQUEST(cx);
assertSameCompartment(cx, parent);
RootedAtom atom(cx);
if (name) {
@ -437,7 +435,7 @@ js::NewFunctionWithReserved(JSContext *cx, JSNative native, unsigned nargs, unsi
}
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

@ -736,7 +736,7 @@ DefineFunctionWithReserved(JSContext *cx, JSObject *obj, const char *name, JSNat
JS_FRIEND_API(JSFunction *)
NewFunctionWithReserved(JSContext *cx, JSNative call, unsigned nargs, unsigned flags,
JSObject *parent, const char *name);
const char *name);
JS_FRIEND_API(JSFunction *)
NewFunctionByIdWithReserved(JSContext *cx, JSNative native, unsigned nargs, unsigned flags,