diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2025-04-22 18:59:21 +0200 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2025-04-22 18:59:21 +0200 |
commit | 1e958abcd83c4160d02b5a4d8fa2d451227a6771 (patch) | |
tree | 1faa0c7d9b51ad4f6a920e6f7f79fb77fc05a07e | |
parent | 5afd0eb37b270bedbef2a66efd5d3925d6b820bb (diff) | |
download | quickjs-1e958abcd83c4160d02b5a4d8fa2d451227a6771.tar.gz quickjs-1e958abcd83c4160d02b5a4d8fa2d451227a6771.zip |
fixed operation order in Object.prototype.propertyIsEnumerable()
-rw-r--r-- | quickjs.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -37312,6 +37312,7 @@ static __exception int JS_ObjectDefineProperties(JSContext *ctx, if (JS_IsException(props)) return -1; p = JS_VALUE_GET_OBJ(props); + /* XXX: not done in the same order as the spec */ if (JS_GetOwnPropertyNamesInternal(ctx, &atoms, &len, p, JS_GPN_ENUM_ONLY | JS_GPN_STRING_MASK | JS_GPN_SYMBOL_MASK) < 0) goto exception; for(i = 0; i < len; i++) { @@ -38268,17 +38269,17 @@ exception: static JSValue js_object_propertyIsEnumerable(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv) { - JSValue obj, res = JS_EXCEPTION; - JSAtom prop = JS_ATOM_NULL; + JSValue obj = JS_UNDEFINED, res = JS_EXCEPTION; + JSAtom prop; JSPropertyDescriptor desc; int has_prop; - obj = JS_ToObject(ctx, this_val); - if (JS_IsException(obj)) - goto exception; prop = JS_ValueToAtom(ctx, argv[0]); if (unlikely(prop == JS_ATOM_NULL)) goto exception; + obj = JS_ToObject(ctx, this_val); + if (JS_IsException(obj)) + goto exception; has_prop = JS_GetOwnPropertyInternal(ctx, &desc, JS_VALUE_GET_OBJ(obj), prop); if (has_prop < 0) |