Changeset 230704 in webkit


Ignore:
Timestamp:
Apr 17, 2018 1:15:28 AM (6 years ago)
Author:
Carlos Garcia Campos
Message:

[GLIB] Add API to query, delete and enumerate properties
https://bugs.webkit.org/show_bug.cgi?id=184647

Reviewed by Michael Catanzaro.

Source/JavaScriptCore:

Add jsc_value_object_has_property(), jsc_value_object_delete_property() and jsc_value_object_enumerate_properties().

  • API/glib/JSCValue.cpp:

(jsc_value_object_has_property):
(jsc_value_object_delete_property):
(jsc_value_object_enumerate_properties):

  • API/glib/JSCValue.h:
  • API/glib/docs/jsc-glib-4.0-sections.txt:

Tools:

Add test cases for the new API.

  • TestWebKitAPI/Tests/JavaScriptCore/glib/TestJSC.cpp:

(testJSCObject):
(testJSCClass):
(testJSCPrototypes):

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/glib/JSCValue.cpp

    r230558 r230704  
    674674        return jsc_value_new_undefined(priv->context.get());
    675675
    676 
    677676    JSRetainPtr<JSStringRef> propertyName(Adopt, JSStringCreateWithUTF8CString(name));
    678677    JSValueRef result = JSObjectGetProperty(jsContext, object, propertyName.get(), &exception);
     
    727726        return jsc_value_new_undefined(priv->context.get());
    728727
    729 
    730728    JSValueRef result = JSObjectGetPropertyAtIndex(jsContext, object, index, &exception);
    731729    if (jscContextHandleExceptionIfNeeded(priv->context.get(), exception))
     
    733731
    734732    return jscContextGetOrCreateValue(priv->context.get(), result).leakRef();
     733}
     734
     735/**
     736 * jsc_value_object_has_property:
     737 * @value: a #JSCValue
     738 * @name: the property name
     739 *
     740 * Get whether @value has property with @name.
     741 *
     742 * Returns: %TRUE if @value has a property with @name, or %FALSE otherwise
     743 */
     744gboolean jsc_value_object_has_property(JSCValue* value, const char* name)
     745{
     746    g_return_val_if_fail(JSC_IS_VALUE(value), FALSE);
     747    g_return_val_if_fail(name, FALSE);
     748
     749    JSCValuePrivate* priv = value->priv;
     750    auto* jsContext = jscContextGetJSContext(priv->context.get());
     751    JSValueRef exception = nullptr;
     752    JSObjectRef object = JSValueToObject(jsContext, priv->jsValue, &exception);
     753    if (jscContextHandleExceptionIfNeeded(priv->context.get(), exception))
     754        return FALSE;
     755
     756    JSRetainPtr<JSStringRef> propertyName(Adopt, JSStringCreateWithUTF8CString(name));
     757    return JSObjectHasProperty(jsContext, object, propertyName.get());
     758}
     759
     760/**
     761 * jsc_value_object_delete_property:
     762 * @value: a #JSCValue
     763 * @name: the property name
     764 *
     765 * Try to delete property with @name from @value. This function will return %FALSE if
     766 * the property was defined without %JSC_VALUE_PROPERTY_CONFIGURABLE flag.
     767 *
     768 * Returns: %TRUE if the property was deleted, or %FALSE otherwise.
     769 */
     770gboolean jsc_value_object_delete_property(JSCValue* value, const char* name)
     771{
     772    g_return_val_if_fail(JSC_IS_VALUE(value), FALSE);
     773    g_return_val_if_fail(name, FALSE);
     774
     775    JSCValuePrivate* priv = value->priv;
     776    auto* jsContext = jscContextGetJSContext(priv->context.get());
     777    JSValueRef exception = nullptr;
     778    JSObjectRef object = JSValueToObject(jsContext, priv->jsValue, &exception);
     779    if (jscContextHandleExceptionIfNeeded(priv->context.get(), exception))
     780        return FALSE;
     781
     782    JSRetainPtr<JSStringRef> propertyName(Adopt, JSStringCreateWithUTF8CString(name));
     783    gboolean result = JSObjectDeleteProperty(jsContext, object, propertyName.get(), &exception);
     784    if (jscContextHandleExceptionIfNeeded(priv->context.get(), exception))
     785        return FALSE;
     786
     787    return result;
     788}
     789
     790/**
     791 * jsc_value_object_enumerate_properties:
     792 * @value: a #JSCValue
     793 *
     794 * Get the list of property names of @value. Only properties defined with %JSC_VALUE_PROPERTY_ENUMERABLE
     795 * flag will be collected.
     796 *
     797 * Returns: (array zero-terminated=1) (transfer full) (nullable): a %NULL-terminated array of strings containing the
     798 *    property names, or %NULL if @value doesn't have enumerable properties.  Use g_strfreev() to free.
     799 */
     800char** jsc_value_object_enumerate_properties(JSCValue* value)
     801{
     802    g_return_val_if_fail(JSC_IS_VALUE(value), nullptr);
     803
     804    JSCValuePrivate* priv = value->priv;
     805    auto* jsContext = jscContextGetJSContext(priv->context.get());
     806    JSValueRef exception = nullptr;
     807    JSObjectRef object = JSValueToObject(jsContext, priv->jsValue, &exception);
     808    if (jscContextHandleExceptionIfNeeded(priv->context.get(), exception))
     809        return nullptr;
     810
     811    auto* propertiesArray = JSObjectCopyPropertyNames(jsContext, object);
     812    if (!propertiesArray)
     813        return nullptr;
     814
     815    auto propertiesArraySize = JSPropertyNameArrayGetCount(propertiesArray);
     816    if (!propertiesArraySize) {
     817        JSPropertyNameArrayRelease(propertiesArray);
     818        return nullptr;
     819    }
     820
     821    auto* result = static_cast<char**>(g_new0(char*, propertiesArraySize + 1));
     822    for (unsigned i = 0; i < propertiesArraySize; ++i) {
     823        auto* jsString = JSPropertyNameArrayGetNameAtIndex(propertiesArray, i);
     824        size_t maxSize = JSStringGetMaximumUTF8CStringSize(jsString);
     825        auto* string = static_cast<char*>(g_malloc(maxSize));
     826        JSStringGetUTF8CString(jsString, string, maxSize);
     827        result[i] = string;
     828    }
     829    JSPropertyNameArrayRelease(propertiesArray);
     830
     831    return result;
    735832}
    736833
  • trunk/Source/JavaScriptCore/API/glib/JSCValue.h

    r230558 r230704  
    164164                                           guint                 index);
    165165
     166JSC_API gboolean
     167jsc_value_object_has_property             (JSCValue             *value,
     168                                           const char           *name);
     169
     170JSC_API gboolean
     171jsc_value_object_delete_property          (JSCValue             *value,
     172                                           const char           *name);
     173
     174JSC_API gchar **
     175jsc_value_object_enumerate_properties     (JSCValue             *value);
     176
    166177JSC_API JSCValue *
    167178jsc_value_object_invoke_method            (JSCValue             *value,
  • trunk/Source/JavaScriptCore/API/glib/docs/jsc-glib-4.0-sections.txt

    r230558 r230704  
    8888jsc_value_object_set_property_at_index
    8989jsc_value_object_get_property_at_index
     90jsc_value_object_has_property
     91jsc_value_object_delete_property
     92jsc_value_object_enumerate_properties
    9093jsc_value_object_invoke_method
    9194jsc_value_object_define_property_data
  • trunk/Source/JavaScriptCore/ChangeLog

    r230697 r230704  
     12018-04-17  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GLIB] Add API to query, delete and enumerate properties
     4        https://bugs.webkit.org/show_bug.cgi?id=184647
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Add jsc_value_object_has_property(), jsc_value_object_delete_property() and jsc_value_object_enumerate_properties().
     9
     10        * API/glib/JSCValue.cpp:
     11        (jsc_value_object_has_property):
     12        (jsc_value_object_delete_property):
     13        (jsc_value_object_enumerate_properties):
     14        * API/glib/JSCValue.h:
     15        * API/glib/docs/jsc-glib-4.0-sections.txt:
     16
    1172018-04-16  Yusuke Suzuki  <utatane.tea@gmail.com>
    218
  • trunk/Tools/ChangeLog

    r230700 r230704  
     12018-04-17  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GLIB] Add API to query, delete and enumerate properties
     4        https://bugs.webkit.org/show_bug.cgi?id=184647
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Add test cases for the new API.
     9
     10        * TestWebKitAPI/Tests/JavaScriptCore/glib/TestJSC.cpp:
     11        (testJSCObject):
     12        (testJSCClass):
     13        (testJSCPrototypes):
     14
    1152018-04-16  Zalan Bujtas  <zalan@apple.com>
    216
  • trunk/Tools/TestWebKitAPI/Tests/JavaScriptCore/glib/TestJSC.cpp

    r230558 r230704  
    706706        g_assert_true(jsc_value_is_object(foo.get()));
    707707        g_assert_true(jsc_value_object_is_instance_of(foo.get(), "Foo"));
     708        g_assert_true(jsc_value_object_has_property(foo.get(), "foo"));
     709
     710        GUniquePtr<char*> properties(jsc_value_object_enumerate_properties(foo.get()));
     711        g_assert_null(properties.get());
    708712
    709713        GRefPtr<JSCValue> result = adoptGRef(jsc_value_object_invoke_method(foo.get(), "foo", G_TYPE_INT, 200, G_TYPE_NONE));
     
    712716        g_assert_cmpint(jsc_value_to_int32(result.get()), ==, 400);
    713717
     718        g_assert_false(jsc_value_object_has_property(foo.get(), "bar"));
    714719        bool didThrow = false;
    715720        g_assert_throw_begin(exceptionHandler, didThrow);
     
    756761        g_assert_true(jsc_value_object_is_instance_of(object.get(), "Object"));
    757762
     763        GUniquePtr<char*> properties(jsc_value_object_enumerate_properties(object.get()));
     764        g_assert_null(properties.get());
     765
    758766        GRefPtr<JSCValue> property = adoptGRef(jsc_value_new_number(context.get(), 25));
    759767        checker.watch(property.get());
    760 
     768        g_assert_false(jsc_value_object_has_property(object.get(), "val"));
    761769        jsc_value_object_define_property_data(object.get(), "val", static_cast<JSCValuePropertyFlags>(0), property.get());
     770        g_assert_true(jsc_value_object_has_property(object.get(), "val"));
     771        properties.reset(jsc_value_object_enumerate_properties(object.get()));
     772        g_assert_null(properties.get());
    762773        jsc_context_set_value(context.get(), "f", object.get());
    763774
     
    781792        value = adoptGRef(jsc_context_evaluate(context.get(), "delete f.val;", -1));
    782793        checker.watch(value.get());
     794        g_assert_true(jsc_value_object_has_property(object.get(), "val"));
    783795        value = adoptGRef(jsc_context_evaluate(context.get(), "f.val;", -1));
    784796        checker.watch(value.get());
    785797        g_assert_true(jsc_value_is_number(value.get()));
    786798        g_assert_cmpint(jsc_value_to_int32(value.get()), ==, 25);
     799
     800        g_assert_false(jsc_value_object_delete_property(object.get(), "val"));
     801        g_assert_true(jsc_value_object_has_property(object.get(), "val"));
    787802
    788803        property = adoptGRef(jsc_value_new_number(context.get(), 52));
     
    794809        property = adoptGRef(jsc_value_new_number(context.get(), 32));
    795810        checker.watch(property.get());
     811        g_assert_false(jsc_value_object_has_property(object.get(), "val2"));
    796812        jsc_value_object_define_property_data(object.get(), "val2", static_cast<JSCValuePropertyFlags>(JSC_VALUE_PROPERTY_ENUMERABLE | JSC_VALUE_PROPERTY_WRITABLE), property.get());
     813        g_assert_true(jsc_value_object_has_property(object.get(), "val2"));
    797814        value = adoptGRef(jsc_context_evaluate(context.get(), "f.val2;", -1));
    798815        checker.watch(value.get());
    799816        g_assert_true(jsc_value_is_number(value.get()));
    800817        g_assert_cmpint(jsc_value_to_int32(value.get()), ==, 32);
     818
     819        properties.reset(jsc_value_object_enumerate_properties(object.get()));
     820        g_assert_cmpuint(g_strv_length(properties.get()), ==, 1);
     821        g_assert_cmpstr(properties.get()[0], ==, "val2");
     822        g_assert_null(properties.get()[1]);
    801823
    802824        value = adoptGRef(jsc_context_evaluate(context.get(), "'use strict'; f.val2 = 45;", -1));
     
    812834        g_assert_true(jsc_value_to_boolean(value.get()) == TRUE);
    813835
     836        g_assert_false(jsc_value_object_delete_property(object.get(), "val2"));
     837        g_assert_true(jsc_value_object_has_property(object.get(), "val2"));
     838
    814839        property = adoptGRef(jsc_value_new_number(context.get(), 125));
    815840        checker.watch(property.get());
     841        g_assert_false(jsc_value_object_has_property(object.get(), "val3"));
    816842        jsc_value_object_define_property_data(object.get(), "val3", static_cast<JSCValuePropertyFlags>(JSC_VALUE_PROPERTY_CONFIGURABLE | JSC_VALUE_PROPERTY_WRITABLE), property.get());
     843        g_assert_true(jsc_value_object_has_property(object.get(), "val3"));
    817844        value = adoptGRef(jsc_context_evaluate(context.get(), "f.val3;", -1));
    818845        checker.watch(value.get());
    819846        g_assert_true(jsc_value_is_number(value.get()));
    820847        g_assert_cmpint(jsc_value_to_int32(value.get()), ==, 125);
     848
     849        properties.reset(jsc_value_object_enumerate_properties(object.get()));
     850        g_assert_cmpuint(g_strv_length(properties.get()), ==, 1);
     851        g_assert_cmpstr(properties.get()[0], ==, "val2");
     852        g_assert_null(properties.get()[1]);
    821853
    822854        property = adoptGRef(jsc_value_new_number(context.get(), 150));
    823855        checker.watch(property.get());
    824856        jsc_value_object_define_property_data(object.get(), "val3", static_cast<JSCValuePropertyFlags>(JSC_VALUE_PROPERTY_CONFIGURABLE), property.get());
     857        g_assert_true(jsc_value_object_has_property(object.get(), "val3"));
    825858        value = adoptGRef(jsc_context_evaluate(context.get(), "f.val3;", -1));
    826859        checker.watch(value.get());
     
    828861        g_assert_cmpint(jsc_value_to_int32(value.get()), ==, 150);
    829862
     863        properties.reset(jsc_value_object_enumerate_properties(object.get()));
     864        g_assert_cmpuint(g_strv_length(properties.get()), ==, 1);
     865        g_assert_cmpstr(properties.get()[0], ==, "val2");
     866        g_assert_null(properties.get()[1]);
     867
    830868        value = adoptGRef(jsc_context_evaluate(context.get(), "delete f.val3;", -1));
    831869        checker.watch(value.get());
     870        g_assert_false(jsc_value_object_has_property(object.get(), "val3"));
    832871        value = adoptGRef(jsc_context_evaluate(context.get(), "f.val3;", -1));
    833872        checker.watch(value.get());
    834873        g_assert_true(jsc_value_is_undefined(value.get()));
     874
     875        property = adoptGRef(jsc_value_new_number(context.get(), 250));
     876        checker.watch(property.get());
     877        g_assert_false(jsc_value_object_has_property(object.get(), "val4"));
     878        jsc_value_object_define_property_data(object.get(), "val4", static_cast<JSCValuePropertyFlags>(JSC_VALUE_PROPERTY_CONFIGURABLE | JSC_VALUE_PROPERTY_ENUMERABLE), property.get());
     879        g_assert_true(jsc_value_object_has_property(object.get(), "val4"));
     880        value = adoptGRef(jsc_context_evaluate(context.get(), "f.val4;", -1));
     881        checker.watch(value.get());
     882        g_assert_true(jsc_value_is_number(value.get()));
     883        g_assert_cmpint(jsc_value_to_int32(value.get()), ==, 250);
     884
     885        properties.reset(jsc_value_object_enumerate_properties(object.get()));
     886        g_assert_cmpuint(g_strv_length(properties.get()), ==, 2);
     887        g_assert_cmpstr(properties.get()[0], ==, "val2");
     888        g_assert_cmpstr(properties.get()[1], ==, "val4");
     889        g_assert_null(properties.get()[2]);
     890
     891        g_assert_true(jsc_value_object_delete_property(object.get(), "val4"));
     892        g_assert_false(jsc_value_object_has_property(object.get(), "val4"));
     893
     894        properties.reset(jsc_value_object_enumerate_properties(object.get()));
     895        g_assert_cmpuint(g_strv_length(properties.get()), ==, 1);
     896        g_assert_cmpstr(properties.get()[0], ==, "val2");
     897        g_assert_null(properties.get()[1]);
    835898
    836899        GRefPtr<JSCValue> function = adoptGRef(jsc_value_new_function(context.get(), "foo", G_CALLBACK(foo), nullptr, nullptr, G_TYPE_INT, 1, G_TYPE_INT));
    837900        checker.watch(function.get());
    838901
     902        g_assert_false(jsc_value_object_has_property(object.get(), "foo"));
    839903        jsc_value_object_define_property_data(object.get(), "foo", static_cast<JSCValuePropertyFlags>(0), function.get());
     904        g_assert_true(jsc_value_object_has_property(object.get(), "foo"));
     905
     906        properties.reset(jsc_value_object_enumerate_properties(object.get()));
     907        g_assert_cmpuint(g_strv_length(properties.get()), ==, 1);
     908        g_assert_cmpstr(properties.get()[0], ==, "val2");
     909        g_assert_null(properties.get()[1]);
    840910
    841911        GRefPtr<JSCValue> result = adoptGRef(jsc_value_object_invoke_method(object.get(), "foo", G_TYPE_INT, 200, G_TYPE_NONE));
     
    9971067        g_assert_true(jsc_value_to_boolean(result.get()));
    9981068
     1069        GUniquePtr<char*> properties(jsc_value_object_enumerate_properties(foo.get()));
     1070        g_assert_null(properties.get());
     1071
     1072        g_assert_false(jsc_value_object_has_property(foo.get(), "getFoo"));
    9991073        jsc_class_add_method(jscClass, "getFoo", G_CALLBACK(getFoo), nullptr, nullptr, G_TYPE_INT, 0, G_TYPE_NONE);
     1074        g_assert_true(jsc_value_object_has_property(foo.get(), "getFoo"));
     1075        properties.reset(jsc_value_object_enumerate_properties(foo.get()));
     1076        g_assert_null(properties.get());
    10001077        GRefPtr<JSCValue> value = adoptGRef(jsc_value_object_invoke_method(foo.get(), "getFoo", G_TYPE_NONE));
    10011078        checker.watch(value.get());
     
    10071084        g_assert_true(value.get() == value2.get());
    10081085
     1086        g_assert_false(jsc_value_object_has_property(foo.get(), "setFoo"));
    10091087        jsc_class_add_method(jscClass, "setFoo", G_CALLBACK(setFoo), nullptr, nullptr, G_TYPE_NONE, 1, G_TYPE_INT);
     1088        g_assert_true(jsc_value_object_has_property(foo.get(), "setFoo"));
     1089        properties.reset(jsc_value_object_enumerate_properties(foo.get()));
     1090        g_assert_null(properties.get());
    10101091        result = adoptGRef(jsc_value_object_invoke_method(foo.get(), "setFoo", G_TYPE_INT, 25, G_TYPE_NONE));
    10111092        checker.watch(result.get());
     
    10411122        g_assert_true(jsc_value_to_boolean(result.get()));
    10421123
     1124        g_assert_false(jsc_value_object_has_property(foo.get(), "foo"));
     1125        g_assert_false(jsc_value_object_has_property(foo2.get(), "foo"));
    10431126        jsc_class_add_property(jscClass, "foo", G_TYPE_INT, G_CALLBACK(getFoo), G_CALLBACK(setFoo), nullptr, nullptr);
     1127        g_assert_true(jsc_value_object_has_property(foo.get(), "foo"));
     1128        g_assert_true(jsc_value_object_has_property(foo2.get(), "foo"));
     1129        properties.reset(jsc_value_object_enumerate_properties(foo.get()));
     1130        g_assert_null(properties.get());
    10441131        value = adoptGRef(jsc_context_evaluate(context.get(), "f2.foo", -1));
    10451132        checker.watch(value.get());
     
    10931180        checker.watch(f1.get());
    10941181        g_assert_true(jsc_value_is_object(f1.get()));
     1182        g_assert_true(jsc_value_object_has_property(f1.get(), "sibling"));
     1183        GUniquePtr<char*> properties(jsc_value_object_enumerate_properties(f1.get()));
     1184        g_assert_null(properties.get());
    10951185        GRefPtr<JSCValue> f2 = adoptGRef(jsc_context_get_value(context.get(), "f2"));
    10961186        checker.watch(f2.get());
    10971187        g_assert_true(jsc_value_is_object(f2.get()));
     1188        g_assert_true(jsc_value_object_has_property(f2.get(), "sibling"));
     1189        properties.reset(jsc_value_object_enumerate_properties(f2.get()));
     1190        g_assert_null(properties.get());
    10981191
    10991192        GRefPtr<JSCValue> value = adoptGRef(jsc_context_evaluate(context.get(), "f2.sibling", -1));
     
    11271220        g_assert_true(jsc_value_is_object(foo.get()));
    11281221        g_assert_true(jsc_value_object_is_instance_of(foo.get(), jsc_class_get_name(jscClass)));
     1222        g_assert_true(jsc_value_object_has_property(foo.get(), "foo"));
     1223        GUniquePtr<char*> properties(jsc_value_object_enumerate_properties(foo.get()));
     1224        g_assert_null(properties.get());
    11291225
    11301226        jsc_context_set_value(context.get(), "f", foo.get());
     
    11601256        g_assert_false(jsc_value_object_is_instance_of(baz.get(), jsc_class_get_name(jscClass)));
    11611257        g_assert_false(jsc_value_object_is_instance_of(foo.get(), jsc_class_get_name(bazClass)));
     1258        g_assert_false(jsc_value_object_has_property(baz.get(), "foo"));
    11621259
    11631260        jsc_context_set_value(context.get(), "bz", baz.get());
     
    12031300        g_assert_true(jsc_value_is_object(foo.get()));
    12041301        g_assert_true(jsc_value_object_is_instance_of(foo.get(), jsc_class_get_name(jscClass)));
     1302        g_assert_true(jsc_value_object_has_property(foo.get(), "foo"));
     1303        GUniquePtr<char*> properties(jsc_value_object_enumerate_properties(foo.get()));
     1304        g_assert_null(properties.get());
    12051305
    12061306        jsc_context_set_value(context.get(), "f1", foo.get());
     
    12131313        GRefPtr<JSCValue> property = adoptGRef(jsc_value_new_number(context.get(), 50));
    12141314        checker.watch(property.get());
     1315        g_assert_false(jsc_value_object_has_property(foo.get(), "n"));
    12151316        jsc_value_object_set_property(foo.get(), "n", property.get());
     1317        g_assert_true(jsc_value_object_has_property(foo.get(), "n"));
    12161318        result = adoptGRef(jsc_context_evaluate(context.get(), "f1.n", -1));
    12171319        checker.watch(result.get());
     
    12391341        g_assert_true(jsc_value_is_object(foo.get()));
    12401342        g_assert_true(jsc_value_object_is_instance_of(foo.get(), jsc_class_get_name(jscClass)));
     1343        g_assert_true(jsc_value_object_has_property(foo.get(), "foo"));
     1344        GUniquePtr<char*> properties(jsc_value_object_enumerate_properties(foo.get()));
     1345        g_assert_null(properties.get());
    12411346
    12421347        GRefPtr<JSCValue> value = adoptGRef(jsc_value_new_number(context.get(), 125));
     
    13091414        g_assert_true(jsc_value_is_object(foo.get()));
    13101415        g_assert_true(jsc_value_object_is_instance_of(foo.get(), "wk.Foo"));
     1416        g_assert_true(jsc_value_object_has_property(foo.get(), "foo"));
     1417        GUniquePtr<char*> properties(jsc_value_object_enumerate_properties(foo.get()));
     1418        g_assert_null(properties.get());
    13111419        GRefPtr<JSCValue> result = adoptGRef(jsc_context_evaluate(context.get(), "f instanceof wk.Foo;", -1));
    13121420        checker.watch(result.get());
     
    14471555        g_assert_true(jsc_value_is_boolean(result.get()));
    14481556        g_assert_false(jsc_value_to_boolean(result.get()));
     1557        g_assert_true(jsc_value_object_has_property(foo.get(), "foo"));
     1558        g_assert_false(jsc_value_object_has_property(foo.get(), "bar"));
     1559        GUniquePtr<char*> properties(jsc_value_object_enumerate_properties(foo.get()));
     1560        g_assert_null(properties.get());
    14491561
    14501562        GRefPtr<JSCValue> bar = adoptGRef(jsc_context_get_value(context.get(), "b"));
     
    14621574        g_assert_true(jsc_value_is_boolean(result.get()));
    14631575        g_assert_true(jsc_value_to_boolean(result.get()));
     1576        g_assert_true(jsc_value_object_has_property(bar.get(), "bar"));
     1577        g_assert_true(jsc_value_object_has_property(bar.get(), "foo"));
     1578        properties.reset(jsc_value_object_enumerate_properties(bar.get()));
     1579        g_assert_null(properties.get());
    14641580
    14651581        result = adoptGRef(jsc_context_evaluate(context.get(), "b.bar = 25; b.foo = 42;", -1));
Note: See TracChangeset for help on using the changeset viewer.