[gjs/mozjs91: 122/135] JS_GetClass is now JS::GetClass




commit 67bfa839e0a4b3c4c725eec5c36c096a28f0cdf0
Author: Evan Welsh <contact evanwelsh com>
Date:   Sat Aug 7 14:42:49 2021 -0700

    JS_GetClass is now JS::GetClass
    
    See https://bugzilla.mozilla.org/show_bug.cgi?id=1663365

 gi/cwrapper.h               | 4 ++--
 gi/fundamental.cpp          | 5 +++--
 gi/object.cpp               | 3 ++-
 gi/param.cpp                | 6 +++---
 gi/repo.cpp                 | 3 ++-
 gi/wrapperutils.h           | 8 ++++----
 gjs/importer.cpp            | 3 ++-
 gjs/jsapi-dynamic-class.cpp | 3 ++-
 gjs/jsapi-util-string.cpp   | 3 ++-
 gjs/jsapi-util.cpp          | 5 +++--
 modules/cairo-pattern.cpp   | 5 ++---
 modules/cairo-surface.cpp   | 5 ++---
 12 files changed, 29 insertions(+), 24 deletions(-)
---
diff --git a/gi/cwrapper.h b/gi/cwrapper.h
index 55324380..ebe1d1d7 100644
--- a/gi/cwrapper.h
+++ b/gi/cwrapper.h
@@ -17,7 +17,7 @@
 #include <js/Class.h>
 #include <js/ComparisonOperators.h>
 #include <js/Id.h>
-#include <js/Object.h>
+#include <js/Object.h>  // for GetClass
 #include <js/RootingAPI.h>
 #include <js/TypeDecls.h>
 #include <js/Value.h>
