[quickjs-devel] Bug in Object.seal() and Object.freeze()

  • From: junsik park <junsik.park@xxxxxxxxx>
  • To: quickjs-devel@xxxxxxxxxxxxx
  • Date: Tue, 14 Jan 2020 09:27:56 +0900

Unlike previous, 2020-01-05 quickjs returns true for Object.seal() and
Object.freeze().

Returned value should be sealed.


- junsik



diff --git a/quickjs.c b/quickjs.c
index 4c467af..99c892d 100644
--- a/quickjs.c
+++ b/quickjs.c
@@ -35191,7 +35191,7 @@ static JSValue js_object_seal(JSContext *ctx,
JSValueConst this_val,
             goto exception;
     }
     js_free_prop_enum(ctx, props, len);
-    return JS_TRUE;
+    return js_object_preventExtensions(ctx, JS_UNDEFINED, 1, argv, 0);

  exception:
     js_free_prop_enum(ctx, props, len);

Other related posts: