[gjs/wip/ptomato/mozjs38: 17/21] js: JSNative accessors in JS_DefineProperty()



commit d7bf1c6ff0c079b31d9c240d917f45378b6f3fe4
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.

 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 07c940d..a3f101a 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 72dbbc1..72b214e 100644
--- a/modules/system.cpp
+++ b/modules/system.cpp
@@ -182,15 +182,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]