[gjs/mozjs91] Apply 14 suggestion(s) to 8 file(s)



commit 5a66df459ac42781f086cf2f99c5d021af6beb4f
Author: Philip Chimento <philip chimento gmail com>
Date:   Sat Aug 7 20:35:42 2021 +0000

    Apply 14 suggestion(s) to 8 file(s)

 doc/Hacking.md              | 8 ++++----
 doc/SpiderMonkey_Memory.md  | 6 ++----
 gi/gerror.cpp               | 3 +--
 gi/gobject.cpp              | 5 ++---
 gjs/jsapi-dynamic-class.cpp | 3 +--
 gjs/module.cpp              | 4 ++--
 gjs/module.h                | 6 +++---
 meson.build                 | 2 +-
 8 files changed, 16 insertions(+), 21 deletions(-)
---
diff --git a/doc/Hacking.md b/doc/Hacking.md
index b141b569..1c732f43 100644
--- a/doc/Hacking.md
+++ b/doc/Hacking.md
@@ -66,8 +66,8 @@ will help catch mistakes in the API that could otherwise go unnoticed
 and cause crashes in gnome-shell later on.
 
 If you aren't writing any C++ code, and your system provides it (for
-example, Fedora 35 and later versions), then you don't need to build it
-yourself.
+example, Fedora 36 or Ubuntu 22.04 and later versions), then you don't
+need to build it yourself.
 Install SpiderMonkey using your system's package manager instead:
 
 <!--Ubuntu does not currently ship a build of libmozjs-91-->
@@ -86,7 +86,7 @@ with the debugging features enabled.
 This can save you time later when you submit your merge request, because
 the code will be checked using the debugging features.
 
