haikuwebkit/LayoutTests/js/typedarray-constructors-exp...

40 lines
2.1 KiB
Plaintext
Raw Permalink Normal View History

This test case tests the various typed array and related constructors. In particular, makes sure that you use the "new" keyword when using the constructors.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Debug assertion failure while loading http://kangax.github.io/compat-table/es6/. https://bugs.webkit.org/show_bug.cgi?id=154542 Reviewed by Saam Barati. Source/JavaScriptCore: According to the spec, the constructors of the following types "are not intended to be called as a function and will throw an exception". These types are: TypedArrays - https://tc39.github.io/ecma262/#sec-typedarray-constructors Map - https://tc39.github.io/ecma262/#sec-map-constructor Set - https://tc39.github.io/ecma262/#sec-set-constructor WeakMap - https://tc39.github.io/ecma262/#sec-weakmap-constructor WeakSet - https://tc39.github.io/ecma262/#sec-weakset-constructor ArrayBuffer - https://tc39.github.io/ecma262/#sec-arraybuffer-constructor DataView - https://tc39.github.io/ecma262/#sec-dataview-constructor Promise - https://tc39.github.io/ecma262/#sec-promise-constructor Proxy - https://tc39.github.io/ecma262/#sec-proxy-constructor This patch does the foillowing: 1. Ensures that these constructors can be called but will throw a TypeError when called. 2. Makes all these objects use throwConstructorCannotBeCalledAsFunctionTypeError() in their implementation to be consistent. 3. Change the error message to "calling XXX constructor without new is invalid". This is clearer because the error is likely due to the user forgetting to use the new operator on these constructors. * runtime/Error.h: * runtime/Error.cpp: (JSC::throwConstructorCannotBeCalledAsFunctionTypeError): - Added a convenience function to throw the TypeError. * runtime/JSArrayBufferConstructor.cpp: (JSC::constructArrayBuffer): (JSC::callArrayBuffer): (JSC::JSArrayBufferConstructor::getCallData): * runtime/JSGenericTypedArrayViewConstructorInlines.h: (JSC::callGenericTypedArrayView): (JSC::JSGenericTypedArrayViewConstructor<ViewClass>::getCallData): * runtime/JSPromiseConstructor.cpp: (JSC::callPromise): * runtime/MapConstructor.cpp: (JSC::callMap): * runtime/ProxyConstructor.cpp: (JSC::callProxy): (JSC::ProxyConstructor::getCallData): * runtime/SetConstructor.cpp: (JSC::callSet): * runtime/WeakMapConstructor.cpp: (JSC::callWeakMap): * runtime/WeakSetConstructor.cpp: (JSC::callWeakSet): * tests/es6.yaml: - The typed_arrays_%TypedArray%[Symbol.species].js test now passes. * tests/stress/call-non-calleable-constructors-as-function.js: Added. (test): * tests/stress/map-constructor.js: (testCallTypeError): * tests/stress/promise-cannot-be-called.js: (shouldThrow): * tests/stress/proxy-basic.js: * tests/stress/set-constructor.js: * tests/stress/throw-from-ftl-call-ic-slow-path-cells.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path-undefined.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path.js: (i.catch): * tests/stress/weak-map-constructor.js: (testCallTypeError): * tests/stress/weak-set-constructor.js: - Updated error message string. LayoutTests: * js/Promise-types-expected.txt: * js/basic-map-expected.txt: * js/basic-set-expected.txt: * js/dom/basic-weakmap-expected.txt: * js/dom/basic-weakset-expected.txt: * js/script-tests/Promise-types.js: * js/typedarray-constructors-expected.txt: - Updated error message string. Canonical link: https://commits.webkit.org/172692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-23 19:41:56 +00:00
PASS Int8Array() threw exception TypeError: calling Int8Array constructor without new is invalid.
PASS new Int8Array() did not throw exception.
PASS Int8Array.length is 3
Debug assertion failure while loading http://kangax.github.io/compat-table/es6/. https://bugs.webkit.org/show_bug.cgi?id=154542 Reviewed by Saam Barati. Source/JavaScriptCore: According to the spec, the constructors of the following types "are not intended to be called as a function and will throw an exception". These types are: TypedArrays - https://tc39.github.io/ecma262/#sec-typedarray-constructors Map - https://tc39.github.io/ecma262/#sec-map-constructor Set - https://tc39.github.io/ecma262/#sec-set-constructor WeakMap - https://tc39.github.io/ecma262/#sec-weakmap-constructor WeakSet - https://tc39.github.io/ecma262/#sec-weakset-constructor ArrayBuffer - https://tc39.github.io/ecma262/#sec-arraybuffer-constructor DataView - https://tc39.github.io/ecma262/#sec-dataview-constructor Promise - https://tc39.github.io/ecma262/#sec-promise-constructor Proxy - https://tc39.github.io/ecma262/#sec-proxy-constructor This patch does the foillowing: 1. Ensures that these constructors can be called but will throw a TypeError when called. 2. Makes all these objects use throwConstructorCannotBeCalledAsFunctionTypeError() in their implementation to be consistent. 3. Change the error message to "calling XXX constructor without new is invalid". This is clearer because the error is likely due to the user forgetting to use the new operator on these constructors. * runtime/Error.h: * runtime/Error.cpp: (JSC::throwConstructorCannotBeCalledAsFunctionTypeError): - Added a convenience function to throw the TypeError. * runtime/JSArrayBufferConstructor.cpp: (JSC::constructArrayBuffer): (JSC::callArrayBuffer): (JSC::JSArrayBufferConstructor::getCallData): * runtime/JSGenericTypedArrayViewConstructorInlines.h: (JSC::callGenericTypedArrayView): (JSC::JSGenericTypedArrayViewConstructor<ViewClass>::getCallData): * runtime/JSPromiseConstructor.cpp: (JSC::callPromise): * runtime/MapConstructor.cpp: (JSC::callMap): * runtime/ProxyConstructor.cpp: (JSC::callProxy): (JSC::ProxyConstructor::getCallData): * runtime/SetConstructor.cpp: (JSC::callSet): * runtime/WeakMapConstructor.cpp: (JSC::callWeakMap): * runtime/WeakSetConstructor.cpp: (JSC::callWeakSet): * tests/es6.yaml: - The typed_arrays_%TypedArray%[Symbol.species].js test now passes. * tests/stress/call-non-calleable-constructors-as-function.js: Added. (test): * tests/stress/map-constructor.js: (testCallTypeError): * tests/stress/promise-cannot-be-called.js: (shouldThrow): * tests/stress/proxy-basic.js: * tests/stress/set-constructor.js: * tests/stress/throw-from-ftl-call-ic-slow-path-cells.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path-undefined.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path.js: (i.catch): * tests/stress/weak-map-constructor.js: (testCallTypeError): * tests/stress/weak-set-constructor.js: - Updated error message string. LayoutTests: * js/Promise-types-expected.txt: * js/basic-map-expected.txt: * js/basic-set-expected.txt: * js/dom/basic-weakmap-expected.txt: * js/dom/basic-weakset-expected.txt: * js/script-tests/Promise-types.js: * js/typedarray-constructors-expected.txt: - Updated error message string. Canonical link: https://commits.webkit.org/172692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-23 19:41:56 +00:00
PASS Int16Array() threw exception TypeError: calling Int16Array constructor without new is invalid.
PASS new Int16Array() did not throw exception.
PASS Int16Array.length is 3
Debug assertion failure while loading http://kangax.github.io/compat-table/es6/. https://bugs.webkit.org/show_bug.cgi?id=154542 Reviewed by Saam Barati. Source/JavaScriptCore: According to the spec, the constructors of the following types "are not intended to be called as a function and will throw an exception". These types are: TypedArrays - https://tc39.github.io/ecma262/#sec-typedarray-constructors Map - https://tc39.github.io/ecma262/#sec-map-constructor Set - https://tc39.github.io/ecma262/#sec-set-constructor WeakMap - https://tc39.github.io/ecma262/#sec-weakmap-constructor WeakSet - https://tc39.github.io/ecma262/#sec-weakset-constructor ArrayBuffer - https://tc39.github.io/ecma262/#sec-arraybuffer-constructor DataView - https://tc39.github.io/ecma262/#sec-dataview-constructor Promise - https://tc39.github.io/ecma262/#sec-promise-constructor Proxy - https://tc39.github.io/ecma262/#sec-proxy-constructor This patch does the foillowing: 1. Ensures that these constructors can be called but will throw a TypeError when called. 2. Makes all these objects use throwConstructorCannotBeCalledAsFunctionTypeError() in their implementation to be consistent. 3. Change the error message to "calling XXX constructor without new is invalid". This is clearer because the error is likely due to the user forgetting to use the new operator on these constructors. * runtime/Error.h: * runtime/Error.cpp: (JSC::throwConstructorCannotBeCalledAsFunctionTypeError): - Added a convenience function to throw the TypeError. * runtime/JSArrayBufferConstructor.cpp: (JSC::constructArrayBuffer): (JSC::callArrayBuffer): (JSC::JSArrayBufferConstructor::getCallData): * runtime/JSGenericTypedArrayViewConstructorInlines.h: (JSC::callGenericTypedArrayView): (JSC::JSGenericTypedArrayViewConstructor<ViewClass>::getCallData): * runtime/JSPromiseConstructor.cpp: (JSC::callPromise): * runtime/MapConstructor.cpp: (JSC::callMap): * runtime/ProxyConstructor.cpp: (JSC::callProxy): (JSC::ProxyConstructor::getCallData): * runtime/SetConstructor.cpp: (JSC::callSet): * runtime/WeakMapConstructor.cpp: (JSC::callWeakMap): * runtime/WeakSetConstructor.cpp: (JSC::callWeakSet): * tests/es6.yaml: - The typed_arrays_%TypedArray%[Symbol.species].js test now passes. * tests/stress/call-non-calleable-constructors-as-function.js: Added. (test): * tests/stress/map-constructor.js: (testCallTypeError): * tests/stress/promise-cannot-be-called.js: (shouldThrow): * tests/stress/proxy-basic.js: * tests/stress/set-constructor.js: * tests/stress/throw-from-ftl-call-ic-slow-path-cells.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path-undefined.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path.js: (i.catch): * tests/stress/weak-map-constructor.js: (testCallTypeError): * tests/stress/weak-set-constructor.js: - Updated error message string. LayoutTests: * js/Promise-types-expected.txt: * js/basic-map-expected.txt: * js/basic-set-expected.txt: * js/dom/basic-weakmap-expected.txt: * js/dom/basic-weakset-expected.txt: * js/script-tests/Promise-types.js: * js/typedarray-constructors-expected.txt: - Updated error message string. Canonical link: https://commits.webkit.org/172692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-23 19:41:56 +00:00
PASS Int32Array() threw exception TypeError: calling Int32Array constructor without new is invalid.
PASS new Int32Array() did not throw exception.
PASS Int32Array.length is 3
Debug assertion failure while loading http://kangax.github.io/compat-table/es6/. https://bugs.webkit.org/show_bug.cgi?id=154542 Reviewed by Saam Barati. Source/JavaScriptCore: According to the spec, the constructors of the following types "are not intended to be called as a function and will throw an exception". These types are: TypedArrays - https://tc39.github.io/ecma262/#sec-typedarray-constructors Map - https://tc39.github.io/ecma262/#sec-map-constructor Set - https://tc39.github.io/ecma262/#sec-set-constructor WeakMap - https://tc39.github.io/ecma262/#sec-weakmap-constructor WeakSet - https://tc39.github.io/ecma262/#sec-weakset-constructor ArrayBuffer - https://tc39.github.io/ecma262/#sec-arraybuffer-constructor DataView - https://tc39.github.io/ecma262/#sec-dataview-constructor Promise - https://tc39.github.io/ecma262/#sec-promise-constructor Proxy - https://tc39.github.io/ecma262/#sec-proxy-constructor This patch does the foillowing: 1. Ensures that these constructors can be called but will throw a TypeError when called. 2. Makes all these objects use throwConstructorCannotBeCalledAsFunctionTypeError() in their implementation to be consistent. 3. Change the error message to "calling XXX constructor without new is invalid". This is clearer because the error is likely due to the user forgetting to use the new operator on these constructors. * runtime/Error.h: * runtime/Error.cpp: (JSC::throwConstructorCannotBeCalledAsFunctionTypeError): - Added a convenience function to throw the TypeError. * runtime/JSArrayBufferConstructor.cpp: (JSC::constructArrayBuffer): (JSC::callArrayBuffer): (JSC::JSArrayBufferConstructor::getCallData): * runtime/JSGenericTypedArrayViewConstructorInlines.h: (JSC::callGenericTypedArrayView): (JSC::JSGenericTypedArrayViewConstructor<ViewClass>::getCallData): * runtime/JSPromiseConstructor.cpp: (JSC::callPromise): * runtime/MapConstructor.cpp: (JSC::callMap): * runtime/ProxyConstructor.cpp: (JSC::callProxy): (JSC::ProxyConstructor::getCallData): * runtime/SetConstructor.cpp: (JSC::callSet): * runtime/WeakMapConstructor.cpp: (JSC::callWeakMap): * runtime/WeakSetConstructor.cpp: (JSC::callWeakSet): * tests/es6.yaml: - The typed_arrays_%TypedArray%[Symbol.species].js test now passes. * tests/stress/call-non-calleable-constructors-as-function.js: Added. (test): * tests/stress/map-constructor.js: (testCallTypeError): * tests/stress/promise-cannot-be-called.js: (shouldThrow): * tests/stress/proxy-basic.js: * tests/stress/set-constructor.js: * tests/stress/throw-from-ftl-call-ic-slow-path-cells.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path-undefined.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path.js: (i.catch): * tests/stress/weak-map-constructor.js: (testCallTypeError): * tests/stress/weak-set-constructor.js: - Updated error message string. LayoutTests: * js/Promise-types-expected.txt: * js/basic-map-expected.txt: * js/basic-set-expected.txt: * js/dom/basic-weakmap-expected.txt: * js/dom/basic-weakset-expected.txt: * js/script-tests/Promise-types.js: * js/typedarray-constructors-expected.txt: - Updated error message string. Canonical link: https://commits.webkit.org/172692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-23 19:41:56 +00:00
PASS Uint8Array() threw exception TypeError: calling Uint8Array constructor without new is invalid.
PASS new Uint8Array() did not throw exception.
PASS Uint8Array.length is 3
PASS Uint8ClampedArray() threw exception TypeError: calling Uint8ClampedArray constructor without new is invalid.
PASS new Uint8ClampedArray() did not throw exception.
PASS Uint8ClampedArray.length is 3
Debug assertion failure while loading http://kangax.github.io/compat-table/es6/. https://bugs.webkit.org/show_bug.cgi?id=154542 Reviewed by Saam Barati. Source/JavaScriptCore: According to the spec, the constructors of the following types "are not intended to be called as a function and will throw an exception". These types are: TypedArrays - https://tc39.github.io/ecma262/#sec-typedarray-constructors Map - https://tc39.github.io/ecma262/#sec-map-constructor Set - https://tc39.github.io/ecma262/#sec-set-constructor WeakMap - https://tc39.github.io/ecma262/#sec-weakmap-constructor WeakSet - https://tc39.github.io/ecma262/#sec-weakset-constructor ArrayBuffer - https://tc39.github.io/ecma262/#sec-arraybuffer-constructor DataView - https://tc39.github.io/ecma262/#sec-dataview-constructor Promise - https://tc39.github.io/ecma262/#sec-promise-constructor Proxy - https://tc39.github.io/ecma262/#sec-proxy-constructor This patch does the foillowing: 1. Ensures that these constructors can be called but will throw a TypeError when called. 2. Makes all these objects use throwConstructorCannotBeCalledAsFunctionTypeError() in their implementation to be consistent. 3. Change the error message to "calling XXX constructor without new is invalid". This is clearer because the error is likely due to the user forgetting to use the new operator on these constructors. * runtime/Error.h: * runtime/Error.cpp: (JSC::throwConstructorCannotBeCalledAsFunctionTypeError): - Added a convenience function to throw the TypeError. * runtime/JSArrayBufferConstructor.cpp: (JSC::constructArrayBuffer): (JSC::callArrayBuffer): (JSC::JSArrayBufferConstructor::getCallData): * runtime/JSGenericTypedArrayViewConstructorInlines.h: (JSC::callGenericTypedArrayView): (JSC::JSGenericTypedArrayViewConstructor<ViewClass>::getCallData): * runtime/JSPromiseConstructor.cpp: (JSC::callPromise): * runtime/MapConstructor.cpp: (JSC::callMap): * runtime/ProxyConstructor.cpp: (JSC::callProxy): (JSC::ProxyConstructor::getCallData): * runtime/SetConstructor.cpp: (JSC::callSet): * runtime/WeakMapConstructor.cpp: (JSC::callWeakMap): * runtime/WeakSetConstructor.cpp: (JSC::callWeakSet): * tests/es6.yaml: - The typed_arrays_%TypedArray%[Symbol.species].js test now passes. * tests/stress/call-non-calleable-constructors-as-function.js: Added. (test): * tests/stress/map-constructor.js: (testCallTypeError): * tests/stress/promise-cannot-be-called.js: (shouldThrow): * tests/stress/proxy-basic.js: * tests/stress/set-constructor.js: * tests/stress/throw-from-ftl-call-ic-slow-path-cells.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path-undefined.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path.js: (i.catch): * tests/stress/weak-map-constructor.js: (testCallTypeError): * tests/stress/weak-set-constructor.js: - Updated error message string. LayoutTests: * js/Promise-types-expected.txt: * js/basic-map-expected.txt: * js/basic-set-expected.txt: * js/dom/basic-weakmap-expected.txt: * js/dom/basic-weakset-expected.txt: * js/script-tests/Promise-types.js: * js/typedarray-constructors-expected.txt: - Updated error message string. Canonical link: https://commits.webkit.org/172692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-23 19:41:56 +00:00
PASS Uint16Array() threw exception TypeError: calling Uint16Array constructor without new is invalid.
PASS new Uint16Array() did not throw exception.
PASS Uint16Array.length is 3
Debug assertion failure while loading http://kangax.github.io/compat-table/es6/. https://bugs.webkit.org/show_bug.cgi?id=154542 Reviewed by Saam Barati. Source/JavaScriptCore: According to the spec, the constructors of the following types "are not intended to be called as a function and will throw an exception". These types are: TypedArrays - https://tc39.github.io/ecma262/#sec-typedarray-constructors Map - https://tc39.github.io/ecma262/#sec-map-constructor Set - https://tc39.github.io/ecma262/#sec-set-constructor WeakMap - https://tc39.github.io/ecma262/#sec-weakmap-constructor WeakSet - https://tc39.github.io/ecma262/#sec-weakset-constructor ArrayBuffer - https://tc39.github.io/ecma262/#sec-arraybuffer-constructor DataView - https://tc39.github.io/ecma262/#sec-dataview-constructor Promise - https://tc39.github.io/ecma262/#sec-promise-constructor Proxy - https://tc39.github.io/ecma262/#sec-proxy-constructor This patch does the foillowing: 1. Ensures that these constructors can be called but will throw a TypeError when called. 2. Makes all these objects use throwConstructorCannotBeCalledAsFunctionTypeError() in their implementation to be consistent. 3. Change the error message to "calling XXX constructor without new is invalid". This is clearer because the error is likely due to the user forgetting to use the new operator on these constructors. * runtime/Error.h: * runtime/Error.cpp: (JSC::throwConstructorCannotBeCalledAsFunctionTypeError): - Added a convenience function to throw the TypeError. * runtime/JSArrayBufferConstructor.cpp: (JSC::constructArrayBuffer): (JSC::callArrayBuffer): (JSC::JSArrayBufferConstructor::getCallData): * runtime/JSGenericTypedArrayViewConstructorInlines.h: (JSC::callGenericTypedArrayView): (JSC::JSGenericTypedArrayViewConstructor<ViewClass>::getCallData): * runtime/JSPromiseConstructor.cpp: (JSC::callPromise): * runtime/MapConstructor.cpp: (JSC::callMap): * runtime/ProxyConstructor.cpp: (JSC::callProxy): (JSC::ProxyConstructor::getCallData): * runtime/SetConstructor.cpp: (JSC::callSet): * runtime/WeakMapConstructor.cpp: (JSC::callWeakMap): * runtime/WeakSetConstructor.cpp: (JSC::callWeakSet): * tests/es6.yaml: - The typed_arrays_%TypedArray%[Symbol.species].js test now passes. * tests/stress/call-non-calleable-constructors-as-function.js: Added. (test): * tests/stress/map-constructor.js: (testCallTypeError): * tests/stress/promise-cannot-be-called.js: (shouldThrow): * tests/stress/proxy-basic.js: * tests/stress/set-constructor.js: * tests/stress/throw-from-ftl-call-ic-slow-path-cells.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path-undefined.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path.js: (i.catch): * tests/stress/weak-map-constructor.js: (testCallTypeError): * tests/stress/weak-set-constructor.js: - Updated error message string. LayoutTests: * js/Promise-types-expected.txt: * js/basic-map-expected.txt: * js/basic-set-expected.txt: * js/dom/basic-weakmap-expected.txt: * js/dom/basic-weakset-expected.txt: * js/script-tests/Promise-types.js: * js/typedarray-constructors-expected.txt: - Updated error message string. Canonical link: https://commits.webkit.org/172692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-23 19:41:56 +00:00
PASS Uint32Array() threw exception TypeError: calling Uint32Array constructor without new is invalid.
PASS new Uint32Array() did not throw exception.
PASS Uint32Array.length is 3
Debug assertion failure while loading http://kangax.github.io/compat-table/es6/. https://bugs.webkit.org/show_bug.cgi?id=154542 Reviewed by Saam Barati. Source/JavaScriptCore: According to the spec, the constructors of the following types "are not intended to be called as a function and will throw an exception". These types are: TypedArrays - https://tc39.github.io/ecma262/#sec-typedarray-constructors Map - https://tc39.github.io/ecma262/#sec-map-constructor Set - https://tc39.github.io/ecma262/#sec-set-constructor WeakMap - https://tc39.github.io/ecma262/#sec-weakmap-constructor WeakSet - https://tc39.github.io/ecma262/#sec-weakset-constructor ArrayBuffer - https://tc39.github.io/ecma262/#sec-arraybuffer-constructor DataView - https://tc39.github.io/ecma262/#sec-dataview-constructor Promise - https://tc39.github.io/ecma262/#sec-promise-constructor Proxy - https://tc39.github.io/ecma262/#sec-proxy-constructor This patch does the foillowing: 1. Ensures that these constructors can be called but will throw a TypeError when called. 2. Makes all these objects use throwConstructorCannotBeCalledAsFunctionTypeError() in their implementation to be consistent. 3. Change the error message to "calling XXX constructor without new is invalid". This is clearer because the error is likely due to the user forgetting to use the new operator on these constructors. * runtime/Error.h: * runtime/Error.cpp: (JSC::throwConstructorCannotBeCalledAsFunctionTypeError): - Added a convenience function to throw the TypeError. * runtime/JSArrayBufferConstructor.cpp: (JSC::constructArrayBuffer): (JSC::callArrayBuffer): (JSC::JSArrayBufferConstructor::getCallData): * runtime/JSGenericTypedArrayViewConstructorInlines.h: (JSC::callGenericTypedArrayView): (JSC::JSGenericTypedArrayViewConstructor<ViewClass>::getCallData): * runtime/JSPromiseConstructor.cpp: (JSC::callPromise): * runtime/MapConstructor.cpp: (JSC::callMap): * runtime/ProxyConstructor.cpp: (JSC::callProxy): (JSC::ProxyConstructor::getCallData): * runtime/SetConstructor.cpp: (JSC::callSet): * runtime/WeakMapConstructor.cpp: (JSC::callWeakMap): * runtime/WeakSetConstructor.cpp: (JSC::callWeakSet): * tests/es6.yaml: - The typed_arrays_%TypedArray%[Symbol.species].js test now passes. * tests/stress/call-non-calleable-constructors-as-function.js: Added. (test): * tests/stress/map-constructor.js: (testCallTypeError): * tests/stress/promise-cannot-be-called.js: (shouldThrow): * tests/stress/proxy-basic.js: * tests/stress/set-constructor.js: * tests/stress/throw-from-ftl-call-ic-slow-path-cells.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path-undefined.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path.js: (i.catch): * tests/stress/weak-map-constructor.js: (testCallTypeError): * tests/stress/weak-set-constructor.js: - Updated error message string. LayoutTests: * js/Promise-types-expected.txt: * js/basic-map-expected.txt: * js/basic-set-expected.txt: * js/dom/basic-weakmap-expected.txt: * js/dom/basic-weakset-expected.txt: * js/script-tests/Promise-types.js: * js/typedarray-constructors-expected.txt: - Updated error message string. Canonical link: https://commits.webkit.org/172692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-23 19:41:56 +00:00
PASS Float32Array() threw exception TypeError: calling Float32Array constructor without new is invalid.
PASS new Float32Array() did not throw exception.
PASS Float32Array.length is 3
Debug assertion failure while loading http://kangax.github.io/compat-table/es6/. https://bugs.webkit.org/show_bug.cgi?id=154542 Reviewed by Saam Barati. Source/JavaScriptCore: According to the spec, the constructors of the following types "are not intended to be called as a function and will throw an exception". These types are: TypedArrays - https://tc39.github.io/ecma262/#sec-typedarray-constructors Map - https://tc39.github.io/ecma262/#sec-map-constructor Set - https://tc39.github.io/ecma262/#sec-set-constructor WeakMap - https://tc39.github.io/ecma262/#sec-weakmap-constructor WeakSet - https://tc39.github.io/ecma262/#sec-weakset-constructor ArrayBuffer - https://tc39.github.io/ecma262/#sec-arraybuffer-constructor DataView - https://tc39.github.io/ecma262/#sec-dataview-constructor Promise - https://tc39.github.io/ecma262/#sec-promise-constructor Proxy - https://tc39.github.io/ecma262/#sec-proxy-constructor This patch does the foillowing: 1. Ensures that these constructors can be called but will throw a TypeError when called. 2. Makes all these objects use throwConstructorCannotBeCalledAsFunctionTypeError() in their implementation to be consistent. 3. Change the error message to "calling XXX constructor without new is invalid". This is clearer because the error is likely due to the user forgetting to use the new operator on these constructors. * runtime/Error.h: * runtime/Error.cpp: (JSC::throwConstructorCannotBeCalledAsFunctionTypeError): - Added a convenience function to throw the TypeError. * runtime/JSArrayBufferConstructor.cpp: (JSC::constructArrayBuffer): (JSC::callArrayBuffer): (JSC::JSArrayBufferConstructor::getCallData): * runtime/JSGenericTypedArrayViewConstructorInlines.h: (JSC::callGenericTypedArrayView): (JSC::JSGenericTypedArrayViewConstructor<ViewClass>::getCallData): * runtime/JSPromiseConstructor.cpp: (JSC::callPromise): * runtime/MapConstructor.cpp: (JSC::callMap): * runtime/ProxyConstructor.cpp: (JSC::callProxy): (JSC::ProxyConstructor::getCallData): * runtime/SetConstructor.cpp: (JSC::callSet): * runtime/WeakMapConstructor.cpp: (JSC::callWeakMap): * runtime/WeakSetConstructor.cpp: (JSC::callWeakSet): * tests/es6.yaml: - The typed_arrays_%TypedArray%[Symbol.species].js test now passes. * tests/stress/call-non-calleable-constructors-as-function.js: Added. (test): * tests/stress/map-constructor.js: (testCallTypeError): * tests/stress/promise-cannot-be-called.js: (shouldThrow): * tests/stress/proxy-basic.js: * tests/stress/set-constructor.js: * tests/stress/throw-from-ftl-call-ic-slow-path-cells.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path-undefined.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path.js: (i.catch): * tests/stress/weak-map-constructor.js: (testCallTypeError): * tests/stress/weak-set-constructor.js: - Updated error message string. LayoutTests: * js/Promise-types-expected.txt: * js/basic-map-expected.txt: * js/basic-set-expected.txt: * js/dom/basic-weakmap-expected.txt: * js/dom/basic-weakset-expected.txt: * js/script-tests/Promise-types.js: * js/typedarray-constructors-expected.txt: - Updated error message string. Canonical link: https://commits.webkit.org/172692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-23 19:41:56 +00:00
PASS Float64Array() threw exception TypeError: calling Float64Array constructor without new is invalid.
PASS new Float64Array() did not throw exception.
PASS Float64Array.length is 3
Debug assertion failure while loading http://kangax.github.io/compat-table/es6/. https://bugs.webkit.org/show_bug.cgi?id=154542 Reviewed by Saam Barati. Source/JavaScriptCore: According to the spec, the constructors of the following types "are not intended to be called as a function and will throw an exception". These types are: TypedArrays - https://tc39.github.io/ecma262/#sec-typedarray-constructors Map - https://tc39.github.io/ecma262/#sec-map-constructor Set - https://tc39.github.io/ecma262/#sec-set-constructor WeakMap - https://tc39.github.io/ecma262/#sec-weakmap-constructor WeakSet - https://tc39.github.io/ecma262/#sec-weakset-constructor ArrayBuffer - https://tc39.github.io/ecma262/#sec-arraybuffer-constructor DataView - https://tc39.github.io/ecma262/#sec-dataview-constructor Promise - https://tc39.github.io/ecma262/#sec-promise-constructor Proxy - https://tc39.github.io/ecma262/#sec-proxy-constructor This patch does the foillowing: 1. Ensures that these constructors can be called but will throw a TypeError when called. 2. Makes all these objects use throwConstructorCannotBeCalledAsFunctionTypeError() in their implementation to be consistent. 3. Change the error message to "calling XXX constructor without new is invalid". This is clearer because the error is likely due to the user forgetting to use the new operator on these constructors. * runtime/Error.h: * runtime/Error.cpp: (JSC::throwConstructorCannotBeCalledAsFunctionTypeError): - Added a convenience function to throw the TypeError. * runtime/JSArrayBufferConstructor.cpp: (JSC::constructArrayBuffer): (JSC::callArrayBuffer): (JSC::JSArrayBufferConstructor::getCallData): * runtime/JSGenericTypedArrayViewConstructorInlines.h: (JSC::callGenericTypedArrayView): (JSC::JSGenericTypedArrayViewConstructor<ViewClass>::getCallData): * runtime/JSPromiseConstructor.cpp: (JSC::callPromise): * runtime/MapConstructor.cpp: (JSC::callMap): * runtime/ProxyConstructor.cpp: (JSC::callProxy): (JSC::ProxyConstructor::getCallData): * runtime/SetConstructor.cpp: (JSC::callSet): * runtime/WeakMapConstructor.cpp: (JSC::callWeakMap): * runtime/WeakSetConstructor.cpp: (JSC::callWeakSet): * tests/es6.yaml: - The typed_arrays_%TypedArray%[Symbol.species].js test now passes. * tests/stress/call-non-calleable-constructors-as-function.js: Added. (test): * tests/stress/map-constructor.js: (testCallTypeError): * tests/stress/promise-cannot-be-called.js: (shouldThrow): * tests/stress/proxy-basic.js: * tests/stress/set-constructor.js: * tests/stress/throw-from-ftl-call-ic-slow-path-cells.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path-undefined.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path.js: (i.catch): * tests/stress/weak-map-constructor.js: (testCallTypeError): * tests/stress/weak-set-constructor.js: - Updated error message string. LayoutTests: * js/Promise-types-expected.txt: * js/basic-map-expected.txt: * js/basic-set-expected.txt: * js/dom/basic-weakmap-expected.txt: * js/dom/basic-weakset-expected.txt: * js/script-tests/Promise-types.js: * js/typedarray-constructors-expected.txt: - Updated error message string. Canonical link: https://commits.webkit.org/172692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-23 19:41:56 +00:00
PASS DataView(new ArrayBuffer()) threw exception TypeError: calling DataView constructor without new is invalid.
PASS new DataView(new ArrayBuffer()) did not throw exception.
[JSC] Add missing detached buffer errors for DataView https://bugs.webkit.org/show_bug.cgi?id=216062 Reviewed by Yusuke Suzuki. JSTests: * stress/detached-buffer-typeerror.js: Add new test. * stress/dataview-jit-neuter.js: * stress/native-constructors-length.js: Update existing tests. * test262/expectations.yaml: Mark 74 test cases as passing. Source/JavaScriptCore: DataView methods are often expected to throw a TypeError if the underlying ArrayBuffer is detached (or neutered, in older terminology) -- this patch adds a slew of missing cases from the following spec section: - https://tc39.es/ecma262/#sec-properties-of-the-dataview-prototype-object At the same time: - get rid of JSDataView::getOwnPropertySlot, which was turning dataViewProtoGetterByte{Length,Offset} into mostly unreachable code and erroneously causing byte{Length,Offset} to have property descriptors - perform some simple cleanup of neighboring error calls / messages - fix value of DataView.length (our only other DataView spec bug) * runtime/JSDataView.cpp: (JSC::JSDataView::create): (JSC::JSDataView::getOwnPropertySlot): Deleted. * runtime/JSDataView.h: * runtime/JSDataViewPrototype.cpp: (JSC::getData): (JSC::setData): (JSC::dataViewProtoGetterByteLength): (JSC::dataViewProtoGetterByteOffset): * runtime/JSGenericTypedArrayViewConstructorInlines.h: (JSC::JSGenericTypedArrayViewConstructor<ViewClass>::finishCreation): LayoutTests: * fast/canvas/webgl/arraybuffer-transfer-of-control.html: * js/dom/constructor-length.html: * js/script-tests/typedarray-constructors.js: * js/typedarray-constructors-expected.txt: * platform/glib/js/dom/constructor-length-expected.txt: * platform/ios/js/dom/constructor-length-expected.txt: * platform/mac/js/dom/constructor-length-expected.txt: * platform/win/js/dom/constructor-length-expected.txt: * platform/wincairo/js/dom/constructor-length-expected.txt: Update tests and expectations. Canonical link: https://commits.webkit.org/228931@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266529 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-03 17:04:09 +00:00
PASS DataView.length is 1
PASS successfullyParsed is true
TEST COMPLETE