[gjs/wip/ptomato/mozjs45prep: 6/18] js: Global object is implicit now in many function calls



commit 724c1355fc19b10d95ada8ea17cc806f30d4ac51
Author: Philip Chimento <philip endlessm com>
Date:   Sun Mar 19 05:06:48 2017 +0000

    js: Global object is implicit now in many function calls

 gi/boxed.cpp                |    6 +++---
 gi/enumeration.cpp          |    2 +-
 gi/function.cpp             |    2 +-
 gi/fundamental.cpp          |    3 +--
 gi/gerror.cpp               |    2 +-
 gi/gtype.cpp                |    3 +--
 gi/ns.cpp                   |    2 +-
 gi/object.cpp               |    3 +--
 gi/param.cpp                |    2 +-
 gi/repo.cpp                 |    7 +++----
 gi/union.cpp                |    2 +-
 gjs/context.cpp             |    2 +-
 gjs/importer.cpp            |    2 +-
 gjs/jsapi-dynamic-class.cpp |    7 +++----
 14 files changed, 20 insertions(+), 25 deletions(-)
---
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index d6a96c7..f986dd2 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -570,7 +570,7 @@ get_nested_interface_object(JSContext             *context,
 
     offset = g_field_info_get_offset (field_info);
 
-    obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto, global);
+    obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto);
 
     if (obj == NULL)
         return false;
@@ -605,7 +605,7 @@ define_native_accessor_wrapper(JSContext  *cx,
                                uint32_t    id)
 {
     JSFunction *func = js::NewFunctionWithReserved(cx, call, nargs, 0,
-                                                   NULL, func_name);
+                                                   func_name);
     if (!func)
         return NULL;
 
@@ -1224,7 +1224,7 @@ gjs_boxed_from_c_struct(JSContext             *context,
     JS::RootedObject proto(context, gjs_lookup_generic_prototype(context, info));
     proto_priv = priv_from_js(context, proto);
 
-    obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto, global);
+    obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto);
 
     GJS_INC_COUNTER(boxed);
     priv = g_slice_new0(Boxed);
diff --git a/gi/enumeration.cpp b/gi/enumeration.cpp
index 5f5e2f9..0c5ff01 100644
--- a/gi/enumeration.cpp
+++ b/gi/enumeration.cpp
@@ -165,7 +165,7 @@ gjs_define_enumeration(JSContext       *context,
 
     enum_name = g_base_info_get_name( (GIBaseInfo*) info);
 
-    JS::RootedObject enum_obj(context, JS_NewObject(context, NULL, global));
+    JS::RootedObject enum_obj(context, JS_NewObject(context, NULL));
     if (enum_obj == NULL) {
         g_error("Could not create enumeration %s.%s",
                        g_base_info_get_namespace( (GIBaseInfo*) info),
diff --git a/gi/function.cpp b/gi/function.cpp
index 7a0fc58..7768ab2 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -1707,7 +1707,7 @@ function_new(JSContext      *context,
     }
 
     JS::RootedObject function(context,
-        JS_NewObject(context, &gjs_function_class, global));
+                              JS_NewObject(context, &gjs_function_class));
     if (function == NULL) {
         gjs_debug(GJS_DEBUG_GFUNCTION, "Failed to construct function");
         return NULL;
diff --git a/gi/fundamental.cpp b/gi/fundamental.cpp
index 7a3b5ec..8c3b201 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -778,8 +778,7 @@ gjs_object_from_g_fundamental(JSContext    *context,
         return NULL;
 
     JS::RootedObject global(context, gjs_get_import_global(context));
-    object = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto,
-                                        global);
+    object = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto);
 
     if (object == NULL)
         goto out;
diff --git a/gi/gerror.cpp b/gi/gerror.cpp
index cc8875d..f6c7aa5 100644
--- a/gi/gerror.cpp
+++ b/gi/gerror.cpp
@@ -449,7 +449,7 @@ gjs_error_from_gerror(JSContext             *context,
     proto_priv = priv_from_js(context, proto);
 
     JS::RootedObject obj(context,
-        JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto, global));
+        JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto));
 
     GJS_INC_COUNTER(gerror);
     priv = g_slice_new0(Error);
diff --git a/gi/gtype.cpp b/gi/gtype.cpp
index ac5b415..f91d3ac 100644
--- a/gi/gtype.cpp
+++ b/gi/gtype.cpp
@@ -163,8 +163,7 @@ gjs_gtype_create_gtype_wrapper (JSContext *context,
         goto out;
 
     heap_wrapper = new JS::Heap<JSObject *>();
-    *heap_wrapper = JS_NewObjectWithGivenProto(context, &gjs_gtype_class, proto,
-                                               JS::NullPtr());
+    *heap_wrapper = JS_NewObjectWithGivenProto(context, &gjs_gtype_class, proto);
     if (*heap_wrapper == nullptr)
         goto out;
 
diff --git a/gi/ns.cpp b/gi/ns.cpp
index 0bf815e..23cc2f0 100644
--- a/gi/ns.cpp
+++ b/gi/ns.cpp
@@ -221,7 +221,7 @@ ns_new(JSContext    *context,
                   gjs_ns_class.name, prototype);
     }
 
-    JS::RootedObject ns(context, JS_NewObject(context, &gjs_ns_class, global));
+    JS::RootedObject ns(context, JS_NewObject(context, &gjs_ns_class));
     if (ns == NULL)
         g_error("No memory to create ns object");
 
