[gjs/gnome-3-34] Revert "object: Throw if constructing an unregistered object inheriting from GObject"



commit 974560a251d2e1fb57bd8514879d6b61263f2167
Author: Philip Chimento <philip chimento gmail com>
Date:   Mon Nov 25 09:17:24 2019 -0800

    Revert "object: Throw if constructing an unregistered object inheriting from GObject"
    
    This reverts commit 90da04977b3d121218de0cf051770c34685c0cd1.
    This fix doesn't just replace a cryptic error with a clear error, as
    previously thought, but it also apparently breaks a usage which may have
    been incorrect but still functioned. As such, it shouldn't be introduced
    on the stable branch yet.
    
    See: #288

 gi/object.cpp | 17 -----------------
 1 file changed, 17 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index 048233db..82d6e542 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1528,23 +1528,6 @@ bool ObjectInstance::constructor_impl(JSContext* context,
                                       const JS::CallArgs& argv) {
     JS::RootedValue initer(context);
     GjsContextPrivate* gjs = GjsContextPrivate::from_cx(context);
-    const auto& new_target = argv.newTarget();
-    bool has_gtype;
-
-    g_assert(new_target.isObject() && "new.target needs to be an object");
-    JS::RootedObject rooted_target(context, &new_target.toObject());
-    if (!JS_HasOwnPropertyById(context, rooted_target, gjs->atoms().gtype(),
-                               &has_gtype))
-        return false;
-
-    if (!has_gtype) {
-        gjs_throw(context,
-                  "Tried to construct an object without a GType; are "
-                  "you using GObject.registerClass() when inheriting "
-                  "from a GObject type?");
-        return false;
-    }
-
     return gjs_object_require_property(context, object, "GObject instance",
                                        gjs->atoms().init(), &initer) &&
            gjs->call_function(object, initer, argv, argv.rval());


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