[gjs/gnome-3-34] Revert "private: Don't pass argv to for_js_typecheck and use result for later"



commit e3eafaeec8e9ab0638d6149f991efa3ab43cc2f2
Author: Philip Chimento <philip chimento gmail com>
Date:   Mon Nov 25 09:18:01 2019 -0800

    Revert "private: Don't pass argv to for_js_typecheck and use result for later"
    
    This reverts commit e8d44fd8bf31a238ea51832061799418306a1dda.
    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/private.cpp | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
---
diff --git a/gi/private.cpp b/gi/private.cpp
index d537b617..dea49100 100644
--- a/gi/private.cpp
+++ b/gi/private.cpp
@@ -264,13 +264,7 @@ static bool gjs_register_type(JSContext* cx, unsigned argc, JS::Value* vp) {
                              "properties", &properties))
         return false;
 
-    if (!parent)
-        return false;
-
-    /* Don't pass the argv to it, as otherwise we will log about the callee
-     * while we only care about the parent object type. */
-    auto* parent_priv = ObjectBase::for_js_typecheck(cx, parent);
-    if (!parent_priv)
+    if (!parent || !ObjectBase::for_js_typecheck(cx, parent, argv))
         return false;
 
     uint32_t n_interfaces, n_properties;
@@ -291,6 +285,7 @@ static bool gjs_register_type(JSContext* cx, unsigned argc, JS::Value* vp) {
         return false;
     }
 
+    auto* parent_priv = ObjectPrototype::for_js(cx, parent);
     /* We checked parent above, in ObjectBase::for_js_typecheck() */
     g_assert(parent_priv);
 


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