@@ -117,7 +117,7 @@ class CWrapperPointerOps {
     static bool for_js_typecheck(JSContext* cx, JS::HandleObject wrapper,
                                  Wrapped** out) {
         if (!typecheck(cx, wrapper)) {
-            const JSClass* obj_class = JS_GetClass(wrapper);
+            const JSClass* obj_class = JS::GetClass(wrapper);
             gjs_throw_custom(cx, JSProto_TypeError, nullptr,
                              "Object %p is not a subclass of %s, it's a %s",
                              wrapper.get(), Base::klass.name, obj_class->name);
diff --git a/gi/fundamental.cpp b/gi/fundamental.cpp
index 79bfc9b2..0b8db262 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -12,10 +12,11 @@
 #include <js/Class.h>
 #include <js/ErrorReport.h>  // for JS_ReportOutOfMemory
 #include <js/GCHashTable.h>  // for WeakCache
+#include <js/Object.h>       // for GetClass
 #include <js/RootingAPI.h>
 #include <js/TypeDecls.h>
 #include <js/Utility.h>  // for UniqueChars
-#include <jsapi.h>  // for InformalValueTypeName, JS_GetClass
+#include <jsapi.h>       // for InformalValueTypeName
 #include <mozilla/HashTable.h>
 
 #include "gi/arg-inl.h"
@@ -409,7 +410,7 @@ JSObject* FundamentalInstance::object_for_c_ptr(JSContext* context,
         return nullptr;
 
     JS::RootedObject object(context, JS_NewObjectWithGivenProto(
-                                         context, JS_GetClass(proto), proto));
+                                         context, JS::GetClass(proto), proto));
 
     if (!object)
         return nullptr;
diff --git a/gi/object.cpp b/gi/object.cpp
index 54740990..853f3e5b 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -32,6 +32,7 @@
 #include <js/GCVector.h>            // for MutableWrappedPtrOperations
 #include <js/HeapAPI.h>
 #include <js/MemoryFunctions.h>     // for AddAssociatedMemory, RemoveAssoci...
+#include <js/Object.h>              // for GetClass
 #include <js/PropertyDescriptor.h>  // for JSPROP_PERMANENT, JSPROP_READONLY
 #include <js/TypeDecls.h>
 #include <js/Utility.h>  // for UniqueChars
@@ -2527,7 +2528,7 @@ ObjectInstance* ObjectInstance::new_for_gobject(JSContext* cx, GObject* gobj) {
         return nullptr;
 
     JS::RootedObject obj(
-        cx, JS_NewObjectWithGivenProto(cx, JS_GetClass(proto), proto));
+        cx, JS_NewObjectWithGivenProto(cx, JS::GetClass(proto), proto));
     if (!obj)
         return nullptr;
 
diff --git a/gi/param.cpp b/gi/param.cpp
index a0796fc6..7a3f8817 100644
--- a/gi/param.cpp
+++ b/gi/param.cpp
@@ -9,11 +9,11 @@
 
 #include <js/CallArgs.h>
 #include <js/Class.h>
-#include <js/Object.h>
+#include <js/Object.h>  // for GetClass
 #include <js/RootingAPI.h>
 #include <js/TypeDecls.h>
 #include <js/Utility.h>  // for UniqueChars
-#include <jsapi.h>       // for JS_GetClass, JS_GetPropertyById
+#include <jsapi.h>       // for JS_GetPropertyById
 #include <jspubtd.h>     // for JSProto_TypeError
 
 #include "gi/cwrapper.h"
@@ -216,7 +216,7 @@ gjs_param_from_g_param(JSContext    *context,
 
     JS::RootedObject proto(context, gjs_lookup_param_prototype(context));
 
-    obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto);
+    obj = JS_NewObjectWithGivenProto(context, JS::GetClass(proto), proto);
 
     GJS_INC_COUNTER(param);
     auto* priv = new Param(gparam);
diff --git a/gi/repo.cpp b/gi/repo.cpp
index 5a97f234..a3ba354f 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -24,6 +24,7 @@ class UTF8Chars;        // IWYU pragma: keep
 #include <js/ComparisonOperators.h>
 #include <js/Exception.h>
 #include <js/Id.h>                  // for JSID_VOID
+#include <js/Object.h>              // for GetClass
 #include <js/PropertyDescriptor.h>  // for JSPROP_PERMANENT, JSPROP_RESOLVING
 #include <js/RootingAPI.h>
 #include <js/String.h>
@@ -728,5 +729,5 @@ JSObject* gjs_new_object_with_generic_prototype(JSContext* cx,
     if (!proto)
         return nullptr;
 
-    return JS_NewObjectWithGivenProto(cx, JS_GetClass(proto), proto);
+    return JS_NewObjectWithGivenProto(cx, JS::GetClass(proto), proto);
 }
diff --git a/gi/wrapperutils.h b/gi/wrapperutils.h
index da346a38..fff1e89b 100644
--- a/gi/wrapperutils.h
+++ b/gi/wrapperutils.h
@@ -20,10 +20,10 @@
 #include <js/ComparisonOperators.h>
 #include <js/Id.h>
 #include <js/MemoryFunctions.h>
-#include <js/Object.h>
+#include <js/Object.h>  // for GetClass
 #include <js/RootingAPI.h>
 #include <js/TypeDecls.h>
-#include <jsapi.h>       // for JS_Ge...
+#include <jsapi.h>       // for JS_GetPrototype, JS_DefineFunctionById
 #include <jspubtd.h>     // for JSProto_TypeError
 
 #include "gi/arg-inl.h"
@@ -430,7 +430,7 @@ class GIWrapperBase : public CWrapperPointerOps<Base> {
         JS::RootedObject proto(cx);
         if (!JS_GetPrototype(cx, obj, &proto))
             return false;
-        if (JS_GetClass(proto) != &Base::klass) {
+        if (JS::GetClass(proto) != &Base::klass) {
             gjs_throw(cx, "Tried to construct an object without a GType");
             return false;
         }
@@ -776,7 +776,7 @@ class GIWrapperPrototype : public Base {
                   "Defined class for %s (%s), prototype %p, "
                   "JSClass %p, in object %p",
                   Base::name(), Base::type_name(), prototype.get(),
-                  JS_GetClass(prototype), in_object.get());
+                  JS::GetClass(prototype), in_object.get());
 
         return true;
     }
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index 61374511..4145aae3 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -26,6 +26,7 @@
 #include <js/ErrorReport.h>  // for JS_ReportOutOfMemory
 #include <js/Exception.h>
 #include <js/Id.h>  // for PropertyKey
+#include <js/Object.h>  // for GetClass
 #include <js/PropertyDescriptor.h>
 #include <js/PropertySpec.h>
 #include <js/RootingAPI.h>
@@ -65,7 +66,7 @@ importer_to_string(JSContext *cx,
 
     GjsAutoChar output;
 
-    const JSClass* klass = JS_GetClass(importer);
+    const JSClass* klass = JS::GetClass(importer);
     const GjsAtoms& atoms = GjsContextPrivate::atoms(cx);
     JS::RootedValue module_path(cx);
     if (!JS_GetPropertyById(cx, importer, atoms.module_path(), &module_path))
diff --git a/gjs/jsapi-dynamic-class.cpp b/gjs/jsapi-dynamic-class.cpp
index bf7d8db9..55f89c16 100644
--- a/gjs/jsapi-dynamic-class.cpp
+++ b/gjs/jsapi-dynamic-class.cpp
@@ -12,6 +12,7 @@
 #include <js/CallArgs.h>  // for JSNative
 #include <js/Class.h>
 #include <js/ComparisonOperators.h>
+#include <js/Object.h>              // for GetClass
 #include <js/PropertyDescriptor.h>  // for JSPROP_GETTER
 #include <js/Realm.h>  // for GetRealmObjectPrototype
 #include <js/RootingAPI.h>
@@ -115,7 +116,7 @@ gjs_typecheck_instance(JSContext       *context,
 {
     if (!JS_InstanceOf(context, obj, static_clasp, NULL)) {
         if (throw_error) {
-            const JSClass *obj_class = JS_GetClass(obj);
+            const JSClass* obj_class = JS::GetClass(obj);
 
             gjs_throw_custom(context, JSProto_TypeError, nullptr,
                              "Object %p is not a subclass of %s, it's a %s",
diff --git a/gjs/jsapi-util-string.cpp b/gjs/jsapi-util-string.cpp
index 9aa42b2e..c42fe1c0 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -22,6 +22,7 @@
 #include <js/ErrorReport.h>
 #include <js/GCAPI.h>  // for AutoCheckCannotGC
 #include <js/Id.h>
+#include <js/Object.h>  // for GetClass
 #include <js/Promise.h>
 #include <js/RootingAPI.h>
 #include <js/Symbol.h>
@@ -606,7 +607,7 @@ gjs_debug_object(JSObject * const obj)
         return out.str();
     }
 
-    const JSClass* clasp = JS_GetClass(obj);
+    const JSClass* clasp = JS::GetClass(obj);
     out << "<object " << clasp->name << " at " << obj <<  '>';
     return out.str();
 }
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index a0fbe0e7..332ababc 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -25,6 +25,7 @@
 #include <js/Exception.h>
 #include <js/GCAPI.h>     // for JS_MaybeGC, NonIncrementalGC, GCRe...
 #include <js/GCVector.h>  // for RootedVector
+#include <js/Object.h>    // for GetClass
 #include <js/RootingAPI.h>
 #include <js/String.h>
 #include <js/TypeDecls.h>
@@ -194,7 +195,7 @@ void gjs_throw_abstract_constructor_error(JSContext* context,
     JS::RootedObject callee(context, &args.callee());
     JS::RootedValue prototype(context);
     if (JS_GetPropertyById(context, callee, atoms.prototype(), &prototype)) {
-        proto_class = JS_GetClass(&prototype.toObject());
+        proto_class = JS::GetClass(&prototype.toObject());
         name = proto_class->name;
     }
 
@@ -328,7 +329,7 @@ std::string gjs_value_debug_string(JSContext* context, JS::HandleValue value) {
             /* Specifically the Call object (see jsfun.c in spidermonkey)
              * does not have a toString; there may be others also.
              */
-            const JSClass *klass = JS_GetClass(&value.toObject());
+            const JSClass* klass = JS::GetClass(&value.toObject());
             if (klass != NULL) {
                 str = JS_NewStringCopyZ(context, klass->name);
                 JS_ClearPendingException(context);
diff --git a/modules/cairo-pattern.cpp b/modules/cairo-pattern.cpp
index 53658cf1..1a6d07da 100644
--- a/modules/cairo-pattern.cpp
+++ b/modules/cairo-pattern.cpp
@@ -9,12 +9,11 @@
 
 #include <js/CallArgs.h>
 #include <js/Class.h>
-#include <js/Object.h>
+#include <js/Object.h>              // for GetClass
 #include <js/PropertyDescriptor.h>  // for JSPROP_READONLY
 #include <js/PropertySpec.h>
 #include <js/RootingAPI.h>
 #include <js/TypeDecls.h>
-#include <jsapi.h>  // for JS_GetClass, ...
 
 #include "gjs/jsapi-class.h"
 #include "gjs/jsapi-util.h"
@@ -133,7 +132,7 @@ cairo_pattern_t* CairoPattern::for_js(JSContext* cx,
         return nullptr;
     if (!is_pattern_subclass) {
         gjs_throw(cx, "Expected Cairo.Pattern but got %s",
-                  JS_GetClass(pattern_wrapper)->name);
+                  JS::GetClass(pattern_wrapper)->name);
         return nullptr;
     }
 
diff --git a/modules/cairo-surface.cpp b/modules/cairo-surface.cpp
index 0697c58b..710e8c1b 100644
--- a/modules/cairo-surface.cpp
+++ b/modules/cairo-surface.cpp
@@ -11,14 +11,13 @@
 #include <js/Array.h>
 #include <js/CallArgs.h>
 #include <js/Class.h>
-#include <js/Object.h>
+#include <js/Object.h>              // for GetClass
 #include <js/PropertyDescriptor.h>  // for JSPROP_READONLY
 #include <js/PropertySpec.h>
 #include <js/RootingAPI.h>
 #include <js/TypeDecls.h>
 #include <js/Value.h>
 #include <js/ValueArray.h>
-#include <jsapi.h>  // for JS_GetClass, ...
 
 #include "gi/arg-inl.h"
 #include "gi/arg.h"
@@ -269,7 +268,7 @@ cairo_surface_t* CairoSurface::for_js(JSContext* cx,
         return nullptr;
     if (!is_surface_subclass) {
         gjs_throw(cx, "Expected Cairo.Surface but got %s",
-                  JS_GetClass(surface_wrapper)->name);
+                  JS::GetClass(surface_wrapper)->name);
         return nullptr;
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]