-To build SpiderMonkey, follow the instructions on [this 
page](https://github.com/mozilla-spidermonkey/spidermonkey-embedding-examples/blob/next/docs/Building%20SpiderMonkey.md)
 to download the source code and build the library.
+To build SpiderMonkey, follow the instructions on [this 
page](https://github.com/mozilla-spidermonkey/spidermonkey-embedding-examples/blob/esr91/docs/Building%20SpiderMonkey.md)
 to download the source code and build the library.
 If you are using `-Dprefix` to build GJS into a different path, then
 make sure to use the same build prefix for SpiderMonkey with `--prefix`.
 
@@ -216,7 +216,7 @@ This will build GJS into a separate build directory with code coverage
 instrumentation enabled, run the test suite to collect the coverage
 data, and open the generated HTML report.
 
-[embedder](https://github.com/spidermonkey-embedders/spidermonkey-embedding-examples/blob/next/docs/Building%20SpiderMonkey.md)
+[embedder](https://github.com/spidermonkey-embedders/spidermonkey-embedding-examples/blob/esr91/docs/Building%20SpiderMonkey.md)
 
 ## Troubleshooting
 
diff --git a/doc/SpiderMonkey_Memory.md b/doc/SpiderMonkey_Memory.md
index 5348e852..df0e02ce 100644
--- a/doc/SpiderMonkey_Memory.md
+++ b/doc/SpiderMonkey_Memory.md
@@ -69,7 +69,7 @@ Note that the wrapped T in `JS::PersistentRooted<T>` is the location of your val
 Here is the trickier part. If you create an object, say:
 
 ```c++
-JSObject *obj = JS::Construct(cx, whatever, ...);
+JSObject *obj = JS_NewPlainObject(cx);
 ```
 
 `obj` is NOT now referenced by any other object. If the GC ran right away, `obj` would be collected.
@@ -84,9 +84,7 @@ Any SpiderMonkey APIs that can cause a garbage collection will force you to use
 So instead of the above code, you would write
 
 ```c++
-JS::RootedObject obj(cx);
-if (!JS::Construct(cx, whatever, ..., &obj))
-  ...
+JS::RootedObject obj(cx, JS_NewPlainObject(cx));
 ```
 
 ### JSFunctionSpec and extra local roots ###
diff --git a/gi/gerror.cpp b/gi/gerror.cpp
index 529c38d6..440c7a33 100644
--- a/gi/gerror.cpp
+++ b/gi/gerror.cpp
@@ -336,8 +336,7 @@ gjs_error_from_js_gerror(JSContext *cx,
     JS::RootedObject error_constructor(cx);
     if (!JS_GetClassObject(cx, error_kind, &error_constructor))
         return nullptr;
-    JS::RootedValue error_constructorv(cx);
-    error_constructorv.setObject(*error_constructor);
+    JS::RootedValue v_error_constructor(cx, JS::ObjectValue(*error_constructor));
 
     JS::RootedObject object(cx);
     if (!JS::Construct(cx, error_constructorv, error_args, &object))
diff --git a/gi/gobject.cpp b/gi/gobject.cpp
index 696e1187..f5a0fe74 100644
--- a/gi/gobject.cpp
+++ b/gi/gobject.cpp
@@ -72,7 +72,7 @@ static bool jsobj_set_gproperty(JSContext* cx, JS::HandleObject object,
                     return false;
                 }
 
-                if (jsprop.isSome() && jsprop.value().setter() &&
+                if (jsprop.isSome() && jsprop->setter() &&
                     !JS_SetProperty(cx, object, underscore_name, jsvalue)) {
                     return false;
                 }
@@ -149,8 +149,7 @@ static GObject* gjs_object_constructor(
     if (!constructor)
         return nullptr;
 
-    JS::RootedValue constructorv(cx);
-    constructorv.setObject(*constructor);
+    JS::RootedValue v_constructor(cx, JS::ObjectValue(*constructor));
 
     JS::RootedObject object(cx);
     if (n_construct_properties) {
diff --git a/gjs/jsapi-dynamic-class.cpp b/gjs/jsapi-dynamic-class.cpp
index 18440b58..36be3002 100644
--- a/gjs/jsapi-dynamic-class.cpp
+++ b/gjs/jsapi-dynamic-class.cpp
@@ -141,8 +141,7 @@ gjs_construct_object_dynamic(JSContext                  *context,
                                      atoms.constructor(), &constructor))
         return NULL;
 
-    JS::RootedValue constructorv(context);
-    constructorv.setObject(*constructor);
+    JS::RootedValue v_constructor(context, JS::ObjectValue(*constructor));
 
     JS::RootedObject object(context);
 
diff --git a/gjs/module.cpp b/gjs/module.cpp
index db4a7679..97df04c0 100644
--- a/gjs/module.cpp
+++ b/gjs/module.cpp
@@ -571,7 +571,7 @@ static bool finish_import(JSContext* cx, JS::DynamicImportStatus status,
     g_assert(v_module_request.isObject() && "Wrong type for module request");
     g_assert(v_internal_promise.isObject() && "Wrong type for promise");
 
-    JS::RootedObject moduleRequest(cx, &v_module_request.toObject());
+    JS::RootedObject module_request(cx, &v_module_request.toObject());
     JS::RootedObject internal_promise(cx, &v_internal_promise.toObject());
 
     args.rval().setUndefined();
@@ -627,7 +627,7 @@ static bool import_resolved(JSContext* cx, unsigned argc, JS::Value* vp) {
 
 bool gjs_dynamic_module_resolve(JSContext* cx,
                                 JS::HandleValue importing_module_priv,
-                                JS::Handle<JSObject*> moduleRequest,
+                                JS::HandleObject module_request,
                                 JS::HandleObject internal_promise) {
     g_assert(gjs_global_is_type(cx, GjsGlobalType::DEFAULT) &&
              "gjs_dynamic_module_resolve can only be called from the default "
diff --git a/gjs/module.h b/gjs/module.h
index c20ef54e..19b25d44 100644
--- a/gjs/module.h
+++ b/gjs/module.h
@@ -36,8 +36,8 @@ JSObject* gjs_module_load(JSContext* cx, const char* identifier,
                           const char* uri);
 
 GJS_JSAPI_RETURN_CONVENTION
-JSObject* gjs_module_resolve(JSContext* cx, JS::HandleValue importingModulePriv,
-                             JS::HandleObject moduleRequest);
+JSObject* gjs_module_resolve(JSContext* cx, JS::HandleValue importing_module_priv,
+                             JS::HandleObject module_request);
 
 GJS_JSAPI_RETURN_CONVENTION
 bool gjs_populate_module_meta(JSContext* cx, JS::HandleValue private_ref,
@@ -46,7 +46,7 @@ bool gjs_populate_module_meta(JSContext* cx, JS::HandleValue private_ref,
 GJS_JSAPI_RETURN_CONVENTION
 bool gjs_dynamic_module_resolve(JSContext* cx,
                                 JS::HandleValue importing_module_priv,
-                                JS::Handle<JSObject*> moduleRequest,
+                                JS::Handle<JSObject*> module_request,
                                 JS::HandleObject internal_promise);
 
 #endif  // GJS_MODULE_H_
diff --git a/meson.build b/meson.build
index 715ab5c1..0d81bc25 100644
--- a/meson.build
+++ b/meson.build
@@ -252,7 +252,7 @@ if not minimal_program.compiled() or minimal_program.returncode() != 0
     error('''A minimal SpiderMonkey program
 could not be compiled, linked, or run. Most likely you should build it with a
 different configuration. Check the recommended configuration:
-https://github.com/spidermonkey-embedders/spidermonkey-embedding-examples/blob/next/docs/Building%20SpiderMonkey.md''')
+https://github.com/spidermonkey-embedders/spidermonkey-embedding-examples/blob/esr91/docs/Building%20SpiderMonkey.md''')
 endif
 
 have_printf_alternative_int = cc.compiles('''


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