Deal with removal of the js_GetClassPrototype API
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 10 Feb 2012 17:53:32 -0500
changeset 86750 253d25b4dcbecd831bdabc8c35ce1ef68926af8b
parent 86749 0c6f1e615f6829c0139b69dc88580e1f295e1a21
child 86751 27d34da3ffcd4213118dc1bd19bdc5757b231e0f
push id104
push userbzbarsky@mozilla.com
push dateFri, 10 Feb 2012 23:16:50 +0000
milestone13.0a1
Deal with removal of the js_GetClassPrototype API
dom/bindings/Codegen.py
dom/bindings/Utils.cpp
dom/bindings/Utils.h
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -409,17 +409,17 @@ class AttrDefiner:
 
 class CGCreateProtoObjectMethod(CGAbstractMethod):
     def __init__(self, descriptor):
         args = [Argument('JSContext*', 'aCx'), Argument('JSObject*', 'aGlobal')]
         CGAbstractMethod.__init__(self, descriptor, 'CreateProtoObject', 'JSObject*', args)
     def definition_body(self):
         protoChain = self.descriptor.prototypeChain
         if len(protoChain) == 1:
-            getParentProto = "GetCanonicalProto(aCx, aGlobal, JSProto_Object)"
+            getParentProto = "JS_GetObjectPrototype(aCx, aGlobal)"
         else:
             parentProtoName = self.descriptor.prototypeChain[-2]
             getParentProto = "%s::GetProtoObject(aCx, aGlobal)" % (parentProtoName)
 
         defineMethods = MethodDefiner(self.descriptor)
         defineAttributes = AttrDefiner(self.descriptor);
 
         # XXXbz this should be False if we're [NoInterfaceObject]
--- a/dom/bindings/Utils.cpp
+++ b/dom/bindings/Utils.cpp
@@ -22,17 +22,17 @@ CreateProtoObject(JSContext *cx, JSObjec
   MOZ_ASSERT(bool(name) == bool(constructorClass),
              "Must have name precisely when we have an interface object");
 
   JSObject* ourProto = JS_NewObject(cx, protoClass, parentProto, global);
   if (!ourProto) {
     return NULL;
   }
 
-  JSObject* functionProto = GetCanonicalProto(cx, global, JSProto_Function);
+  JSObject* functionProto = JS_GetFunctionPrototype(cx, global);
   if (!functionProto) {
     return NULL;
   }
 
   if (methods && !JS_DefineFunctions(cx, ourProto, methods)) {
     return NULL;
   }
 
--- a/dom/bindings/Utils.h
+++ b/dom/bindings/Utils.h
@@ -283,26 +283,16 @@ AllocateProtoCache(JSObject *obj)
 
 inline void
 DestroyProtoCache(JSObject *obj)
 {
   JSObject **protoArray = GetProtoArray(obj);
   delete [] protoArray;
 }
 
-inline JSObject*
-GetCanonicalProto(JSContext *cx, JSObject *global, JSProtoKey protoKey)
-{
-  JSObject* proto;
-  if (!js_GetClassPrototype(cx, global, protoKey, &proto)) {
-    return NULL;
-  }
-  return proto;
-}
-
 /*
  * Create a DOM prototype object.
  *
  * parentProto is the prototype our new object should use.
  * protoClass is the JSClass our new object should use.
  * constructorClass is the class to use for the corresponding interface object.
  *                  This is null if we should not create an interface object.
  * methods and properties are to be defined on the prototype; these arguments