[gjs/mozjs91: 19/40] JS_GetClass is now JS::GetClass




commit e5c5e1dc941bf52aa57d0606d7c4c8ca53fecb01
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/param.cpp                | 6 +++---
 gi/repo.cpp                 | 3 ++-
 gi/wrapperutils.h           | 6 +++---
 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 ++---
 11 files changed, 26 insertions(+), 22 deletions(-)
---
diff --git a/gi/cwrapper.h b/gi/cwrapper.h
index 553243805..ebe1d1d7a 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 5ef7ad745..956b7303c 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"
@@ -410,7 +411,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/param.cpp b/gi/param.cpp
index a0796fc60..7a3f88174 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 8af4e3266..9f5d4e1f3 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -19,6 +19,7 @@
 #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>
@@ -723,5 +724,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 f58a05083..55cb131b3 100644
--- a/gi/wrapperutils.h
+++ b/gi/wrapperutils.h
@@ -24,7 +24,7 @@
 #include <js/Object.h>
 #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"
@@ -304,7 +304,7 @@ class GIWrapperBase : public CWrapperPointerOps<Base> {
      */
     [[nodiscard]] static Prototype* resolve_prototype(JSContext* cx,
                                                       JS::HandleObject proto) {
-        if (JS_GetClass(proto) != &Base::klass) {
+        if (JS::GetClass(proto) != &Base::klass) {
             gjs_throw(cx, "Tried to construct an object without a GType");
             return nullptr;
         }
@@ -793,7 +793,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 613745115..4145aae32 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 bf7d8db92..55f89c16a 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 9aa42b2e3..c42fe1c0c 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 b6501ca1c..2db43e7ac 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -26,6 +26,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>
@@ -195,7 +196,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;
     }
 
@@ -329,7 +330,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 53658cf17..1a6d07da3 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 0697c58b5..710e8c1bf 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]