diff --git a/gi/object.cpp b/gi/object.cpp
index 81f8d64..90a25bc 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -2200,8 +2200,7 @@ gjs_object_from_g_object(JSContext    *context,
         JS::RootedObject global(context, gjs_get_import_global(context));
 
         JS::RootedObject obj(context,
-            JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto,
-                                       global));
+            JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto));
 
         if (obj == NULL)
             goto out;
diff --git a/gi/param.cpp b/gi/param.cpp
index b943992..2f11e25 100644
--- a/gi/param.cpp
+++ b/gi/param.cpp
@@ -259,7 +259,7 @@ gjs_param_from_g_param(JSContext    *context,
     JS::RootedObject proto(context, gjs_lookup_param_prototype(context));
     JS::RootedObject global(context, gjs_get_import_global(context));
 
-    obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto, global);
+    obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto);
 
     GJS_INC_COUNTER(param);
     priv = g_slice_new0(Param);
diff --git a/gi/repo.cpp b/gi/repo.cpp
index 6af42e1..7ea15b2 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -276,8 +276,7 @@ repo_new(JSContext *context)
                   gjs_repo_class.name, prototype);
     }
 
-    JS::RootedObject repo(context,
-        JS_NewObject(context, &gjs_repo_class, global));
+    JS::RootedObject repo(context, JS_NewObject(context, &gjs_repo_class));
     if (repo == NULL) {
         gjs_throw(context, "No memory to create repo object");
         return NULL;
@@ -293,11 +292,11 @@ repo_new(JSContext *context)
     gjs_debug_lifecycle(GJS_DEBUG_GREPO,
                         "repo constructor, obj %p priv %p", repo.get(), priv);
 
-    JS::RootedObject versions(context, JS_NewObject(context, NULL, global));
+    JS::RootedObject versions(context, JS_NewObject(context, NULL));
     gjs_object_define_property(context, repo, GJS_STRING_GI_VERSIONS,
                                versions, JSPROP_PERMANENT);
 
-    JS::RootedObject private_ns(context, JS_NewObject(context, NULL, global));
+    JS::RootedObject private_ns(context, JS_NewObject(context, NULL));
     gjs_object_define_property(context, repo,
                                GJS_STRING_PRIVATE_NS_MARKER, private_ns,
                                JSPROP_PERMANENT);
diff --git a/gi/union.cpp b/gi/union.cpp
index 28c793d..145edfe 100644
--- a/gi/union.cpp
+++ b/gi/union.cpp
@@ -405,7 +405,7 @@ gjs_union_from_c_union(JSContext    *context,
         gjs_lookup_generic_prototype(context, (GIUnionInfo*) info));
     JS::RootedObject global(context, gjs_get_import_global(context));
 
-    obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto, global);
+    obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto);
 
     GJS_INC_COUNTER(boxed);
     priv = g_slice_new0(Union);
diff --git a/gjs/context.cpp b/gjs/context.cpp
index be19e99..d91ada3 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -308,7 +308,7 @@ gjs_define_promise_object(JSContext       *cx,
         .setFile("<Promise>");
 
     JS::RootedValue promise(cx);
-    if (!JS::Evaluate(cx, global, options, lie_code, lie_length, &promise)) {
+    if (!JS::Evaluate(cx, options, lie_code, lie_length, &promise)) {
         g_bytes_unref(lie_bytes);
         return false;
     }
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index d0a976d..19c9b00 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -942,7 +942,7 @@ importer_new(JSContext *context,
     }
 
     JS::RootedObject importer(context,
-        JS_NewObject(context, js::Jsvalify(&gjs_importer_class), global));
+        JS_NewObject(context, js::Jsvalify(&gjs_importer_class)));
     if (importer == NULL)
         g_error("No memory to create importer importer");
 
diff --git a/gjs/jsapi-dynamic-class.cpp b/gjs/jsapi-dynamic-class.cpp
index a645f14..15297cc 100644
--- a/gjs/jsapi-dynamic-class.cpp
+++ b/gjs/jsapi-dynamic-class.cpp
@@ -78,8 +78,7 @@ gjs_init_class_dynamic(JSContext              *context,
     */
 
     if (parent_proto) {
-        prototype.set(JS_NewObjectWithGivenProto(context, clasp,
-                                                 parent_proto, global));
+        prototype.set(JS_NewObjectWithGivenProto(context, clasp, parent_proto));
     } else {
         /* JS_NewObject will try to search for clasp prototype in the
          * global object, which is wrong, but it's not a problem because
@@ -87,7 +86,7 @@ gjs_init_class_dynamic(JSContext              *context,
          * constructor is not found (and it won't be found, because we
          * never call JS_InitClass).
          */
-        prototype.set(JS_NewObject(context, clasp, global));
+        prototype.set(JS_NewObject(context, clasp));
     }
     if (!prototype)
         goto out;
@@ -99,7 +98,7 @@ gjs_init_class_dynamic(JSContext              *context,
 
     full_function_name = g_strdup_printf("%s_%s", ns_name, class_name);
     constructor_fun = JS_NewFunction(context, constructor_native, nargs, JSFUN_CONSTRUCTOR,
-                                     global, full_function_name);
+                                     full_function_name);
     if (!constructor_fun)
         goto out;
 


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