Bug 1140582. Remove the parent argument from JS_NewObjectWithUniqueType. r=waldo
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 09 Mar 2015 12:49:50 -0400
changeset 249256 b45b569aa36516ff66b3bb313199ce7f483ca49a
parent 249255 8572d3e909a3e55de6decfd7041a5d4d4d382e88
child 249257 0ba66387063628463083f36d458c9282e77b0129
push id971
push userjbruaroey@mozilla.com
push dateTue, 10 Mar 2015 17:33:09 +0000
reviewerswaldo
bugs1140582
milestone39.0a1
Bug 1140582. Remove the parent argument from JS_NewObjectWithUniqueType. r=waldo
dom/base/nsDOMClassInfo.cpp
dom/bindings/BindingUtils.cpp
js/src/jsfriendapi.cpp
js/src/jsfriendapi.h
js/xpconnect/src/XPCWrappedNativeProto.cpp
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -1893,18 +1893,17 @@ ResolvePrototype(nsIXPConnect *aXPConnec
       }
     } else {
       JSAutoCompartment ac(cx, winobj);
       if (!proto) {
         proto = JS_GetObjectPrototype(cx, winobj);
       }
       dot_prototype = ::JS_NewObjectWithUniqueType(cx,
                                                    &sDOMConstructorProtoClass,
-                                                   proto,
-                                                   winobj);
+                                                   proto);
       NS_ENSURE_TRUE(dot_prototype, NS_ERROR_OUT_OF_MEMORY);
     }
   }
 
   v = OBJECT_TO_JSVAL(dot_prototype);
 
   JSAutoCompartment ac(cx, class_obj);
 
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -609,17 +609,17 @@ DefineWebIDLBindingPropertiesOnXPCObject
 static JSObject*
 CreateInterfacePrototypeObject(JSContext* cx, JS::Handle<JSObject*> global,
                                JS::Handle<JSObject*> parentProto,
                                const js::Class* protoClass,
                                const NativeProperties* properties,
                                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;
   }
 
   return ourProto;
 }
 
--- a/js/src/jsfriendapi.cpp
+++ b/js/src/jsfriendapi.cpp
@@ -122,27 +122,26 @@ JS_SplicePrototype(JSContext *cx, Handle
         return JS_SetPrototype(cx, obj, proto);
     }
 
     Rooted<TaggedProto> tagged(cx, TaggedProto(proto));
     return obj->splicePrototype(cx, obj->getClass(), tagged);
 }
 
 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
      * after we setSingleton, so that we don't pollute the default
      * ObjectGroup attached to our proto with information about our object, since
      * 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))
         return nullptr;
     return obj;
 }
 
 JS_FRIEND_API(JSObject *)
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -52,18 +52,17 @@ JS_FindCompilationScope(JSContext *cx, J
 
 extern JS_FRIEND_API(JSFunction *)
 JS_GetObjectFunction(JSObject *obj);
 
 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
 // internal bookkeeping objects that are guaranteed to not have metadata
 // attached to them.
 extern JS_FRIEND_API(JSObject *)
 JS_NewObjectWithoutMetadata(JSContext *cx, const JSClass *clasp, JS::Handle<JSObject*> proto);
 
--- a/js/xpconnect/src/XPCWrappedNativeProto.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeProto.cpp
@@ -82,20 +82,20 @@ XPCWrappedNativeProto::Init(const XPCNat
             jsclazz = flags.WantCall() ?
                 &XPC_WN_NoMods_WithCall_Proto_JSClass :
                 &XPC_WN_NoMods_NoCall_Proto_JSClass;
         }
     } else {
         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) {
         JS_SetPrivate(mJSProtoObject, this);
         if (callPostCreatePrototype)
             success = CallPostCreatePrototype();
     }