[gjs/wip/ptomato/mozjs38: 22/27] js: JSNative accessors in JS_DefineProperty()



commit a4b5b12e7124718c9df143864e13955e9022b439
Author: Philip Chimento <philip chimento gmail com>
Date:   Fri Jan 20 23:10:20 2017 -0800

    js: JSNative accessors in JS_DefineProperty()
    
    In JS_DefineProperty(), the getter and setter parameters must now be of
    type JSNative. We have already switched to JSNative accessors everywhere,
    but there are a few macros that must change in order to ensure everything
    is cast to the right type.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777962

 gi/boxed.cpp                |    4 ++--
 gjs/importer.cpp            |    3 ++-
 gjs/jsapi-dynamic-class.cpp |    7 +++----
 modules/system.cpp          |    6 ++----
 4 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index f933da9..1390693 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -871,8 +871,8 @@ define_boxed_class_fields(JSContext       *cx,
 
         if (!JS_DefineProperty(cx, proto, field_name, JS::NullHandleValue,
                                JSPROP_PERMANENT | JSPROP_SHARED | JSPROP_GETTER | JSPROP_SETTER,
-                               JS_DATA_TO_FUNC_PTR(JSPropertyOp, getter.get()),
-                               JS_DATA_TO_FUNC_PTR(JSStrictPropertyOp, setter.get())))
+                               JS_DATA_TO_FUNC_PTR(JSNative, getter.get()),
+                               JS_DATA_TO_FUNC_PTR(JSNative, setter.get())))
             return false;
     }
 
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index b29662a..9407644 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -218,7 +218,8 @@ seal_import(JSContext       *cx,
 
     if (!JS_DefineProperty(cx, descr.object(), name, descr.value(),
                            descr.attributes() | JSPROP_PERMANENT,
-                           descr.getter(), descr.setter())) {
+                           JS_PROPERTYOP_GETTER(descr.getter()),
+                           JS_PROPERTYOP_SETTER(descr.setter()))) {
         gjs_debug(GJS_DEBUG_IMPORTER,
                   "Failed to redefine attributes to seal '%s' in importer",
                   name);
diff --git a/gjs/jsapi-dynamic-class.cpp b/gjs/jsapi-dynamic-class.cpp
index 286f221..c1e57c2 100644
--- a/gjs/jsapi-dynamic-class.cpp
+++ b/gjs/jsapi-dynamic-class.cpp
@@ -112,17 +112,16 @@ gjs_init_class_dynamic(JSContext              *context,
 
     if (!JS_DefineProperty(context, constructor, "prototype", prototype,
                            JSPROP_PERMANENT | JSPROP_READONLY,
-                           JS_PropertyStub, JS_StrictPropertyStub))
+                           JS_STUBGETTER, JS_STUBSETTER))
         goto out;
     if (!JS_DefineProperty(context, prototype, "constructor", constructor,
-                           0, JS_PropertyStub, JS_StrictPropertyStub))
+                           0, JS_STUBGETTER, JS_STUBSETTER))
         goto out;
 
     /* The constructor defined by JS_InitClass has no property attributes, but this
        is a more useful default for gjs */
     if (!JS_DefineProperty(context, in_object, class_name, constructor,
-                           GJS_MODULE_PROP_FLAGS,
-                           JS_PropertyStub, JS_StrictPropertyStub))
+                           GJS_MODULE_PROP_FLAGS, JS_STUBGETTER, JS_STUBSETTER))
         goto out;
 
     res = true;
diff --git a/modules/system.cpp b/modules/system.cpp
index 35896c7..79ffe17 100644
--- a/modules/system.cpp
+++ b/modules/system.cpp
@@ -185,15 +185,13 @@ gjs_js_define_system_stuff(JSContext              *context,
                            "programInvocationName",
                            value,
                            GJS_MODULE_PROP_FLAGS | JSPROP_READONLY,
-                           JS_PropertyStub,
-                           JS_StrictPropertyStub))
+                           JS_STUBGETTER, JS_STUBSETTER))
         goto out;
 
     if (!JS_DefineProperty(context, module,
                            "version", GJS_VERSION,
                            GJS_MODULE_PROP_FLAGS | JSPROP_READONLY,
-                           JS_PropertyStub,
-                           JS_StrictPropertyStub))
+                           JS_STUBGETTER, JS_STUBSETTER))
         goto out;
 
     retval = true;


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