[gjs/mozjs91: 4/17] JS_GetClass is now JS::GetClass




commit 4f50b44dd13dea6faa65f1cc8f5f19f02107523b
Author: Evan Welsh <contact evanwelsh com>
Date:   Sat Jul 10 20:17:35 2021 -0700

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

 gi/cwrapper.h               |  2 +-
 gi/fundamental.cpp          |  4 ++--
 gi/object.cpp               |  2 +-
 gi/param.cpp                |  4 ++--
 gi/repo.cpp                 |  2 +-
 gi/wrapperutils.h           |  4 ++--
 gjs/importer.cpp            |  2 +-
 gjs/jsapi-dynamic-class.cpp |  2 +-
 gjs/jsapi-util-string.cpp   | 10 +++++-----
 gjs/jsapi-util.cpp          |  4 ++--
 modules/cairo-pattern.cpp   |  4 ++--
 modules/cairo-surface.cpp   |  4 ++--
 12 files changed, 22 insertions(+), 22 deletions(-)
---
diff --git a/gi/cwrapper.h b/gi/cwrapper.h
index 55324380..e99fbdf4 100644
--- a/gi/cwrapper.h
+++ b/gi/cwrapper.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 72b69259..2d80e9a9 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -14,7 +14,7 @@
 #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, JS::GetClass
 #include <mozilla/HashTable.h>
 
 #include "gi/arg-inl.h"
@@ -408,7 +408,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 77acf3f4..7594b00d 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -2483,7 +2483,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 9bc43be7..cc903a73 100644
--- a/gi/param.cpp
+++ b/gi/param.cpp
@@ -12,7 +12,7 @@
 #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::GetClass, JS_GetPropertyById
 #include <jspubtd.h>     // for JSProto_TypeError
 
 #include "gi/cwrapper.h"
@@ -215,7 +215,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 87030fd4..2435f647 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -720,5 +720,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 15f50c90..e5dba017 100644
--- a/gi/wrapperutils.h
+++ b/gi/wrapperutils.h
@@ -429,7 +429,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;
         }
@@ -775,7 +775,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 1d41a7e2..f21f6d6d 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -62,7 +62,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 fa75a436..3b23a5c3 100644
--- a/gjs/jsapi-dynamic-class.cpp
+++ b/gjs/jsapi-dynamic-class.cpp
@@ -115,7 +115,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 e5de20c2..2dedbe40 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -402,22 +402,22 @@ enum Quotes {
 
 [[nodiscard]] static std::string gjs_debug_linear_string(JSLinearString* str,
                                                          Quotes quotes) {
-    size_t len = js::GetLinearStringLength(str);
+    size_t len = JS::GetLinearStringLength(str);
 
     std::ostringstream out;
     if (quotes == DoubleQuotes)
         out << '"';
 
     JS::AutoCheckCannotGC nogc;
-    if (js::LinearStringHasLatin1Chars(str)) {
-        const JS::Latin1Char *chars = js::GetLatin1LinearStringChars(nogc, str);
+    if (JS::LinearStringHasLatin1Chars(str)) {
+        const JS::Latin1Char* chars = JS::GetLatin1LinearStringChars(nogc, str);
         out << std::string(reinterpret_cast<const char*>(chars), len);
         if (quotes == DoubleQuotes)
             out << '"';
         return out.str();
     }
 
-    const char16_t *chars = js::GetTwoByteLinearStringChars(nogc, str);
+    const char16_t* chars = JS::GetTwoByteLinearStringChars(nogc, str);
     for (size_t ix = 0; ix < len; ix++) {
         char16_t c = chars[ix];
         if (c == '\n')
@@ -524,7 +524,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 cb4f24f2..7db6e770 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -194,7 +194,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 +328,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 679200d4..a7097520 100644
--- a/modules/cairo-pattern.cpp
+++ b/modules/cairo-pattern.cpp
@@ -13,7 +13,7 @@
 #include <js/PropertySpec.h>
 #include <js/RootingAPI.h>
 #include <js/TypeDecls.h>
-#include <jsapi.h>  // for JS::GetPrivate, JS_GetClass, ...
+#include <jsapi.h>  // for JS::GetPrivate, JS::GetClass, ...
 
 #include "gjs/jsapi-class.h"
 #include "gjs/jsapi-util.h"
@@ -132,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 c93955bb..3e33d37c 100644
--- a/modules/cairo-surface.cpp
+++ b/modules/cairo-surface.cpp
@@ -15,7 +15,7 @@
 #include <js/RootingAPI.h>
 #include <js/TypeDecls.h>
 #include <js/Value.h>
-#include <jsapi.h>  // for JS::GetPrivate, JS_GetClass, ...
+#include <jsapi.h>  // for JS::GetPrivate, JS::GetClass, ...
 
 #include "gi/arg-inl.h"
 #include "gi/arg.h"
@@ -166,7 +166,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]