Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix Reflect with detached ArrayBuffer #239

Merged
merged 1 commit into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -8730,7 +8730,7 @@ static int JS_SetPropertyValue(JSContext *ctx, JSValue this_obj,
ta_out_of_bound:
if (typed_array_is_detached(ctx, p))
if (!(flags & JS_PROP_DEFINE_PROPERTY))
return FALSE; // per spec: no OOB exception
return TRUE; // per spec: no OOB exception
return JS_ThrowTypeErrorOrFalse(ctx, flags, "out-of-bound numeric index");
}
p->u.array.u.double_ptr[idx] = d;
Expand Down Expand Up @@ -34586,8 +34586,7 @@ static __exception int JS_DefinePropertyDesc(JSContext *ctx, JSValue obj,
return -1;

ret = JS_DefineProperty(ctx, obj, prop,
d.value, d.getter, d.setter,
d.flags | flags | JS_PROP_DEFINE_PROPERTY);
d.value, d.getter, d.setter, d.flags | flags);
js_free_desc(ctx, &d);
return ret;
}
Expand Down Expand Up @@ -34618,7 +34617,8 @@ static __exception int JS_ObjectDefineProperties(JSContext *ctx,
desc = JS_GetProperty(ctx, props, atoms[i].atom);
if (JS_IsException(desc))
goto exception;
if (JS_DefinePropertyDesc(ctx, obj, atoms[i].atom, desc, JS_PROP_THROW) < 0)
if (JS_DefinePropertyDesc(ctx, obj, atoms[i].atom, desc,
JS_PROP_THROW | JS_PROP_DEFINE_PROPERTY) < 0)
goto exception;
}
ret = 0;
Expand Down Expand Up @@ -34720,7 +34720,7 @@ static JSValue js_object_defineProperty(JSContext *ctx, JSValue this_val,
return JS_EXCEPTION;
flags = 0;
if (!magic)
flags |= JS_PROP_THROW;
flags = JS_PROP_THROW | JS_PROP_DEFINE_PROPERTY;
ret = JS_DefinePropertyDesc(ctx, obj, atom, desc, flags);
JS_FreeAtom(ctx, atom);
if (ret < 0) {
Expand Down
8 changes: 0 additions & 8 deletions test262_errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,8 @@ test262/test/built-ins/RegExp/lookahead-quantifier-match-groups.js:27: Test262Er
test262/test/built-ins/RegExp/lookahead-quantifier-match-groups.js:27: strict mode: Test262Error: Expected [a, abc] and [a, undefined] to have the same contents. ? quantifier
test262/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer.js:46: Test262Error: (Testing with BigInt64Array.)
test262/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer.js:46: strict mode: Test262Error: (Testing with BigInt64Array.)
test262/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/tonumber-value-detached-buffer.js:40: Test262Error: Reflect.defineProperty(ta, 0, {value: {valueOf() {$DETACHBUFFER(ta.buffer); return 42n;}}}) must return true Expected SameValue(«false», «true») to be true (Testing with BigInt64Array.)
test262/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/tonumber-value-detached-buffer.js:40: strict mode: Test262Error: Reflect.defineProperty(ta, 0, {value: {valueOf() {$DETACHBUFFER(ta.buffer); return 42n;}}}) must return true Expected SameValue(«false», «true») to be true (Testing with BigInt64Array.)
test262/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/detached-buffer.js:47: Test262Error: (Testing with Float64Array.)
test262/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/detached-buffer.js:47: strict mode: Test262Error: (Testing with Float64Array.)
test262/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/tonumber-value-detached-buffer.js:42: Test262Error: Reflect.defineProperty(ta, 0, {value: {valueOf() {$DETACHBUFFER(ta.buffer); return 42;}}} ) must return true Expected SameValue(«false», «true») to be true (Testing with Float64Array.)
test262/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/tonumber-value-detached-buffer.js:42: strict mode: Test262Error: Reflect.defineProperty(ta, 0, {value: {valueOf() {$DETACHBUFFER(ta.buffer); return 42;}}} ) must return true Expected SameValue(«false», «true») to be true (Testing with Float64Array.)
test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/tonumber-value-detached-buffer.js:24: Test262Error: Expected SameValue(«false», «true») to be true (Testing with BigInt64Array.)
test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/tonumber-value-detached-buffer.js:24: strict mode: Test262Error: Expected SameValue(«false», «true») to be true (Testing with BigInt64Array.)
test262/test/built-ins/TypedArrayConstructors/internals/Set/tonumber-value-detached-buffer.js:39: Test262Error: Expected SameValue(«false», «true») to be true (Testing with Float64Array.)
test262/test/built-ins/TypedArrayConstructors/internals/Set/tonumber-value-detached-buffer.js:39: strict mode: Test262Error: Expected SameValue(«false», «true») to be true (Testing with Float64Array.)
test262/test/language/expressions/arrow-function/static-init-await-reference.js:12: unexpected error type: Test262: This statement should not be evaluated.
test262/test/language/expressions/arrow-function/static-init-await-reference.js:12: strict mode: unexpected error type: Test262: This statement should not be evaluated.
test262/test/language/expressions/assignment/target-member-computed-reference-null.js:32: Test262Error: Expected a DummyError but got a TypeError
Expand Down