[seed] Fixing object constructor exception



commit 6d1c699b45e410672d130560039ed77150c38286
Author: Danilo Cesar Lemes de Paula <danilo cesar collabora co uk>
Date:   Thu Oct 6 13:52:45 2016 -0300

    Fixing object constructor exception
    
    When a constructor raises an exception it needs to return NULL.
    WebKitAPI excepts an JSObjectRef for object constructor, we can't return
    a JSValueRef with a NULL value and expect that webkit will be OK with
    that.
    
    Fixing this also fix some tests that were XFAIL-ing and now passes.

 libseed/seed-engine.c               |    6 +++---
 tests/javascript/Makefile.am        |    1 -
 tests/javascript/gtypes/Makefile.am |    1 -
 3 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/libseed/seed-engine.c b/libseed/seed-engine.c
index 4909581..5aa250d 100644
--- a/libseed/seed-engine.c
+++ b/libseed/seed-engine.c
@@ -194,7 +194,7 @@ seed_gobject_constructor_invoked(JSContextRef ctx,
     if (class_init_exception) {
         *exception = class_init_exception;
         g_type_set_qdata(type, class_init_exception_q, NULL);
-        return (JSObjectRef) JSValueMakeNull(ctx);
+        return NULL;
     }
 
     if (argumentCount > 1) {
@@ -203,7 +203,7 @@ seed_gobject_constructor_invoked(JSContextRef ctx,
                             " 1 argument, got %zd",
                             argumentCount);
 
-        return (JSObjectRef) JSValueMakeNull(ctx);
+        return NULL;
     }
 
     if (argumentCount == 1) {
@@ -211,7 +211,7 @@ seed_gobject_constructor_invoked(JSContextRef ctx,
             seed_make_exception(ctx, exception, "ArgumentError",
                                 "Constructor expects object as argument");
             g_type_class_unref(oclass);
-            return (JSObjectRef) JSValueMakeNull(ctx);
+            return NULL;
         }
 
         jsprops = JSObjectCopyPropertyNames(ctx, (JSObjectRef) arguments[0]);
diff --git a/tests/javascript/Makefile.am b/tests/javascript/Makefile.am
index 63de9e6..b357582 100644
--- a/tests/javascript/Makefile.am
+++ b/tests/javascript/Makefile.am
@@ -79,7 +79,6 @@ TESTS = \
 XFAIL_TESTS = \
        gerror.js \
        array-gtype.js \
-       constructor-args.js \
        gvalue-argument.js \
        gdk-event.js \
        object-info.js \
diff --git a/tests/javascript/gtypes/Makefile.am b/tests/javascript/gtypes/Makefile.am
index 9c26a33..320184b 100644
--- a/tests/javascript/gtypes/Makefile.am
+++ b/tests/javascript/gtypes/Makefile.am
@@ -32,7 +32,6 @@ TESTS = \
        gtype-signal.js
 
 XFAIL_TESTS = \
-       gtype-class-init-exception.js \
        gtype-typerror.js \
        $(NULL)
 


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