Bug 1140582. Remove the parent argument from JS_NewObjectWithUniqueType. r=waldo

This commit is contained in:
Boris Zbarsky 2015-03-09 12:49:50 -04:00
parent 7fdbca2023
commit 8ece71391b
5 changed files with 8 additions and 11 deletions

View File

@ -1898,8 +1898,7 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
}
dot_prototype = ::JS_NewObjectWithUniqueType(cx,
&sDOMConstructorProtoClass,
proto,
winobj);
proto);
NS_ENSURE_TRUE(dot_prototype, NS_ERROR_OUT_OF_MEMORY);
}
}

View File

@ -614,7 +614,7 @@ CreateInterfacePrototypeObject(JSContext* cx, JS::Handle<JSObject*> global,
const NativeProperties* chromeOnlyProperties)
{
JS::Rooted<JSObject*> ourProto(cx,
JS_NewObjectWithUniqueType(cx, Jsvalify(protoClass), parentProto, global));
JS_NewObjectWithUniqueType(cx, Jsvalify(protoClass), parentProto));
if (!ourProto ||
!DefineProperties(cx, ourProto, properties, chromeOnlyProperties)) {
return nullptr;

View File

@ -127,8 +127,7 @@ JS_SplicePrototype(JSContext *cx, HandleObject obj, HandleObject proto)
}
JS_FRIEND_API(JSObject *)
JS_NewObjectWithUniqueType(JSContext *cx, const JSClass *clasp, HandleObject proto,
HandleObject parent)
JS_NewObjectWithUniqueType(JSContext *cx, const JSClass *clasp, HandleObject proto)
{
/*
* Create our object with a null proto and then splice in the correct proto
@ -137,7 +136,7 @@ JS_NewObjectWithUniqueType(JSContext *cx, const JSClass *clasp, HandleObject pro
* we're not going to be using that ObjectGroup anyway.
*/
RootedObject obj(cx, NewObjectWithGivenProto(cx, (const js::Class *)clasp, NullPtr(),
parent, SingletonObject));
NullPtr(), SingletonObject));
if (!obj)
return nullptr;
if (!JS_SplicePrototype(cx, obj, proto))

View File

@ -57,8 +57,7 @@ extern JS_FRIEND_API(bool)
JS_SplicePrototype(JSContext *cx, JS::HandleObject obj, JS::HandleObject proto);
extern JS_FRIEND_API(JSObject *)
JS_NewObjectWithUniqueType(JSContext *cx, const JSClass *clasp, JS::HandleObject proto,
JS::HandleObject parent);
JS_NewObjectWithUniqueType(JSContext *cx, const JSClass *clasp, JS::HandleObject proto);
// Allocate an object in exactly the same way as JS_NewObjectWithGivenProto, but
// without invoking the metadata callback on it. This allows creation of

View File

@ -87,10 +87,10 @@ XPCWrappedNativeProto::Init(const XPCNativeScriptableCreateInfo* scriptableCreat
jsclazz = &XPC_WN_NoMods_NoCall_Proto_JSClass;
}
JS::RootedObject parent(cx, mScope->GetGlobalJSObject());
JS::RootedObject proto(cx, JS_GetObjectPrototype(cx, parent));
JS::RootedObject global(cx, mScope->GetGlobalJSObject());
JS::RootedObject proto(cx, JS_GetObjectPrototype(cx, global));
mJSProtoObject = JS_NewObjectWithUniqueType(cx, js::Jsvalify(jsclazz),
proto, parent);
proto);
bool success = !!mJSProtoObject;
if (success) {