[gjs/mozjs91: 71/87] Remove JSPROP_GETTER and JSPROP_SETTER usage




commit 0534f274b9e741ce2c460ce9a95ab38df83b7a81
Author: Evan Welsh <contact evanwelsh com>
Date:   Sat Aug 7 14:33:20 2021 -0700

    Remove JSPROP_GETTER and JSPROP_SETTER usage
    
    These flags are now automatically determined based on whether the
    passed getter or setter is null.
    
    Changeset: https://phabricator.services.mozilla.com/D116091
    See: https://bugzilla.mozilla.org/show_bug.cgi?id=1713083

 gi/object.cpp               | 1 -
 gjs/jsapi-dynamic-class.cpp | 3 ---
 modules/system.cpp          | 2 +-
 3 files changed, 1 insertion(+), 5 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index 4e87e7d5..6dd47807 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -757,7 +757,6 @@ static bool resolve_on_interface_prototype(JSContext* cx,
     // adding our getter and setter.
     JS::Rooted<JS::PropertyDescriptor> target_desc(cx, desc);
     target_desc.setValue(JS::UndefinedHandleValue);
-    target_desc.setAttributes(JSPROP_SETTER | JSPROP_GETTER);
     target_desc.setGetterObject(getter);
     target_desc.setSetterObject(setter);
 
diff --git a/gjs/jsapi-dynamic-class.cpp b/gjs/jsapi-dynamic-class.cpp
index 55f89c16..b36c0bf8 100644
--- a/gjs/jsapi-dynamic-class.cpp
+++ b/gjs/jsapi-dynamic-class.cpp
@@ -13,7 +13,6 @@
 #include <js/Class.h>
 #include <js/ComparisonOperators.h>
 #include <js/Object.h>              // for GetClass
-#include <js/PropertyDescriptor.h>  // for JSPROP_GETTER
 #include <js/Realm.h>  // for GetRealmObjectPrototype
 #include <js/RootingAPI.h>
 #include <js/TypeDecls.h>
@@ -214,8 +213,6 @@ gjs_define_property_dynamic(JSContext       *cx,
     if (!setter_obj)
         return false;
 
-    flags |= JSPROP_GETTER | JSPROP_SETTER;
-
     return JS_DefineProperty(cx, proto, prop_name, getter_obj, setter_obj,
                              flags);
 }
diff --git a/modules/system.cpp b/modules/system.cpp
index b8e8cd1f..9152cfe3 100644
--- a/modules/system.cpp
+++ b/modules/system.cpp
@@ -347,7 +347,7 @@ gjs_js_define_system_stuff(JSContext              *context,
                                  GJS_MODULE_PROP_FLAGS | JSPROP_READONLY) &&
            JS_DefinePropertyById(context, module, gjs->atoms().program_args(),
                                  program_args_getter, nullptr,
-                                 GJS_MODULE_PROP_FLAGS | JSPROP_GETTER) &&
+                                 GJS_MODULE_PROP_FLAGS) &&
            JS_DefinePropertyById(context, module, gjs->atoms().version(),
                                  GJS_VERSION,
                                  GJS_MODULE_PROP_FLAGS | JSPROP_READONLY);


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