Changeset 273750 in webkit
- Timestamp:
- Mar 2, 2021 12:00:31 PM (17 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 8 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/array-species-config-array-constructor.js (modified) (1 diff)
-
JSTests/stress/put-direct-index-broken-2.js (modified) (1 diff)
-
JSTests/stress/typedarray-access-monomorphic-neutered.js (modified) (2 diffs)
-
JSTests/stress/typedarray-access-neutered.js (modified) (1 diff)
-
JSTests/stress/typedarray-defineOwnProperty-error.js (added)
-
JSTests/test262/expectations.yaml (modified) (1 diff)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r273717 r273750 1 2021-03-02 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 TypedArray's [[DefineOwnProperty]] should throw in case of failure 4 https://bugs.webkit.org/show_bug.cgi?id=220492 5 6 Reviewed by Darin Adler. 7 8 * stress/array-species-config-array-constructor.js: 9 * stress/put-direct-index-broken-2.js: 10 Update assertions, which are most certainly incorrect, partly aligning JSC with V8. 11 12 * stress/typedarray-access-monomorphic-neutered.js: 13 * stress/typedarray-access-neutered.js: 14 * stress/typedarray-defineOwnProperty-error.js: Added. 15 * test262/expectations.yaml: 16 Incorrect tests are being updated at https://github.com/tc39/test262/pull/2958. 17 1 18 2021-03-01 Yusuke Suzuki <ysuzuki@apple.com> 2 19 -
trunk/JSTests/stress/array-species-config-array-constructor.js
r268640 r273750 32 32 33 33 function test() { 34 foo.concat([1]); 34 shouldThrow(() => { 35 foo.concat([1]); 36 }, "TypeError: Attempting to store out-of-bounds property on a typed array at index: 0"); 35 37 foo = [1,2,3,4]; 36 38 foo.slice(0); -
trunk/JSTests/stress/put-direct-index-broken-2.js
r268640 r273750 57 57 err = e; 58 58 } 59 assert( !err);59 assert(err.toString() == "TypeError: Attempting to store out-of-bounds property on a typed array at index: 0"); 60 60 }); 61 61 -
trunk/JSTests/stress/typedarray-access-monomorphic-neutered.js
r268640 r273750 21 21 testNoException("array[0] = 1", array); 22 22 testNoException("array[i] = 1", array); 23 testNoException("Object.defineProperty(array, 0, { value: 1, writable: true, configurable: true, enumerable: true })", array);24 23 } 25 24 … … 41 40 testFTLNoException("array[0] = 1", array, failArray); 42 41 testFTLNoException("array[i] = 1", array, failArray); 43 testFTLNoException("Object.defineProperty(array, 0, { value: 1, writable: true, configurable: true, enumerable: true })", array, failArray);44 42 } -
trunk/JSTests/stress/typedarray-access-neutered.js
r268640 r273750 17 17 testNoException((array) => Object.getOwnPropertyDescriptor(array, 0), i); 18 18 testNoException((array) => array[0] = 1, i); 19 testNoException((array) => Object.defineProperty(array, 0, { value: 1, writable: true, configurable: true, enumerable: true }), i)20 19 } -
trunk/JSTests/test262/expectations.yaml
r273661 r273750 827 827 default: 'SyntaxError: Invalid regular expression: number too large in {} quantifier' 828 828 strict mode: 'SyntaxError: Invalid regular expression: number too large in {} quantifier' 829 test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/tonumber-value-detached-buffer.js: 830 default: 'Test262Error: Reflect.defineProperty(ta, 0, {value: {valueOf() {$DETACHBUFFER(ta.buffer); return 42n;}}}) must return false Expected SameValue(«true», «false») to be true (Testing with BigInt64Array.)' 831 strict mode: 'Test262Error: Reflect.defineProperty(ta, 0, {value: {valueOf() {$DETACHBUFFER(ta.buffer); return 42n;}}}) must return false Expected SameValue(«true», «false») to be true (Testing with BigInt64Array.)' 832 test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/tonumber-value-detached-buffer.js: 833 default: 'Test262Error: Reflect.defineProperty(ta, 0, {value: {valueOf() {$DETACHBUFFER(ta.buffer); return 42;}}} ) must return false Expected SameValue(«true», «false») to be true (Testing with Float64Array.)' 834 strict mode: 'Test262Error: Reflect.defineProperty(ta, 0, {value: {valueOf() {$DETACHBUFFER(ta.buffer); return 42;}}} ) must return false Expected SameValue(«true», «false») to be true (Testing with Float64Array.)' 829 835 test/intl402/DateTimeFormat/prototype/formatRange/en-US.js: 830 836 default: 'Test262Error: Expected SameValue(«1/3/2019 – 1/5/2019», «1/3/2019 – 1/5/2019») to be true' -
trunk/Source/JavaScriptCore/ChangeLog
r273718 r273750 1 2021-03-02 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 TypedArray's [[DefineOwnProperty]] should throw in case of failure 4 https://bugs.webkit.org/show_bug.cgi?id=220492 5 6 Reviewed by Darin Adler. 7 8 While web reality [1] requires failures of the most TypeArray internal methods to be 9 silent, [[DefineOwnProperty]] can fail loudly if called via Object.defineProperty. 10 11 With this patch, TypeError is thrown for detached buffer, out-of-bounds index, and 12 non-index canonical numeric string key. Aligns JSC with the spec [2], V8, and SM. 13 14 [1]: https://github.com/tc39/ecma262/pull/2164 15 [2]: https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects-defineownproperty-p-desc (step 3.b) 16 17 * runtime/JSGenericTypedArrayViewInlines.h: 18 (JSC::JSGenericTypedArrayView<Adaptor>::defineOwnProperty): 19 1 20 2021-03-01 Keith Miller <keith_miller@apple.com> 2 21 -
trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h
r273138 r273750 404 404 }; 405 405 406 if (index.value() >= thisObject->m_length) 407 return false; 406 if (thisObject->isDetached()) 407 return typeError(globalObject, scope, shouldThrow, typedArrayBufferHasBeenDetachedErrorMessage); 408 409 if (!thisObject->inBounds(index.value())) 410 return throwTypeErrorIfNeeded("Attempting to store out-of-bounds property on a typed array at index: "); 408 411 409 412 if (descriptor.isAccessorDescriptor()) … … 419 422 return throwTypeErrorIfNeeded("Attempting to store non-writable property on a typed array at index: "); 420 423 424 scope.release(); 421 425 if (descriptor.value()) 422 RELEASE_AND_RETURN(scope, thisObject->setIndex(globalObject, index.value(), descriptor.value()));426 thisObject->setIndex(globalObject, index.value(), descriptor.value()); 423 427 424 428 return true; … … 426 430 427 431 if (isCanonicalNumericIndexString(propertyName)) 428 return false;432 return typeError(globalObject, scope, shouldThrow, "Attempting to store canonical numeric string property on a typed array"_s); 429 433 430 434 RELEASE_AND_RETURN(scope, Base::defineOwnProperty(thisObject, globalObject, propertyName, descriptor, shouldThrow));
Note: See TracChangeset
for help on using the changeset viewer.