From 2c5c3c4c27d27a419c1fdba3e9879c2d22037074 Mon Sep 17 00:00:00 2001 From: Stephen McGruer Date: Thu, 23 Jan 2020 10:51:07 -0500 Subject: [PATCH] Replace some "assert_throws(new FooError(), stuff)" calls with assert_throws_js. (#21354) This diff was generated by running: find . -type f -print0 | xargs -0 perl -pi -e 'BEGIN { $/ = undef; } s/assert_throws\(([ \n]*)new ([A-Za-z]*Error) *\(\) *(, *.)/assert_throws_js(\1\2\3/gs' and then: 1) Manually adjusting fullscreen/rendering/fullscreen-pseudo-class-support.html to test for the right sort of exceptions ("SyntaxError" DOMException, not a JS SyntaxError). 2) Manually adjusting performance-timeline/po-observe-type.any.js to test for the right sort of exceptions ("SyntaxError" DOMException, not a JS SyntaxError). 3) Manually adjusting performance-timeline/po-observe.any.js to test for the right sort of exceptions ("SyntaxError" DOMException, not a JS SyntaxError). 4) Manually adjusting user-timing/mark_exceptions.html to test for the right sort of exceptions ("SyntaxError" DOMException, not a JS SyntaxError). 5) Manually adjusting user-timing/measure_syntax_err.any.js to test for the right sort of exceptions ("SyntaxError" DOMException, not a JS SyntaxError). 6) Manually adjusting domxpath/lexical-structure.html to test for a "SyntaxError" DOMException, since that's what all browsers throw and there is no clear spec for this. 7) Manually adjusting workers/constructors/Worker/Worker-constructor.html to test for the right sort of exceptions ("SyntaxError" DOMException, not a JS SyntaxError). 8) Backing out the changes to resources/idlharness.js because some tests pass objects from a different window to it, and we end up with the wrong TypeError constructor in those cases. This does affect indentation poorly in cases when the first arg was on the same line as the assert_throws, there was a newline after the ',' after the first arg, and the following args were lined up with the first arg. Fixing that, especially when there are multiple lines after the first arg, is not trivial with a regexp. Co-authored-by: Boris Zbarsky Co-authored-by: Stephen McGruer --- .../2d.missingargs.html | 186 +++++++++--------- .../2d.drawImage.null.html | 2 +- .../2d.drawImage.wrongtype.html | 8 +- .../2d.gradient.linear.nonfinite.html | 46 ++--- .../2d.gradient.object.invalidoffset.html | 6 +- .../2d.gradient.radial.nonfinite.html | 150 +++++++------- .../2d.pattern.image.null.html | 2 +- .../2d.pattern.image.string.html | 2 +- .../2d.pattern.image.undefined.html | 2 +- .../2d.imageData.create1.this.html | 6 +- .../2d.imageData.create1.zero.html | 2 +- .../2d.imageData.create2.nonfinite.html | 28 +-- .../2d.imageData.create2.this.html | 6 +- .../2d.imageData.get.nonfinite.html | 92 ++++----- ...2d.imageData.object.ctor.array.bounds.html | 4 +- .../2d.imageData.put.nonfinite.html | 164 +++++++-------- .../2d.imageData.put.null.html | 2 +- .../2d.imageData.put.wrongtype.html | 6 +- 2dcontext/tools/gentestutils.py | 2 +- FileAPI/blob/Blob-constructor-endings.html | 2 +- FileAPI/blob/Blob-constructor.html | 8 +- FileAPI/file/File-constructor-endings.html | 2 +- FileAPI/file/File-constructor.html | 12 +- IndexedDB/idbcursor_advance_index2.htm | 2 +- IndexedDB/idbcursor_advance_index3.htm | 2 +- IndexedDB/idbcursor_advance_index6.htm | 2 +- IndexedDB/idbcursor_advance_objectstore2.htm | 2 +- IndexedDB/idbcursor_update_index6.htm | 2 +- IndexedDB/idbcursor_update_objectstore7.htm | 2 +- IndexedDB/idbfactory_cmp2.htm | 2 +- IndexedDB/idbfactory_open9.htm | 2 +- IndexedDB/idbkeyrange_incorrect.htm | 6 +- ...action-relaxed-durability.tentative.any.js | 2 +- .../DOMException-custom-bindings.any.js | 10 +- .../global-immutable-prototype.any.js | 2 +- .../iterator-prototype-object.html | 8 +- .../legacy-callback-interface-object.html | 8 +- .../legacy-platform-object.html | 24 +-- WebIDL/ecmascript-binding/put-forwards.html | 6 +- .../sequence-conversion.html | 2 +- beacon/beacon-error.sub.window.js | 4 +- beacon/beacon-readablestream.window.js | 2 +- bluetooth/idl/idl-Bluetooth.https.html | 8 +- bluetooth/idl/idl-BluetoothDevice.https.html | 16 +- clipboard-apis/clipboard-item.https.html | 8 +- common/stringifiers.js | 4 +- .../compression-stream.tentative.any.js | 2 +- ...ression-constructor-error.tentative.any.js | 6 +- .../script-src/script-src-1_4.html | 2 +- .../script-src/script-src-1_4_2.html | 4 +- .../script-src-strict_dynamic_eval.html | 2 +- ...cript-src-strict_dynamic_new_function.html | 2 +- .../animationevent-interface.js | 14 +- css/css-conditional/js/001.html | 2 +- css/css-properties-values-api/self-utils.html | 6 +- css/css-properties-values-api/typedom.html | 4 +- .../transitionevent-interface.html | 14 +- .../stylevalue-objects/parse-invalid.html | 10 +- .../stylevalue-objects/parseAll-invalid.html | 10 +- .../cssKeywordValue-invalid.html | 2 +- .../cssKeywordValue-value.html | 2 +- .../cssPerspective.tentative.html | 4 +- .../cssPositionValue-invalid.html | 8 +- .../cssRotate.tentative.html | 14 +- .../cssScale.tentative.html | 12 +- .../cssSkew.tentative.html | 6 +- .../cssSkewX.tentative.html | 4 +- .../cssSkewY.tentative.html | 4 +- ...formComponent-toMatrix-relative-units.html | 4 +- .../cssTransformValue.tentative.html | 6 +- .../cssTranslate.tentative.html | 12 +- ...ssUnparsedValue-indexed-getter-setter.html | 2 +- .../cssVariableReferenceValue-invalid.html | 4 +- .../cssVariableReferenceValue-variable.html | 4 +- .../add-two-types.tentative.html | 4 +- .../numeric-objects/arithmetic.tentative.html | 8 +- .../numeric-objects/cssUnitValue.html | 4 +- ...ricvalue-multiply-two-types.tentative.html | 2 +- .../computed/get-invalid.html | 2 +- .../computed/getAll.tentative.html | 2 +- .../computed/has.tentative.html | 2 +- .../declared/append.tentative.html | 2 +- .../declared/delete-invalid.html | 2 +- .../declared/get-invalid.html | 2 +- .../declared/getAll.tentative.html | 2 +- .../declared/has.tentative.html | 2 +- .../declared/set-shorthand.html | 2 +- .../declared/set.tentative.html | 10 +- .../inline/append.tentative.html | 2 +- .../inline/delete-invalid.html | 2 +- .../inline/get-invalid.html | 2 +- .../inline/getAll.tentative.html | 2 +- .../inline/has.tentative.html | 2 +- .../inline/set-shorthand.html | 2 +- .../inline/set.tentative.html | 10 +- .../properties/resources/testsuite.js | 2 +- .../elementFromPoint-parameters.html | 12 +- css/cssom/escape.html | 2 +- css/cssom/getComputedStyle-pseudo.html | 2 +- .../svgfeblendelement-mode-001.html | 6 +- css/geometry/DOMMatrix-001.html | 2 +- css/geometry/DOMMatrix-css-string.worker.js | 4 +- .../DOMMatrix2DInit-validate-fixup.html | 4 +- .../DOMMatrixInit-validate-fixup.html | 2 +- css/geometry/DOMPoint-002.html | 2 +- css/geometry/DOMQuad-001.html | 10 +- css/geometry/DOMQuad-002.html | 6 +- .../ElementInternals-validation.html | 2 +- .../HTMLCollection-as-prototype.html | 2 +- dom/collections/HTMLCollection-delete.html | 4 +- dom/collections/HTMLCollection-own-props.html | 6 +- ...Collection-supported-property-indices.html | 12 +- ...MLCollection-supported-property-names.html | 8 +- dom/events/CustomEvent.html | 2 +- dom/events/Event-constructors.html | 4 +- dom/events/Event-initEvent.html | 2 +- dom/events/Event-subclasses-constructors.html | 2 +- dom/events/EventTarget-dispatchEvent.html | 2 +- dom/nodes/CharacterData-appendData.html | 2 +- dom/nodes/CharacterData-substringData.html | 4 +- .../DOMImplementation-createDocument.html | 4 +- .../Document-Element-getElementsByTagName.js | 2 +- dom/nodes/Document-createTreeWalker.html | 2 +- dom/nodes/Node-appendChild.html | 6 +- dom/nodes/Node-contains-xml.xml | 4 +- dom/nodes/Node-insertBefore.html | 8 +- dom/nodes/Node-removeChild.html | 4 +- dom/nodes/Node-replaceChild.html | 6 +- dom/nodes/insert-adjacent.html | 2 +- dom/ranges/Range-comparePoint-2.html | 2 +- dom/ranges/Range-intersectsNode-binding.html | 24 +-- .../TreeWalker-acceptNode-filter.html | 8 +- dom/traversal/TreeWalker-basic.html | 10 +- .../DOMParser-parseFromString-html.html | 2 +- domparsing/createContextualFragment.html | 2 +- domxpath/evaluator-constructor.html | 2 +- domxpath/lexical-structure.html | 10 +- encoding/api-invalid-label.any.js | 2 +- encoding/api-replacement-encodings.any.js | 2 +- encoding/encodeInto.any.js | 4 +- encoding/streams/decode-attributes.any.js | 8 +- encoding/textdecoder-fatal-single-byte.any.js | 2 +- encoding/textdecoder-fatal-streaming.any.js | 6 +- encoding/textdecoder-fatal.any.js | 2 +- encoding/textdecoder-utf16-surrogates.any.js | 2 +- fetch/api/headers/headers-basic.html | 2 +- fetch/api/headers/headers-errors.html | 28 +-- fetch/api/headers/headers-record.html | 4 +- fetch/api/request/request-cache.js | 2 +- fetch/api/request/request-disturbed.html | 8 +- fetch/api/request/request-error.html | 4 +- fetch/api/request/request-init-002.html | 4 +- fetch/api/request/request-init-stream.any.js | 2 +- fetch/api/request/request-keepalive.html | 2 +- fetch/api/response/response-clone.html | 2 +- fetch/api/response/response-error.html | 6 +- .../api/response/response-from-stream.any.js | 6 +- .../response/response-static-redirect.html | 4 +- .../response/response-stream-disturbed-5.html | 8 +- fetch/http-cache/http-cache.js | 2 +- .../fullscreen-pseudo-class-support.html | 4 +- generic-sensor/generic-sensor-tests.js | 4 +- .../getCurrentPosition_TypeError.html | 12 +- geolocation-API/watchPosition_TypeError.html | 12 +- .../window-indexed-properties-strict.html | 18 +- .../window-indexed-properties.html | 12 +- .../dom-tree-accessors/Document.body.html | 2 +- html/editing/dnd/synthetic/001.html | 2 +- .../editing/dnd/target-origin/001-manual.html | 2 +- .../collections/historical.html | 4 +- .../collections/htmlallcollection.html | 4 +- .../collections/htmloptionscollection.html | 2 +- .../media-elements/historical.html | 2 +- .../HTMLMediaElement/addTextTrack.html | 8 +- .../interfaces/TextTrackCue/constructor.html | 2 +- .../interfaces/TextTrackCue/endTime.html | 6 +- .../interfaces/TextTrackCue/startTime.html | 6 +- .../interfaces/TextTrackCueList/getter.html | 4 +- .../interfaces/TextTrackList/getter.html | 2 +- .../track-element/track-addtrack-kind.html | 2 +- .../media-elements/volume_nonfinite.html | 2 +- .../the-audio-element/audio_constructor.html | 6 +- .../context.arguments.missing.html | 2 +- .../the-canvas-element/historical.html | 4 +- .../the-canvas-element/imagedata.html | 2 +- .../the-embed-element/historical.html | 2 +- .../the-object-element/historical.html | 2 +- .../textfieldselection-setRangeText.html | 2 +- .../form-indexed-element.html | 2 +- .../the-form-element/form-nameditem.html | 10 +- .../the-form-element/form-requestsubmit.html | 4 +- .../forms/the-input-element/files.html | 4 +- .../forms/the-meter-element/meter.html | 12 +- .../the-table-element/caption-methods.html | 4 +- .../tabular-data/the-table-element/tFoot.html | 2 +- .../tabular-data/the-table-element/tHead.html | 2 +- .../microtask-queuing/queue-microtask.any.js | 12 +- .../messageevent-constructor.https.html | 4 +- .../requires-failure.https.any.js | 2 +- .../promise-rejection-event-constructor.html | 2 +- js/builtins/Array.prototype.join-order.html | 4 +- ...totype.hasOwnProperty-prototype-chain.html | 2 +- js/builtins/WeakMap.prototype-properties.html | 6 +- media-source/URL-createObjectURL-null.html | 2 +- .../mediasource-endofstream-invaliderror.html | 6 +- .../mediasource-removesourcebuffer.html | 2 +- ...ediasource-sourcebuffer-trackdefaults.html | 2 +- media-source/mediasource-trackdefault.html | 2 +- .../ImageCapture-creation.https.html | 4 +- mediacapture-streams/historical.https.html | 2 +- mediasession/mediametadata.html | 14 +- mimesniff/mime-types/parsing.any.js | 4 +- notifications/constructor-invalid.html | 2 +- .../2d.missingargs.html | 162 +++++++-------- .../2d.missingargs.worker.js | 162 +++++++-------- .../2d.drawImage.null.html | 2 +- .../2d.drawImage.null.worker.js | 2 +- .../2d.drawImage.wrongtype.html | 6 +- .../2d.drawImage.wrongtype.worker.js | 6 +- .../2d.gradient.linear.nonfinite.html | 46 ++--- .../2d.gradient.linear.nonfinite.worker.js | 46 ++--- .../2d.gradient.object.invalidoffset.html | 6 +- ...2d.gradient.object.invalidoffset.worker.js | 6 +- .../2d.gradient.radial.nonfinite.html | 150 +++++++------- .../2d.gradient.radial.nonfinite.worker.js | 150 +++++++------- .../2d.pattern.image.null.html | 2 +- .../2d.pattern.image.null.worker.js | 2 +- .../2d.pattern.image.string.html | 2 +- .../2d.pattern.image.string.worker.js | 2 +- .../2d.pattern.image.undefined.html | 2 +- .../2d.pattern.image.undefined.worker.js | 2 +- .../2d.imageData.create1.zero.html | 2 +- .../2d.imageData.create1.zero.worker.js | 2 +- .../2d.imageData.create2.nonfinite.html | 28 +-- .../2d.imageData.create2.nonfinite.worker.js | 28 +-- .../2d.imageData.get.nonfinite.html | 92 ++++----- .../2d.imageData.get.nonfinite.worker.js | 92 ++++----- .../2d.imageData.put.nonfinite.html | 164 +++++++-------- .../2d.imageData.put.nonfinite.worker.js | 164 +++++++-------- .../2d.imageData.put.null.html | 2 +- .../2d.imageData.put.null.worker.js | 2 +- .../2d.imageData.put.wrongtype.html | 6 +- .../2d.imageData.put.wrongtype.worker.js | 6 +- .../context.arguments.missing.html | 2 +- .../context.arguments.missing.worker.js | 2 +- .../context.casesensitive.html | 2 +- .../context.casesensitive.worker.js | 2 +- .../context.emptystring.html | 2 +- .../context.emptystring.worker.js | 2 +- .../context.unrecognised.badname.html | 2 +- .../context.unrecognised.badname.worker.js | 2 +- .../context.unrecognised.badsuffix.html | 2 +- .../context.unrecognised.badsuffix.worker.js | 2 +- .../context.unrecognised.nullsuffix.html | 2 +- .../context.unrecognised.nullsuffix.worker.js | 2 +- .../context.unrecognised.unicode.html | 2 +- .../context.unrecognised.unicode.worker.js | 2 +- .../offscreencanvas.constructor.html | 12 +- .../offscreencanvas.constructor.worker.js | 12 +- .../offscreencanvas.getcontext.html | 2 +- .../offscreencanvas.getcontext.worker.js | 2 +- ...yment-request-ctor-pmi-handling.https.html | 8 +- .../constructor.https.html | 6 +- ...ibutes-and-toJSON-method-manual.https.html | 4 +- ...constructor_convert_method_data.https.html | 8 +- .../payment-request-constructor.https.html | 44 ++--- ...yment-request-ctor-pmi-handling.https.html | 8 +- performance-timeline/po-observe-type.any.js | 2 +- performance-timeline/po-observe.any.js | 6 +- .../PresentationRequest_error.https.html | 2 +- .../controlling-ua/defaultRequest.https.html | 2 +- .../fetch-api-request.tentative.any.js | 2 +- .../tests/unit/IdlArray/is_json_type.html | 4 +- .../IdlDictionary/get_inheritance_stack.html | 2 +- .../IdlInterface/get_inheritance_stack.html | 2 +- ...nherited_and_consequential_interfaces.html | 4 +- scroll-animations/constructor.html | 6 +- scroll-animations/setting-current-time.html | 2 +- selection/removeRange.html | 4 +- .../cache-storage/script-tests/cache-put.js | 2 +- ...SpeechSynthesisErrorEvent-constructor.html | 16 +- .../SpeechSynthesisEvent-constructor.html | 8 +- std-toast/actions.html | 6 +- std-toast/options.html | 4 +- streams/piping/pipe-through.any.js | 14 +- streams/piping/throwing-options.any.js | 4 +- .../readable-byte-streams/brand-checks.any.js | 8 +- .../construct-byob-request.any.js | 2 +- .../detached-buffers.any.js | 10 +- streams/readable-byte-streams/general.any.js | 44 ++--- .../readable-byte-streams/properties.any.js | 6 +- .../readable-streams/async-iterator.any.js | 2 +- .../readable-streams/bad-strategies.any.js | 4 +- .../bad-underlying-sources.any.js | 18 +- streams/readable-streams/brand-checks.any.js | 6 +- .../readable-streams/default-reader.any.js | 20 +- .../garbage-collection.any.js | 4 +- streams/readable-streams/general.any.js | 20 +- .../reentrant-strategies.any.js | 2 +- streams/resources/rs-test-templates.js | 20 +- streams/resources/test-utils.js | 6 +- streams/transform-streams/errors.any.js | 8 +- streams/transform-streams/general.any.js | 8 +- streams/transform-streams/strategies.any.js | 10 +- streams/transform-streams/terminate.any.js | 2 +- .../writable-streams/bad-strategies.any.js | 6 +- .../bad-underlying-sinks.any.js | 6 +- streams/writable-streams/brand-checks.any.js | 2 +- streams/writable-streams/constructor.any.js | 8 +- streams/writable-streams/general.any.js | 2 +- streams/writable-streams/write.any.js | 2 +- svg/types/scripted/SVGAnimatedNumber.html | 8 +- svg/types/scripted/SVGLength.html | 28 +-- svg/types/scripted/SVGLengthList-basics.html | 56 +++--- .../touch-touchevent-constructor.html | 18 +- ...FromString-regression.tentative.https.html | 2 +- ...ustedTypePolicy-CSP-no-name.tentative.html | 2 +- .../TrustedTypePolicy-CSP.tentative.html | 2 +- ...TrustedTypePolicy-createXXX.tentative.html | 12 +- ...createPolicy-createXYZTests.tentative.html | 30 +-- ...olicy-cspTests-noNamesGiven.tentative.html | 2 +- ...ctory-createPolicy-cspTests.tentative.html | 2 +- ...tory-createPolicy-nameTests.tentative.html | 2 +- ...dTypePolicyFactory-metadata.tentative.html | 4 +- .../Window-TrustedTypes.tentative.html | 2 +- ...ock-Node-multiple-arguments.tentative.html | 4 +- ...o-DOMParser-parseFromString.tentative.html | 4 +- ...mers-setTimeout-setInterval.tentative.html | 8 +- ...ssignment-to-Document-write.tentative.html | 8 +- ...-Element-insertAdjacentHTML.tentative.html | 16 +- ...gnment-to-Element-outerHTML.tentative.html | 4 +- ...ent-to-Element-setAttribute.tentative.html | 2 +- ...t-to-Element-setAttributeNS.tentative.html | 2 +- ...ge-createContextualFragment.tentative.html | 4 +- ...sertion-into-script-element.tentative.html | 4 +- trusted-types/csp-block-eval.tentative.html | 4 +- ...al-csp-tt-no-default-policy.tentative.html | 2 +- .../eval-with-permissive-csp.tentative.html | 2 +- .../WorkerGlobalScope-importScripts.https.js | 8 +- trusted-types/support/helper.sub.js | 6 +- ...ed-types-createHTMLDocument.tentative.html | 4 +- ...-types-duplicate-names-list.tentative.html | 4 +- ...usted-types-duplicate-names.tentative.html | 2 +- ...-types-eval-reporting.tentative.https.html | 2 +- trusted-types/tt-block-eval.tentative.html | 2 +- uievents/legacy/Event-subclasses-init.html | 2 +- url/failure.html | 2 +- url/historical.any.js | 2 +- url/url-constructor.html | 2 +- user-timing/invoke_without_parameter.html | 4 +- user-timing/mark-errors.any.js | 8 +- user-timing/mark_exceptions.html | 4 +- user-timing/measure-with-dict.any.js | 8 +- user-timing/measure_syntax_err.any.js | 8 +- .../performance-measure-invalid.worker.js | 2 +- vibration/invalid-values.html | 2 +- wasm/jsapi/constructor/validate.any.js | 4 +- wasm/jsapi/global/constructor.any.js | 12 +- wasm/jsapi/global/value-get-set.any.js | 18 +- wasm/jsapi/global/valueOf.any.js | 2 +- wasm/jsapi/instance/constructor.any.js | 6 +- wasm/jsapi/instance/exports.any.js | 4 +- wasm/jsapi/interface.any.js | 4 +- wasm/jsapi/memory/buffer.any.js | 4 +- wasm/jsapi/memory/constructor.any.js | 16 +- wasm/jsapi/memory/grow.any.js | 8 +- wasm/jsapi/module/constructor.any.js | 6 +- wasm/jsapi/module/customSections.any.js | 6 +- wasm/jsapi/module/exports.any.js | 4 +- wasm/jsapi/module/imports.any.js | 4 +- wasm/jsapi/table/assertions.js | 6 +- wasm/jsapi/table/constructor.any.js | 18 +- wasm/jsapi/table/get-set.any.js | 26 +-- .../table/grow-reftypes.tentative.any.js | 4 +- wasm/jsapi/table/grow.any.js | 8 +- wasm/jsapi/table/length.any.js | 4 +- .../arraybuffer/transfer.window.js | 2 +- web-share/canShare-files.tentative.https.html | 2 +- .../test-constantsourcenode.html | 4 +- webgl/compressedTexImage2D.html | 2 +- webgl/compressedTexSubImage2D.html | 2 +- webgl/texImage2D.html | 4 +- webgl/texSubImage2D.html | 4 +- ...annel_postMessage_ports_readonly_array.htm | 2 +- webmessaging/MessageEvent.html | 2 +- webmessaging/broadcastchannel/interface.html | 4 +- webmessaging/with-ports/025.html | 2 +- webmessaging/with-ports/026.html | 2 +- webmessaging/with-ports/027.html | 2 +- webmessaging/without-ports/009.html | 2 +- webmessaging/without-ports/025-1.js | 2 +- webmessaging/without-ports/025.html | 2 +- .../RTCRtpReceiver-playoutDelayHint.html | 4 +- webrtc/RTCConfiguration-bundlePolicy.html | 4 +- ...RTCConfiguration-iceCandidatePoolSize.html | 8 +- .../RTCConfiguration-iceTransportPolicy.html | 6 +- webrtc/RTCConfiguration-rtcpMuxPolicy.html | 4 +- webrtc/RTCDataChannelEvent-constructor.html | 12 +- webrtc/RTCError.html | 12 +- webrtc/RTCIceCandidate-constructor.html | 14 +- webrtc/RTCIceTransport-extension.https.html | 8 +- ...TCPeerConnection-addTransceiver.https.html | 8 +- ...TCPeerConnection-setRemoteDescription.html | 2 +- ...RTCPeerConnectionIceEvent-constructor.html | 4 +- webrtc/RTCTrackEvent-constructor.html | 6 +- websockets/constructor/001.html | 2 +- .../interfaces/WebSocket/constants/005.html | 2 +- .../interfaces/WebSocket/constants/006.html | 2 +- websockets/interfaces/WebSocket/send/001.html | 2 +- websockets/stream-tentative/close.any.js | 2 +- webstorage/missing_arguments.html | 2 +- ...xrDevice_requestSession_no_mode.https.html | 2 +- webxr/xrRigidTransform_constructor.https.html | 2 +- workers/SharedWorker-constructor.html | 6 +- workers/Worker-multi-port.html | 4 +- .../SharedWorker/no-arguments-ctor.html | 2 +- .../Worker/Worker-constructor.html | 6 +- workers/postMessage_ports_readonly_array.htm | 2 +- xhr/FormData-append.html | 4 +- xhr/formdata-blob.htm | 2 +- xhr/formdata-set.htm | 4 +- xhr/formdata.htm | 4 +- xhr/progressevent-interface.html | 4 +- xhr/send-data-readablestream.any.js | 2 +- xhr/setrequestheader-bogus-name.htm | 2 +- xhr/setrequestheader-bogus-value.htm | 4 +- 426 files changed, 2060 insertions(+), 2060 deletions(-) diff --git a/2dcontext/conformance-requirements/2d.missingargs.html b/2dcontext/conformance-requirements/2d.missingargs.html index 1056eb078f43b1..5acee165ba915f 100644 --- a/2dcontext/conformance-requirements/2d.missingargs.html +++ b/2dcontext/conformance-requirements/2d.missingargs.html @@ -19,121 +19,121 @@

2d.missingargs

var t = async_test("Missing arguments cause TypeError"); _addTest(function(canvas, ctx) { -assert_throws(new TypeError(), function() { ctx.scale(); }); -assert_throws(new TypeError(), function() { ctx.scale(1); }); -assert_throws(new TypeError(), function() { ctx.rotate(); }); -assert_throws(new TypeError(), function() { ctx.translate(); }); -assert_throws(new TypeError(), function() { ctx.translate(0); }); +assert_throws_js(TypeError, function() { ctx.scale(); }); +assert_throws_js(TypeError, function() { ctx.scale(1); }); +assert_throws_js(TypeError, function() { ctx.rotate(); }); +assert_throws_js(TypeError, function() { ctx.translate(); }); +assert_throws_js(TypeError, function() { ctx.translate(0); }); if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) - assert_throws(new TypeError(), function() { ctx.transform(); }); - assert_throws(new TypeError(), function() { ctx.transform(1); }); - assert_throws(new TypeError(), function() { ctx.transform(1, 0); }); - assert_throws(new TypeError(), function() { ctx.transform(1, 0, 0); }); - assert_throws(new TypeError(), function() { ctx.transform(1, 0, 0, 1); }); - assert_throws(new TypeError(), function() { ctx.transform(1, 0, 0, 1, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(); }); + assert_throws_js(TypeError, function() { ctx.transform(1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1, 0); }); } if (ctx.setTransform) { - assert_throws(new TypeError(), function() { ctx.setTransform(1); }); - assert_throws(new TypeError(), function() { ctx.setTransform(1, 0); }); - assert_throws(new TypeError(), function() { ctx.setTransform(1, 0, 0); }); - assert_throws(new TypeError(), function() { ctx.setTransform(1, 0, 0, 1); }); - assert_throws(new TypeError(), function() { ctx.setTransform(1, 0, 0, 1, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1, 0); }); } -assert_throws(new TypeError(), function() { ctx.createLinearGradient(); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.createPattern(canvas); }); -assert_throws(new TypeError(), function() { ctx.clearRect(); }); -assert_throws(new TypeError(), function() { ctx.clearRect(0); }); -assert_throws(new TypeError(), function() { ctx.clearRect(0, 0); }); -assert_throws(new TypeError(), function() { ctx.clearRect(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.fillRect(); }); -assert_throws(new TypeError(), function() { ctx.fillRect(0); }); -assert_throws(new TypeError(), function() { ctx.fillRect(0, 0); }); -assert_throws(new TypeError(), function() { ctx.fillRect(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.strokeRect(); }); -assert_throws(new TypeError(), function() { ctx.strokeRect(0); }); -assert_throws(new TypeError(), function() { ctx.strokeRect(0, 0); }); -assert_throws(new TypeError(), function() { ctx.strokeRect(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.moveTo(); }); -assert_throws(new TypeError(), function() { ctx.moveTo(0); }); -assert_throws(new TypeError(), function() { ctx.lineTo(); }); -assert_throws(new TypeError(), function() { ctx.lineTo(0); }); -assert_throws(new TypeError(), function() { ctx.quadraticCurveTo(); }); -assert_throws(new TypeError(), function() { ctx.quadraticCurveTo(0); }); -assert_throws(new TypeError(), function() { ctx.quadraticCurveTo(0, 0); }); -assert_throws(new TypeError(), function() { ctx.quadraticCurveTo(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.bezierCurveTo(); }); -assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0); }); -assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0, 0); }); -assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0, 0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.arcTo(); }); -assert_throws(new TypeError(), function() { ctx.arcTo(0); }); -assert_throws(new TypeError(), function() { ctx.arcTo(0, 0); }); -assert_throws(new TypeError(), function() { ctx.arcTo(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.arcTo(0, 0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.rect(); }); -assert_throws(new TypeError(), function() { ctx.rect(0); }); -assert_throws(new TypeError(), function() { ctx.rect(0, 0); }); -assert_throws(new TypeError(), function() { ctx.rect(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.arc(); }); -assert_throws(new TypeError(), function() { ctx.arc(0); }); -assert_throws(new TypeError(), function() { ctx.arc(0, 0); }); -assert_throws(new TypeError(), function() { ctx.arc(0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.arc(0, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.createPattern(canvas); }); +assert_throws_js(TypeError, function() { ctx.clearRect(); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.moveTo(); }); +assert_throws_js(TypeError, function() { ctx.moveTo(0); }); +assert_throws_js(TypeError, function() { ctx.lineTo(); }); +assert_throws_js(TypeError, function() { ctx.lineTo(0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.rect(); }); +assert_throws_js(TypeError, function() { ctx.rect(0); }); +assert_throws_js(TypeError, function() { ctx.rect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.rect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arc(); }); +assert_throws_js(TypeError, function() { ctx.arc(0); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1, 0); }); // (6th argument to arc is optional) if (ctx.isPointInPath) { - assert_throws(new TypeError(), function() { ctx.isPointInPath(); }); - assert_throws(new TypeError(), function() { ctx.isPointInPath(0); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(); }); + assert_throws_js(TypeError, function() { ctx.isPointInPath(0); }); } if (ctx.drawFocusRing) { - assert_throws(new TypeError(), function() { ctx.drawFocusRing(); }); - assert_throws(new TypeError(), function() { ctx.drawFocusRing(canvas); }); - assert_throws(new TypeError(), function() { ctx.drawFocusRing(canvas, 0); }); + assert_throws_js(TypeError, function() { ctx.drawFocusRing(); }); + assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas); }); + assert_throws_js(TypeError, function() { ctx.drawFocusRing(canvas, 0); }); } if (ctx.fillText) { - assert_throws(new TypeError(), function() { ctx.fillText(); }); - assert_throws(new TypeError(), function() { ctx.fillText('test'); }); - assert_throws(new TypeError(), function() { ctx.fillText('test', 0); }); - assert_throws(new TypeError(), function() { ctx.strokeText(); }); - assert_throws(new TypeError(), function() { ctx.strokeText('test'); }); - assert_throws(new TypeError(), function() { ctx.strokeText('test', 0); }); - assert_throws(new TypeError(), function() { ctx.measureText(); }); + assert_throws_js(TypeError, function() { ctx.fillText(); }); + assert_throws_js(TypeError, function() { ctx.fillText('test'); }); + assert_throws_js(TypeError, function() { ctx.fillText('test', 0); }); + assert_throws_js(TypeError, function() { ctx.strokeText(); }); + assert_throws_js(TypeError, function() { ctx.strokeText('test'); }); + assert_throws_js(TypeError, function() { ctx.strokeText('test', 0); }); + assert_throws_js(TypeError, function() { ctx.measureText(); }); } -assert_throws(new TypeError(), function() { ctx.drawImage(); }); -assert_throws(new TypeError(), function() { ctx.drawImage(canvas); }); -assert_throws(new TypeError(), function() { ctx.drawImage(canvas, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage(); }); +assert_throws_js(TypeError, function() { ctx.drawImage(canvas); }); +assert_throws_js(TypeError, function() { ctx.drawImage(canvas, 0); }); // TODO: n >= 3 args on drawImage could be either a valid overload, // or too few for another overload, or too many for another // overload - what should happen? if (ctx.createImageData) { - assert_throws(new TypeError(), function() { ctx.createImageData(); }); - assert_throws(new TypeError(), function() { ctx.createImageData(1); }); + assert_throws_js(TypeError, function() { ctx.createImageData(); }); + assert_throws_js(TypeError, function() { ctx.createImageData(1); }); } if (ctx.getImageData) { - assert_throws(new TypeError(), function() { ctx.getImageData(); }); - assert_throws(new TypeError(), function() { ctx.getImageData(0); }); - assert_throws(new TypeError(), function() { ctx.getImageData(0, 0); }); - assert_throws(new TypeError(), function() { ctx.getImageData(0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.getImageData(); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0, 1); }); } if (ctx.putImageData) { var imgdata = ctx.getImageData(0, 0, 1, 1); - assert_throws(new TypeError(), function() { ctx.putImageData(); }); - assert_throws(new TypeError(), function() { ctx.putImageData(imgdata); }); - assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 0); }); + assert_throws_js(TypeError, function() { ctx.putImageData(); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0); }); } var g = ctx.createLinearGradient(0, 0, 0, 0); -assert_throws(new TypeError(), function() { g.addColorStop(); }); -assert_throws(new TypeError(), function() { g.addColorStop(0); }); +assert_throws_js(TypeError, function() { g.addColorStop(); }); +assert_throws_js(TypeError, function() { g.addColorStop(0); }); }); diff --git a/2dcontext/drawing-images-to-the-canvas/2d.drawImage.null.html b/2dcontext/drawing-images-to-the-canvas/2d.drawImage.null.html index 9a74700e159cd7..e68f16ff8b02de 100644 --- a/2dcontext/drawing-images-to-the-canvas/2d.drawImage.null.html +++ b/2dcontext/drawing-images-to-the-canvas/2d.drawImage.null.html @@ -19,7 +19,7 @@

2d.drawImage.null

var t = async_test(""); _addTest(function(canvas, ctx) { -assert_throws(new TypeError(), function() { ctx.drawImage(null, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage(null, 0, 0); }); }); diff --git a/2dcontext/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html b/2dcontext/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html index 5caea5974eac23..5370c4d859cc8f 100644 --- a/2dcontext/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html +++ b/2dcontext/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html @@ -19,10 +19,10 @@

2d.drawImage.wrongtype

var t = async_test("Incorrect image types in drawImage do not match any defined overloads, so WebIDL throws a TypeError"); _addTest(function(canvas, ctx) { -assert_throws(new TypeError(), function() { ctx.drawImage(undefined, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.drawImage(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.drawImage("", 0, 0); }); -assert_throws(new TypeError(), function() { ctx.drawImage(document.createElement('p'), 0, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage(undefined, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage("", 0, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage(document.createElement('p'), 0, 0); }); }); diff --git a/2dcontext/fill-and-stroke-styles/2d.gradient.linear.nonfinite.html b/2dcontext/fill-and-stroke-styles/2d.gradient.linear.nonfinite.html index 546859be21f0bc..34586890171126 100644 --- a/2dcontext/fill-and-stroke-styles/2d.gradient.linear.nonfinite.html +++ b/2dcontext/fill-and-stroke-styles/2d.gradient.linear.nonfinite.html @@ -19,29 +19,29 @@

2d.gradient.linear.nonfinite

var t = async_test("createLinearGradient() throws TypeError if arguments are not finite"); _addTest(function(canvas, ctx) { -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(-Infinity, 0, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(NaN, 0, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, -Infinity, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, NaN, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, Infinity, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, -Infinity, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, NaN, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1, -Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1, NaN); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, 1, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, Infinity, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, 1, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, Infinity, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, 1, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(-Infinity, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(NaN, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, -Infinity, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, NaN, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, -Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, NaN, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1, NaN); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, Infinity, Infinity); }); }); diff --git a/2dcontext/fill-and-stroke-styles/2d.gradient.object.invalidoffset.html b/2dcontext/fill-and-stroke-styles/2d.gradient.object.invalidoffset.html index a165c55c3abb32..cae264b1228ffa 100644 --- a/2dcontext/fill-and-stroke-styles/2d.gradient.object.invalidoffset.html +++ b/2dcontext/fill-and-stroke-styles/2d.gradient.object.invalidoffset.html @@ -22,9 +22,9 @@

2d.gradient.object.invalidoffset

var g = ctx.createLinearGradient(0, 0, 100, 0); assert_throws("INDEX_SIZE_ERR", function() { g.addColorStop(-1, '#000'); }); assert_throws("INDEX_SIZE_ERR", function() { g.addColorStop(2, '#000'); }); -assert_throws(new TypeError(), function() { g.addColorStop(Infinity, '#000'); }); -assert_throws(new TypeError(), function() { g.addColorStop(-Infinity, '#000'); }); -assert_throws(new TypeError(), function() { g.addColorStop(NaN, '#000'); }); +assert_throws_js(TypeError, function() { g.addColorStop(Infinity, '#000'); }); +assert_throws_js(TypeError, function() { g.addColorStop(-Infinity, '#000'); }); +assert_throws_js(TypeError, function() { g.addColorStop(NaN, '#000'); }); }); diff --git a/2dcontext/fill-and-stroke-styles/2d.gradient.radial.nonfinite.html b/2dcontext/fill-and-stroke-styles/2d.gradient.radial.nonfinite.html index 08f60db93a2af0..9c17cb40813afe 100644 --- a/2dcontext/fill-and-stroke-styles/2d.gradient.radial.nonfinite.html +++ b/2dcontext/fill-and-stroke-styles/2d.gradient.radial.nonfinite.html @@ -19,81 +19,81 @@

2d.gradient.radial.nonfinite

var t = async_test("createRadialGradient() throws TypeError if arguments are not finite"); _addTest(function(canvas, ctx) { -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(-Infinity, 0, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(NaN, 0, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, -Infinity, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, NaN, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, -Infinity, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, NaN, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, -Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, NaN, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, -Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, NaN, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, 0, -Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, 0, NaN); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(-Infinity, 0, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(NaN, 0, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, -Infinity, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, NaN, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, -Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, NaN, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, -Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, NaN, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, -Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, NaN, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0, NaN); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, Infinity); }); }); diff --git a/2dcontext/fill-and-stroke-styles/2d.pattern.image.null.html b/2dcontext/fill-and-stroke-styles/2d.pattern.image.null.html index 0df01543779b1e..992e889b680c47 100644 --- a/2dcontext/fill-and-stroke-styles/2d.pattern.image.null.html +++ b/2dcontext/fill-and-stroke-styles/2d.pattern.image.null.html @@ -19,7 +19,7 @@

2d.pattern.image.null

var t = async_test(""); _addTest(function(canvas, ctx) { -assert_throws(new TypeError(), function() { ctx.createPattern(null, 'repeat'); }); +assert_throws_js(TypeError, function() { ctx.createPattern(null, 'repeat'); }); }); diff --git a/2dcontext/fill-and-stroke-styles/2d.pattern.image.string.html b/2dcontext/fill-and-stroke-styles/2d.pattern.image.string.html index 896df5038982aa..09dd31db5c550f 100644 --- a/2dcontext/fill-and-stroke-styles/2d.pattern.image.string.html +++ b/2dcontext/fill-and-stroke-styles/2d.pattern.image.string.html @@ -19,7 +19,7 @@

2d.pattern.image.string

var t = async_test(""); _addTest(function(canvas, ctx) { -assert_throws(new TypeError(), function() { ctx.createPattern('../images/red.png', 'repeat'); }); +assert_throws_js(TypeError, function() { ctx.createPattern('../images/red.png', 'repeat'); }); }); diff --git a/2dcontext/fill-and-stroke-styles/2d.pattern.image.undefined.html b/2dcontext/fill-and-stroke-styles/2d.pattern.image.undefined.html index 04a13779ad56f8..f0ca10ed7f67f1 100644 --- a/2dcontext/fill-and-stroke-styles/2d.pattern.image.undefined.html +++ b/2dcontext/fill-and-stroke-styles/2d.pattern.image.undefined.html @@ -19,7 +19,7 @@

2d.pattern.image.undefined

var t = async_test(""); _addTest(function(canvas, ctx) { -assert_throws(new TypeError(), function() { ctx.createPattern(undefined, 'repeat'); }); +assert_throws_js(TypeError, function() { ctx.createPattern(undefined, 'repeat'); }); }); diff --git a/2dcontext/pixel-manipulation/2d.imageData.create1.this.html b/2dcontext/pixel-manipulation/2d.imageData.create1.this.html index b3a3334f7ca929..9e6cc56c0b8c91 100644 --- a/2dcontext/pixel-manipulation/2d.imageData.create1.this.html +++ b/2dcontext/pixel-manipulation/2d.imageData.create1.this.html @@ -20,9 +20,9 @@

2d.imageData.create1.this

_addTest(function(canvas, ctx) { var imgdata = ctx.createImageData(1, 1); -assert_throws(new TypeError(), function() { CanvasRenderingContext2D.prototype.createImageData.call(null, imgdata); }); -assert_throws(new TypeError(), function() { CanvasRenderingContext2D.prototype.createImageData.call(undefined, imgdata); }); -assert_throws(new TypeError(), function() { CanvasRenderingContext2D.prototype.createImageData.call({}, imgdata); }); +assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call(null, imgdata); }); +assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call(undefined, imgdata); }); +assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call({}, imgdata); }); }); diff --git a/2dcontext/pixel-manipulation/2d.imageData.create1.zero.html b/2dcontext/pixel-manipulation/2d.imageData.create1.zero.html index 1f7ad7a1ce1b4a..581ca179a03be8 100644 --- a/2dcontext/pixel-manipulation/2d.imageData.create1.zero.html +++ b/2dcontext/pixel-manipulation/2d.imageData.create1.zero.html @@ -19,7 +19,7 @@

2d.imageData.create1.zero

var t = async_test("createImageData(null) throws TypeError"); _addTest(function(canvas, ctx) { -assert_throws(new TypeError(), function() { ctx.createImageData(null); }); +assert_throws_js(TypeError, function() { ctx.createImageData(null); }); }); diff --git a/2dcontext/pixel-manipulation/2d.imageData.create2.nonfinite.html b/2dcontext/pixel-manipulation/2d.imageData.create2.nonfinite.html index 2722b30f5e2311..b9f008a6597651 100644 --- a/2dcontext/pixel-manipulation/2d.imageData.create2.nonfinite.html +++ b/2dcontext/pixel-manipulation/2d.imageData.create2.nonfinite.html @@ -19,23 +19,23 @@

2d.imageData.create2.nonfinite

var t = async_test("createImageData() throws TypeError if arguments are not finite"); _addTest(function(canvas, ctx) { -assert_throws(new TypeError(), function() { ctx.createImageData(Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.createImageData(-Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.createImageData(NaN, 10); }); -assert_throws(new TypeError(), function() { ctx.createImageData(10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createImageData(10, -Infinity); }); -assert_throws(new TypeError(), function() { ctx.createImageData(10, NaN); }); -assert_throws(new TypeError(), function() { ctx.createImageData(Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(-Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, NaN); }); +assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, Infinity); }); var posinfobj = { valueOf: function() { return Infinity; } }, neginfobj = { valueOf: function() { return -Infinity; } }, nanobj = { valueOf: function() { return -Infinity; } }; -assert_throws(new TypeError(), function() { ctx.createImageData(posinfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.createImageData(neginfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.createImageData(nanobj, 10); }); -assert_throws(new TypeError(), function() { ctx.createImageData(10, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.createImageData(10, neginfobj); }); -assert_throws(new TypeError(), function() { ctx.createImageData(10, nanobj); }); -assert_throws(new TypeError(), function() { ctx.createImageData(posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(neginfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(nanobj, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, neginfobj); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, nanobj); }); +assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, posinfobj); }); }); diff --git a/2dcontext/pixel-manipulation/2d.imageData.create2.this.html b/2dcontext/pixel-manipulation/2d.imageData.create2.this.html index 670345eee51ef7..9d766256e3cdb7 100644 --- a/2dcontext/pixel-manipulation/2d.imageData.create2.this.html +++ b/2dcontext/pixel-manipulation/2d.imageData.create2.this.html @@ -19,9 +19,9 @@

2d.imageData.create2.this

var t = async_test("createImageData(sw, sh) should throw when called with the wrong |this|"); _addTest(function(canvas, ctx) { -assert_throws(new TypeError(), function() { CanvasRenderingContext2D.prototype.createImageData.call(null, 1, 1); }); -assert_throws(new TypeError(), function() { CanvasRenderingContext2D.prototype.createImageData.call(undefined, 1, 1); }); -assert_throws(new TypeError(), function() { CanvasRenderingContext2D.prototype.createImageData.call({}, 1, 1); }); +assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call(null, 1, 1); }); +assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call(undefined, 1, 1); }); +assert_throws_js(TypeError, function() { CanvasRenderingContext2D.prototype.createImageData.call({}, 1, 1); }); }); diff --git a/2dcontext/pixel-manipulation/2d.imageData.get.nonfinite.html b/2dcontext/pixel-manipulation/2d.imageData.get.nonfinite.html index 92623500f4a393..64fd0d90ae5c8f 100644 --- a/2dcontext/pixel-manipulation/2d.imageData.get.nonfinite.html +++ b/2dcontext/pixel-manipulation/2d.imageData.get.nonfinite.html @@ -19,55 +19,55 @@

2d.imageData.get.nonfinite

var t = async_test("getImageData() throws TypeError if arguments are not finite"); _addTest(function(canvas, ctx) { -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(-Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(NaN, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, -Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, NaN, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, -Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, NaN, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, -Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, NaN); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(-Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(NaN, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, -Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, NaN, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, -Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, NaN); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, Infinity); }); var posinfobj = { valueOf: function() { return Infinity; } }, neginfobj = { valueOf: function() { return -Infinity; } }, nanobj = { valueOf: function() { return -Infinity; } }; -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(neginfobj, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(nanobj, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, posinfobj, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, neginfobj, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, nanobj, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, posinfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, neginfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, nanobj, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, neginfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, nanobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, posinfobj, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, posinfobj, 10, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, 10, posinfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, 10, posinfobj, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, 10, 10, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, posinfobj, posinfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, posinfobj, posinfobj, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, posinfobj, 10, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(neginfobj, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(nanobj, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, neginfobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, nanobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, neginfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, nanobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, neginfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, nanobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, posinfobj); }); }); diff --git a/2dcontext/pixel-manipulation/2d.imageData.object.ctor.array.bounds.html b/2dcontext/pixel-manipulation/2d.imageData.object.ctor.array.bounds.html index 5ac7af5dd90074..79b7935c4b8661 100644 --- a/2dcontext/pixel-manipulation/2d.imageData.object.ctor.array.bounds.html +++ b/2dcontext/pixel-manipulation/2d.imageData.object.ctor.array.bounds.html @@ -25,8 +25,8 @@

2d.imageData.object.ctor.array.bounds

assert_throws("INVALID_STATE_ERR", function() { new ImageData(new Uint8ClampedArray(3), 1); }); assert_throws("INDEX_SIZE_ERR", function() { new ImageData(new Uint8ClampedArray(4), 0); }); assert_throws("INDEX_SIZE_ERR", function() { new ImageData(new Uint8ClampedArray(4), 1, 2); }); -assert_throws(new TypeError(), function() { new ImageData(new Uint8Array(8), 1, 2); }); -assert_throws(new TypeError(), function() { new ImageData(new Int8Array(8), 1, 2); }); +assert_throws_js(TypeError, function() { new ImageData(new Uint8Array(8), 1, 2); }); +assert_throws_js(TypeError, function() { new ImageData(new Int8Array(8), 1, 2); }); }); diff --git a/2dcontext/pixel-manipulation/2d.imageData.put.nonfinite.html b/2dcontext/pixel-manipulation/2d.imageData.put.nonfinite.html index c4cbb4ab9d5842..8adafed9db6b18 100644 --- a/2dcontext/pixel-manipulation/2d.imageData.put.nonfinite.html +++ b/2dcontext/pixel-manipulation/2d.imageData.put.nonfinite.html @@ -20,88 +20,88 @@

2d.imageData.put.nonfinite

_addTest(function(canvas, ctx) { var imgdata = ctx.getImageData(0, 0, 10, 10); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, -Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, NaN, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, -Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, NaN); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, -Infinity, 10, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, NaN, 10, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, -Infinity, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, NaN, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, -Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, NaN, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, -Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, NaN, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, -Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, NaN, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, -Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, NaN); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, -Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, NaN, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, -Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, NaN, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, -Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, NaN); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, Infinity); }); }); diff --git a/2dcontext/pixel-manipulation/2d.imageData.put.null.html b/2dcontext/pixel-manipulation/2d.imageData.put.null.html index 851bc0ddc48312..c8d1990d780939 100644 --- a/2dcontext/pixel-manipulation/2d.imageData.put.null.html +++ b/2dcontext/pixel-manipulation/2d.imageData.put.null.html @@ -19,7 +19,7 @@

2d.imageData.put.null

var t = async_test("putImageData() with null imagedata throws TypeError"); _addTest(function(canvas, ctx) { -assert_throws(new TypeError(), function() { ctx.putImageData(null, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.putImageData(null, 0, 0); }); }); diff --git a/2dcontext/pixel-manipulation/2d.imageData.put.wrongtype.html b/2dcontext/pixel-manipulation/2d.imageData.put.wrongtype.html index 4f3fe49dbfbf70..a032b216a9eecd 100644 --- a/2dcontext/pixel-manipulation/2d.imageData.put.wrongtype.html +++ b/2dcontext/pixel-manipulation/2d.imageData.put.wrongtype.html @@ -20,9 +20,9 @@

2d.imageData.put.wrongtype

_addTest(function(canvas, ctx) { var imgdata = { width: 1, height: 1, data: [255, 0, 0, 255] }; -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.putImageData("cheese", 0, 0); }); -assert_throws(new TypeError(), function() { ctx.putImageData(42, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.putImageData("cheese", 0, 0); }); +assert_throws_js(TypeError, function() { ctx.putImageData(42, 0, 0); }); }); diff --git a/2dcontext/tools/gentestutils.py b/2dcontext/tools/gentestutils.py index 1f6792d71b6b99..1b396602606331 100644 --- a/2dcontext/tools/gentestutils.py +++ b/2dcontext/tools/gentestutils.py @@ -233,7 +233,7 @@ def expand_test_code(code): code) code = re.sub(r'@assert throws (\S+Error) (.*);', - r'assert_throws(new \1(), function() { \2; });', + r'assert_throws_js(\1, function() { \2; });', code) code = re.sub(r'@assert (.*) === (.*);', diff --git a/FileAPI/blob/Blob-constructor-endings.html b/FileAPI/blob/Blob-constructor-endings.html index 1dee99ff775da3..90c5af0b232a0c 100644 --- a/FileAPI/blob/Blob-constructor-endings.html +++ b/FileAPI/blob/Blob-constructor-endings.html @@ -36,7 +36,7 @@ 0, {} ].forEach(value => test(t => { - assert_throws(new TypeError(), () => new Blob([], {endings: value}), + assert_throws_js(TypeError, () => new Blob([], {endings: value}), 'Blob constructor should throw'); }, `Invalid "endings" value: ${JSON.stringify(value)}`)); diff --git a/FileAPI/blob/Blob-constructor.html b/FileAPI/blob/Blob-constructor.html index 4d39ed78e0ef79..96adb88572ceb5 100644 --- a/FileAPI/blob/Blob-constructor.html +++ b/FileAPI/blob/Blob-constructor.html @@ -25,7 +25,7 @@ assert_equals(blob.type, ""); }, "Blob constructor with no arguments"); test(function() { - assert_throws(new TypeError(), function() { var blob = Blob(); }); + assert_throws_js(TypeError, function() { var blob = Blob(); }); }, "Blob constructor with no arguments, without 'new'"); test(function() { var blob = new Blob; @@ -59,7 +59,7 @@ window, ]; args.forEach(function(arg) { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new Blob(arg); }, "Should throw for argument " + format_value(arg) + "."); }); @@ -226,7 +226,7 @@ valueOf: function() { assert_unreached("Should not call valueOf if toString is present."); } }]); }, "Throwing toString and valueOf"); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new Blob([{toString: null, valueOf: null}]); }, "Null toString and valueOf"); }, "ToString should be called on elements of the blobParts array and any exceptions should be propagated."); @@ -464,7 +464,7 @@ 'abc' ].forEach(arg => { test(t => { - assert_throws(new TypeError(), () => new Blob([], arg), + assert_throws_js(TypeError, () => new Blob([], arg), 'Blob constructor should throw with invalid property bag'); }, `Passing ${JSON.stringify(arg)} for options should throw`); }); diff --git a/FileAPI/file/File-constructor-endings.html b/FileAPI/file/File-constructor-endings.html index f0f9090768f48e..9a585880d496b2 100644 --- a/FileAPI/file/File-constructor-endings.html +++ b/FileAPI/file/File-constructor-endings.html @@ -36,7 +36,7 @@ 0, {} ].forEach(value => test(t => { - assert_throws(new TypeError(), () => new File([], "name", {endings: value}), + assert_throws_js(TypeError, () => new File([], "name", {endings: value}), 'File constructor should throw'); }, `Invalid "endings" value: ${JSON.stringify(value)}`)); diff --git a/FileAPI/file/File-constructor.html b/FileAPI/file/File-constructor.html index 646ed99c2124a2..60dbb233f018f0 100644 --- a/FileAPI/file/File-constructor.html +++ b/FileAPI/file/File-constructor.html @@ -14,9 +14,9 @@ }, "File interface object exists"); test(t => { - assert_throws(new TypeError(), () => new File(), + assert_throws_js(TypeError, () => new File(), 'Bits argument is required'); - assert_throws(new TypeError(), () => new File([]), + assert_throws_js(TypeError, () => new File([]), 'Name argument is required'); }, 'Required arguments'); @@ -64,13 +64,13 @@ null ].forEach(arg => { test(t => { - assert_throws(new TypeError(), () => new File(arg, 'world.html'), + assert_throws_js(TypeError, () => new File(arg, 'world.html'), 'Constructor should throw for invalid bits argument'); }, `Invalid bits argument: ${JSON.stringify(arg)}`); }); test(t => { - assert_throws(new Error(), () => new File([to_string_throws], 'name.txt'), + assert_throws_js(Error, () => new File([to_string_throws], 'name.txt'), 'Constructor should propagate exceptions'); }, 'Bits argument: object that throws'); @@ -131,7 +131,7 @@ 'abc' ].forEach(arg => { test(t => { - assert_throws(new TypeError(), () => new File(['bits'], 'name.txt', arg), + assert_throws_js(TypeError, () => new File(['bits'], 'name.txt', arg), 'Constructor should throw for invalid property bag type'); }, `Invalid property bag: ${JSON.stringify(arg)}`); }); @@ -150,7 +150,7 @@ }); test(t => { - assert_throws(new Error(), + assert_throws_js(Error, () => new File(['bits'], 'name.txt', {type: to_string_throws}), 'Constructor should propagate exceptions'); }, 'Property bag propagates exceptions'); diff --git a/IndexedDB/idbcursor_advance_index2.htm b/IndexedDB/idbcursor_advance_index2.htm index 77b812e180a6cf..93660566f84d7c 100644 --- a/IndexedDB/idbcursor_advance_index2.htm +++ b/IndexedDB/idbcursor_advance_index2.htm @@ -35,7 +35,7 @@ var cursor = e.target.result; assert_true(cursor != null, "cursor exist"); - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { cursor.advance(document); }); t.done(); diff --git a/IndexedDB/idbcursor_advance_index3.htm b/IndexedDB/idbcursor_advance_index3.htm index b41427f960adc5..27e040d4fece4b 100644 --- a/IndexedDB/idbcursor_advance_index3.htm +++ b/IndexedDB/idbcursor_advance_index3.htm @@ -35,7 +35,7 @@ var cursor = e.target.result; assert_true(cursor != null, "cursor exist"); - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { cursor.advance(-1); }); t.done(); diff --git a/IndexedDB/idbcursor_advance_index6.htm b/IndexedDB/idbcursor_advance_index6.htm index 826cb1e1a0e148..ed4c8f3dadacdc 100644 --- a/IndexedDB/idbcursor_advance_index6.htm +++ b/IndexedDB/idbcursor_advance_index6.htm @@ -26,7 +26,7 @@ var cursor = event.target.result; assert_true(cursor instanceof IDBCursor); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { cursor.advance(0); }, "Calling advance() with count argument 0 should throw TypeError."); diff --git a/IndexedDB/idbcursor_advance_objectstore2.htm b/IndexedDB/idbcursor_advance_objectstore2.htm index 32478c141eaee5..9af1925cdefec5 100644 --- a/IndexedDB/idbcursor_advance_objectstore2.htm +++ b/IndexedDB/idbcursor_advance_objectstore2.htm @@ -29,7 +29,7 @@ var cursor = event.target.result; assert_true(cursor instanceof IDBCursor); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { cursor.advance(0); }, "Calling advance() with count argument 0 should throw TypeError."); diff --git a/IndexedDB/idbcursor_update_index6.htm b/IndexedDB/idbcursor_update_index6.htm index 1e51b1354cf300..9639fb9f7337e3 100644 --- a/IndexedDB/idbcursor_update_index6.htm +++ b/IndexedDB/idbcursor_update_index6.htm @@ -33,7 +33,7 @@ var cursor = e.target.result; assert_true(cursor instanceof IDBCursor); - assert_throws(new TypeError(), function() { cursor.update(); }); + assert_throws_js(TypeError, function() { cursor.update(); }); t.done(); }); } diff --git a/IndexedDB/idbcursor_update_objectstore7.htm b/IndexedDB/idbcursor_update_objectstore7.htm index b1b736cf0ced1f..4751289e6dfe19 100644 --- a/IndexedDB/idbcursor_update_objectstore7.htm +++ b/IndexedDB/idbcursor_update_objectstore7.htm @@ -31,7 +31,7 @@ var cursor = e.target.result; assert_true(cursor instanceof IDBCursor); - assert_throws(new TypeError(), function() { cursor.update(); }); + assert_throws_js(TypeError, function() { cursor.update(); }); t.done(); }); } diff --git a/IndexedDB/idbfactory_cmp2.htm b/IndexedDB/idbfactory_cmp2.htm index 446bb465ce64eb..7f3a5f9f3b0d69 100644 --- a/IndexedDB/idbfactory_cmp2.htm +++ b/IndexedDB/idbfactory_cmp2.htm @@ -9,7 +9,7 @@
diff --git a/beacon/beacon-error.sub.window.js b/beacon/beacon-error.sub.window.js index f2c5e95a276c25..499fa3b27213f2 100644 --- a/beacon/beacon-error.sub.window.js +++ b/beacon/beacon-error.sub.window.js @@ -13,13 +13,13 @@ test(function() { test(function() { var invalidUrl = "http://invalid:url"; - assert_throws(new TypeError(), function() { navigator.sendBeacon(invalidUrl, smallPayload); }, + assert_throws_js(TypeError, function() { navigator.sendBeacon(invalidUrl, smallPayload); }, `calling 'navigator.sendBeacon()' with an invalid URL '${invalidUrl}' must throw a TypeError`); }, "Verify calling 'navigator.sendBeacon()' with an invalid URL throws an exception."); test(function() { var invalidUrl = "nothttp://invalid.url"; - assert_throws(new TypeError(), function() { navigator.sendBeacon(invalidUrl, smallPayload); }, + assert_throws_js(TypeError, function() { navigator.sendBeacon(invalidUrl, smallPayload); }, `calling 'navigator.sendBeacon()' with a non-http(s) URL '${invalidUrl}' must throw a TypeError`); }, "Verify calling 'navigator.sendBeacon()' with a URL that is not a http(s) scheme throws an exception."); diff --git a/beacon/beacon-readablestream.window.js b/beacon/beacon-readablestream.window.js index fc7f81f884bdf4..46e30fcda5cc85 100644 --- a/beacon/beacon-readablestream.window.js +++ b/beacon/beacon-readablestream.window.js @@ -1,3 +1,3 @@ test(() => { - assert_throws(new TypeError(), () => navigator.sendBeacon("...", new ReadableStream())); + assert_throws_js(TypeError, () => navigator.sendBeacon("...", new ReadableStream())); }, "sendBeacon() with a stream does not work due to the keepalive flag being set"); diff --git a/bluetooth/idl/idl-Bluetooth.https.html b/bluetooth/idl/idl-Bluetooth.https.html index 9578fd6af21b0c..7322df53e5c227 100644 --- a/bluetooth/idl/idl-Bluetooth.https.html +++ b/bluetooth/idl/idl-Bluetooth.https.html @@ -7,11 +7,11 @@ const test_desc = 'Bluetooth IDL test'; test(() => { - assert_throws( - new TypeError(), () => new Bluetooth(), + assert_throws_js( + TypeError, () => new Bluetooth(), 'the constructor should not be callable with "new"'); - assert_throws( - new TypeError(), () => Bluetooth(), + assert_throws_js( + TypeError, () => Bluetooth(), 'the constructor should not be callable'); // Bluetooth implements BluetoothDiscovery; diff --git a/bluetooth/idl/idl-BluetoothDevice.https.html b/bluetooth/idl/idl-BluetoothDevice.https.html index 707ac1ab03a92c..6030d4e5acdcda 100644 --- a/bluetooth/idl/idl-BluetoothDevice.https.html +++ b/bluetooth/idl/idl-BluetoothDevice.https.html @@ -9,11 +9,11 @@ const test_desc_idl = 'BluetoothDevice IDL test.'; test(() => { - assert_throws( - new TypeError(), () => new BluetoothDevice(), + assert_throws_js( + TypeError, () => new BluetoothDevice(), 'the constructor should not be callable with "new"'); - assert_throws( - new TypeError(), () => BluetoothDevice(), + assert_throws_js( + TypeError, () => BluetoothDevice(), 'the constructor should not be callable'); }, test_desc_idl); @@ -23,11 +23,11 @@ () => getConnectedHealthThermometerDevice().then(({device}) => { assert_equals(device.constructor.name, 'BluetoothDevice'); var old_device_id = device.id; - assert_throws( - new TypeError(), () => device.id = 'overwritten', + assert_throws_js( + TypeError, () => device.id = 'overwritten', 'the device id should not be writable'); - assert_throws( - new TypeError(), () => device.name = 'overwritten', + assert_throws_js( + TypeError, () => device.name = 'overwritten', 'the device name should not be writable'); assert_equals(device.id, old_device_id); assert_equals(device.name, 'Health Thermometer'); diff --git a/clipboard-apis/clipboard-item.https.html b/clipboard-apis/clipboard-item.https.html index fe5e76ccbb4379..3a2ade564c785f 100644 --- a/clipboard-apis/clipboard-item.https.html +++ b/clipboard-apis/clipboard-item.https.html @@ -19,19 +19,19 @@ }, "ClipboardItem() succeeds with empty options"); test(() => { - assert_throws(new TypeError(), () => {new ClipboardItem({});}); + assert_throws_js(TypeError, () => {new ClipboardItem({});}); }, "ClipboardItem({}) fails with empty dictionary input"); test(() => { - assert_throws(new TypeError(), () => {new ClipboardItem(blob);}); + assert_throws_js(TypeError, () => {new ClipboardItem(blob);}); }, "ClipboardItem(Blob) fails"); test(() => { - assert_throws(new TypeError(), () => {new ClipboardItem(null);}); + assert_throws_js(TypeError, () => {new ClipboardItem(null);}); }, "ClipboardItem() fails with null input"); test(() => { - assert_throws(new TypeError(), () => {new ClipboardItem();}); + assert_throws_js(TypeError, () => {new ClipboardItem();}); }, "ClipboardItem() fails with no input"); test(() => { diff --git a/common/stringifiers.js b/common/stringifiers.js index b59ca9c246f75a..63544f9ed00f1e 100644 --- a/common/stringifiers.js +++ b/common/stringifiers.js @@ -3,7 +3,7 @@ function test_stringifier_attribute(aObject, aAttribute, aIsUnforgeable) { // Step 1. test(function() { [null, undefined].forEach(function(v) { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { aObject.toString.call(v); }); }); @@ -15,7 +15,7 @@ function test_stringifier_attribute(aObject, aAttribute, aIsUnforgeable) { test(function() { assert_false("Window" in window && aObject instanceof window.Window); [{}, window].forEach(function(v) { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { aObject.toString.call(v) }); }); diff --git a/compression/compression-stream.tentative.any.js b/compression/compression-stream.tentative.any.js index 47df70f7cd3979..cf645c41c722f4 100644 --- a/compression/compression-stream.tentative.any.js +++ b/compression/compression-stream.tentative.any.js @@ -33,7 +33,7 @@ async function compressArrayBuffer(input, format) { } test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { const transformer = new CompressionStream("nonvalid"); }, "non supported format should throw"); }, "CompressionStream constructor should throw on invalid format"); diff --git a/compression/decompression-constructor-error.tentative.any.js b/compression/decompression-constructor-error.tentative.any.js index 9ffdb08ce2ff36..7840b3a36cdd95 100644 --- a/compression/decompression-constructor-error.tentative.any.js +++ b/compression/decompression-constructor-error.tentative.any.js @@ -3,13 +3,13 @@ 'use strict'; test(t => { - assert_throws(new TypeError(), () => new DecompressionStream('a'), 'constructor should throw'); + assert_throws_js(TypeError, () => new DecompressionStream('a'), 'constructor should throw'); }, '"a" should cause the constructor to throw'); test(t => { - assert_throws(new TypeError(), () => new DecompressionStream(), 'constructor should throw'); + assert_throws_js(TypeError, () => new DecompressionStream(), 'constructor should throw'); }, 'no input should cause the constructor to throw'); test(t => { - assert_throws(new Error(), () => new DecompressionStream({ toString() { throw Error(); } }), 'constructor should throw'); + assert_throws_js(Error, () => new DecompressionStream({ toString() { throw Error(); } }), 'constructor should throw'); }, 'non-string input should cause the constructor to throw'); diff --git a/content-security-policy/script-src/script-src-1_4.html b/content-security-policy/script-src/script-src-1_4.html index bfc66b2a8d048d..4c975471161972 100644 --- a/content-security-policy/script-src/script-src-1_4.html +++ b/content-security-policy/script-src/script-src-1_4.html @@ -19,7 +19,7 @@

eval() should not run without 'unsafe-eval' script-src directive.

var evalRan = false; - test(function() {assert_throws(new EvalError(), function() { eval('evalRan = true;') })}, "eval() should throw without 'unsafe-eval' keyword source in script-src directive."); + test(function() {assert_throws_js(EvalError, function() { eval('evalRan = true;') })}, "eval() should throw without 'unsafe-eval' keyword source in script-src directive."); test(function() {assert_false(evalRan);}) diff --git a/content-security-policy/script-src/script-src-1_4_2.html b/content-security-policy/script-src/script-src-1_4_2.html index 0ee6f587c5ce16..6d6f23e741c3a9 100644 --- a/content-security-policy/script-src/script-src-1_4_2.html +++ b/content-security-policy/script-src/script-src-1_4_2.html @@ -19,8 +19,8 @@

Function() called as a constructor should throw without 'unsafe-eval' script test(function() { - assert_throws( - new EvalError(), + assert_throws_js( + EvalError, function() { var funq = new Function(''); funq(); diff --git a/content-security-policy/script-src/script-src-strict_dynamic_eval.html b/content-security-policy/script-src/script-src-strict_dynamic_eval.html index 62fda4f3d23051..459d69aefe89fa 100644 --- a/content-security-policy/script-src/script-src-strict_dynamic_eval.html +++ b/content-security-policy/script-src/script-src-strict_dynamic_eval.html @@ -22,7 +22,7 @@

Scripts injected via `eval` are not allowed with `strict-dynamic` without `u assert_equals(e.effectiveDirective, 'script-src'); })); - assert_throws(new Error(), + assert_throws_js(Error, function() { try { eval("evalScriptRan = true;"); diff --git a/content-security-policy/script-src/script-src-strict_dynamic_new_function.html b/content-security-policy/script-src/script-src-strict_dynamic_new_function.html index 2b75276588f28f..263d5d1d874260 100644 --- a/content-security-policy/script-src/script-src-strict_dynamic_new_function.html +++ b/content-security-policy/script-src/script-src-strict_dynamic_new_function.html @@ -22,7 +22,7 @@

Scripts injected via `new Function()` are not allowed with `strict-dynamic` assert_equals(e.effectiveDirective, 'script-src'); })); - assert_throws(new Error(), + assert_throws_js(Error, function() { try { new Function('newFunctionScriptRan = true;')(); diff --git a/css/css-animations/animationevent-interface.js b/css/css-animations/animationevent-interface.js index e35b7fcb0f9865..fcb7ceba205746 100644 --- a/css/css-animations/animationevent-interface.js +++ b/css/css-animations/animationevent-interface.js @@ -10,7 +10,7 @@ }, "the event inherts from Event"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new AnimationEvent(); }, 'First argument is required, so was expecting a TypeError.'); }, 'Missing type argument'); @@ -176,37 +176,37 @@ }, "elapsedTime set to an object with a valueOf function"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new AnimationEvent("test", {elapsedTime: NaN}); }, 'elapsedTime cannot be NaN so was expecting a TypeError'); }, "elapsedTime cannot be set to NaN"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new AnimationEvent("test", {elapsedTime: Infinity}); }, 'elapsedTime cannot be Infinity so was expecting a TypeError'); }, "elapsedTime cannot be set to Infinity"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new AnimationEvent("test", {elapsedTime: -Infinity}); }, 'elapsedTime cannot be -Infinity so was expecting a TypeError'); }, "elapsedTime cannot be set to -Infinity"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new AnimationEvent("test", {elapsedTime: "sample"}); }, 'elapsedTime cannot be a string so was expecting a TypeError'); }, "elapsedTime cannot be set to 'sample'"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new AnimationEvent("test", {elapsedTime: [0.5, 1.0]}); }, 'elapsedTime cannot be a multi-element array so was expecting a TypeError'); }, "elapsedTime cannot be set to [0.5, 1.0]"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new AnimationEvent("test", {elapsedTime: { sample: 0.5}}); }, 'elapsedTime cannot be an object so was expecting a TypeError'); }, "elapsedTime cannot be set to an object"); diff --git a/css/css-conditional/js/001.html b/css/css-conditional/js/001.html index fd9968ded44993..5907a492e5736a 100644 --- a/css/css-conditional/js/001.html +++ b/css/css-conditional/js/001.html @@ -200,7 +200,7 @@ test(function(){ var style_rule = document.styleSheets[0].cssRules[0].cssRules[1]; - assert_throws(new TypeError(), function() { style_rule.insertRule("@supports (width: 0) { ol { width: 0; } }", 0);} ); + assert_throws_js(TypeError, function() { style_rule.insertRule("@supports (width: 0) { ol { width: 0; } }", 0);} ); }, "Inserting an @supports inside a style rule should fail"); test(function(){ diff --git a/css/css-properties-values-api/self-utils.html b/css/css-properties-values-api/self-utils.html index 05aa4b2fb03b29..b770c86c382696 100644 --- a/css/css-properties-values-api/self-utils.html +++ b/css/css-properties-values-api/self-utils.html @@ -33,9 +33,9 @@ }, 'Generated properties respect inherits flag'); test(function(){ - assert_throws(new Error(), () => generate_property({syntax: '', foo: 1})); - assert_throws(new Error(), () => generate_property({syntax: '', inherited: false})); - assert_throws(new Error(), () => generate_property({syntax: '', initial: '10px'})); + assert_throws_js(Error, () => generate_property({syntax: '', foo: 1})); + assert_throws_js(Error, () => generate_property({syntax: '', inherited: false})); + assert_throws_js(Error, () => generate_property({syntax: '', initial: '10px'})); }, 'Can\'t generate property with unknown fields'); diff --git a/css/css-properties-values-api/typedom.html b/css/css-properties-values-api/typedom.html index b8e6f4aaf840c0..51940e298d0770 100644 --- a/css/css-properties-values-api/typedom.html +++ b/css/css-properties-values-api/typedom.html @@ -44,14 +44,14 @@ // Verifies that the specified value is NOT accepted by set(). function verify_map_not_set(map, name, value) { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { map.set(name, value); }); } // Verifies that the specified value is NOT accepted by append(). function verify_map_no_append(map, name, value) { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { map.append(name, value); }); } diff --git a/css/css-transitions/transitionevent-interface.html b/css/css-transitions/transitionevent-interface.html index cd47469ec74210..a40ba453751836 100644 --- a/css/css-transitions/transitionevent-interface.html +++ b/css/css-transitions/transitionevent-interface.html @@ -19,7 +19,7 @@ }, "the event inherts from Event"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new TransitionEvent(); }, 'First argument is required, so was expecting a TypeError.'); }, 'Missing type argument'); @@ -185,37 +185,37 @@ }, "elapsedTime set to an object with a valueOf function"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new TransitionEvent("test", {elapsedTime: NaN}); }, 'elapsedTime cannot be NaN so was expecting a TypeError'); }, "elapsedTime cannot be set to NaN"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new TransitionEvent("test", {elapsedTime: Infinity}); }, 'elapsedTime cannot be Infinity so was expecting a TypeError'); }, "elapsedTime cannot be set to Infinity"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new TransitionEvent("test", {elapsedTime: -Infinity}); }, 'elapsedTime cannot be -Infinity so was expecting a TypeError'); }, "elapsedTime cannot be set to -Infinity"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new TransitionEvent("test", {elapsedTime: "sample"}); }, 'elapsedTime cannot be a string so was expecting a TypeError'); }, "elapsedTime cannot be set to 'sample'"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new TransitionEvent("test", {elapsedTime: [0.5, 1.0]}); }, 'elapsedTime cannot be a multi-element array so was expecting a TypeError'); }, "elapsedTime cannot be set to [0.5, 1.0]"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new TransitionEvent("test", {elapsedTime: { sample: 0.5}}); }, 'elapsedTime cannot be an object so was expecting a TypeError'); }, "elapsedTime cannot be set to an object"); diff --git a/css/css-typed-om/stylevalue-objects/parse-invalid.html b/css/css-typed-om/stylevalue-objects/parse-invalid.html index ea1d56442b1ecb..13ee2df1a6e042 100644 --- a/css/css-typed-om/stylevalue-objects/parse-invalid.html +++ b/css/css-typed-om/stylevalue-objects/parse-invalid.html @@ -11,23 +11,23 @@ 'use strict'; test(() => { - assert_throws(new TypeError(), () => CSSStyleValue.parse('', 'auto')); + assert_throws_js(TypeError, () => CSSStyleValue.parse('', 'auto')); }, 'CSSStyleValue.parse() with empty property name throws TypeError'); test(() => { - assert_throws(new TypeError(), () => CSSStyleValue.parse('lemon', 'auto')); + assert_throws_js(TypeError, () => CSSStyleValue.parse('lemon', 'auto')); }, 'CSSStyleValue.parse() with unsupported property name throws TypeError'); test(() => { - assert_throws(new TypeError(), () => CSSStyleValue.parse('width', '10deg')); + assert_throws_js(TypeError, () => CSSStyleValue.parse('width', '10deg')); }, 'CSSStyleValue.parse() with invalid value for valid property throws TypeError'); test(() => { - assert_throws(new TypeError(), () => CSSStyleValue.parse('margin', '10deg')); + assert_throws_js(TypeError, () => CSSStyleValue.parse('margin', '10deg')); }, 'CSSStyleValue.parse() with invalid value for shorthand property throws TypeError'); test(() => { - assert_throws(new TypeError(), () => CSSStyleValue.parse('--foo', '')); + assert_throws_js(TypeError, () => CSSStyleValue.parse('--foo', '')); }, 'CSSStyleValue.parse() with invalid value for custom property throws TypeError'); diff --git a/css/css-typed-om/stylevalue-objects/parseAll-invalid.html b/css/css-typed-om/stylevalue-objects/parseAll-invalid.html index c18095435595df..45fad409bbfea4 100644 --- a/css/css-typed-om/stylevalue-objects/parseAll-invalid.html +++ b/css/css-typed-om/stylevalue-objects/parseAll-invalid.html @@ -11,23 +11,23 @@ 'use strict'; test(() => { - assert_throws(new TypeError(), () => CSSStyleValue.parseAll('', 'auto')); + assert_throws_js(TypeError, () => CSSStyleValue.parseAll('', 'auto')); }, 'CSSStyleValue.parseAll() with empty property name throws TypeError'); test(() => { - assert_throws(new TypeError(), () => CSSStyleValue.parseAll('lemon', 'auto')); + assert_throws_js(TypeError, () => CSSStyleValue.parseAll('lemon', 'auto')); }, 'CSSStyleValue.parseAll() with unsupported property name throws TypeError'); test(() => { - assert_throws(new TypeError(), () => CSSStyleValue.parseAll('width', '10deg')); + assert_throws_js(TypeError, () => CSSStyleValue.parseAll('width', '10deg')); }, 'CSSStyleValue.parseAll() with invalid value for valid property throws TypeError'); test(() => { - assert_throws(new TypeError(), () => CSSStyleValue.parseAll('margin', '10deg')); + assert_throws_js(TypeError, () => CSSStyleValue.parseAll('margin', '10deg')); }, 'CSSStyleValue.parseAll() with invalid value for shorthand property throws TypeError'); test(() => { - assert_throws(new TypeError(), () => CSSStyleValue.parseAll('--foo', '')); + assert_throws_js(TypeError, () => CSSStyleValue.parseAll('--foo', '')); }, 'CSSStyleValue.parseAll() with invalid value for custom property throws TypeError'); diff --git a/css/css-typed-om/stylevalue-subclasses/cssKeywordValue-invalid.html b/css/css-typed-om/stylevalue-subclasses/cssKeywordValue-invalid.html index b923f380bda98f..69007a1c590ca4 100644 --- a/css/css-typed-om/stylevalue-subclasses/cssKeywordValue-invalid.html +++ b/css/css-typed-om/stylevalue-subclasses/cssKeywordValue-invalid.html @@ -11,7 +11,7 @@ 'use strict'; test(() => { - assert_throws(new TypeError(), () => new CSSKeywordValue('')); + assert_throws_js(TypeError, () => new CSSKeywordValue('')); }, 'Constructing CSSKeywordValue with an empty string throws a TypeError'); diff --git a/css/css-typed-om/stylevalue-subclasses/cssKeywordValue-value.html b/css/css-typed-om/stylevalue-subclasses/cssKeywordValue-value.html index 1af557fb086787..ceb39bce5d2173 100644 --- a/css/css-typed-om/stylevalue-subclasses/cssKeywordValue-value.html +++ b/css/css-typed-om/stylevalue-subclasses/cssKeywordValue-value.html @@ -27,7 +27,7 @@ test(() => { let result = new CSSKeywordValue('lemon'); - assert_throws(new TypeError(), () => result.value = ''); + assert_throws_js(TypeError, () => result.value = ''); assert_equals(result.value, 'lemon', 'value does not change'); }, 'Updating CSSKeywordValue.value with an empty string throws a TypeError'); diff --git a/css/css-typed-om/stylevalue-subclasses/cssPerspective.tentative.html b/css/css-typed-om/stylevalue-subclasses/cssPerspective.tentative.html index 4fbd7ca0ae452e..5edf5bb5b01fa1 100644 --- a/css/css-typed-om/stylevalue-subclasses/cssPerspective.tentative.html +++ b/css/css-typed-om/stylevalue-subclasses/cssPerspective.tentative.html @@ -20,14 +20,14 @@ for (const {length, desc} of gInvalidTestCases) { test(() => { - assert_throws(new TypeError(), () => new CSSPerspective(length)); + assert_throws_js(TypeError, () => new CSSPerspective(length)); }, 'Constructing a CSSPerspective with ' + desc + ' throws a TypeError'); } for (const {length, desc} of gInvalidTestCases) { test(() => { let perspective = new CSSPerspective(CSS.px(0)); - assert_throws(new TypeError(), () => perspective.length = length); + assert_throws_js(TypeError, () => perspective.length = length); assert_style_value_equals(perspective.length, CSS.px(0)); }, 'Updating CSSPerspective.length with ' + desc + ' throws a TypeError'); } diff --git a/css/css-typed-om/stylevalue-subclasses/cssPositionValue-invalid.html b/css/css-typed-om/stylevalue-subclasses/cssPositionValue-invalid.html index d63c0c78694aa7..9ff9f014e19f97 100644 --- a/css/css-typed-om/stylevalue-subclasses/cssPositionValue-invalid.html +++ b/css/css-typed-om/stylevalue-subclasses/cssPositionValue-invalid.html @@ -43,13 +43,13 @@ for (const {value, description} of gTestArguments) { test(() => { - assert_throws(new TypeError(), () => new CSSPositionValue(value, CSS.px(0))); - assert_throws(new TypeError(), () => new CSSPositionValue(CSS.px(0), value)); + assert_throws_js(TypeError, () => new CSSPositionValue(value, CSS.px(0))); + assert_throws_js(TypeError, () => new CSSPositionValue(CSS.px(0), value)); }, `Constructing a CSSPositionValue with ${description} throws a TypeError`); test(() => { let position = new CSSPositionValue(CSS.px(0), CSS.px(0)); - assert_throws(new TypeError(), () => position.x = value); + assert_throws_js(TypeError, () => position.x = value); assert_equals(position.x.value, 0, 'X member should not have changed'); @@ -57,7 +57,7 @@ test(() => { let position = new CSSPositionValue(CSS.px(0), CSS.px(0)); - assert_throws(new TypeError(), () => position.y = value); + assert_throws_js(TypeError, () => position.y = value); assert_equals(position.y.value, 0, 'Y member should not have changed'); diff --git a/css/css-typed-om/stylevalue-subclasses/cssRotate.tentative.html b/css/css-typed-om/stylevalue-subclasses/cssRotate.tentative.html index 17490dcea90c8a..6c234bc4724e70 100644 --- a/css/css-typed-om/stylevalue-subclasses/cssRotate.tentative.html +++ b/css/css-typed-om/stylevalue-subclasses/cssRotate.tentative.html @@ -20,16 +20,16 @@ for (const {angle, desc} of gInvalidAngleTestCases) { test(() => { - assert_throws(new TypeError(), () => new CSSRotate(angle)); - assert_throws(new TypeError(), () => new CSSRotate(0, 0, 0, angle)); + assert_throws_js(TypeError, () => new CSSRotate(angle)); + assert_throws_js(TypeError, () => new CSSRotate(0, 0, 0, angle)); }, 'Constructing a CSSRotate with ' + desc + ' for the angle throws a TypeError'); } for (const {coord, desc} of gInvalidCoordTestCases) { test(() => { - assert_throws(new TypeError(), () => new CSSRotate(coord, 0, 0, CSS.deg(0))); - assert_throws(new TypeError(), () => new CSSRotate(0, coord, 0, CSS.deg(0))); - assert_throws(new TypeError(), () => new CSSRotate(0, 0, coord, CSS.deg(0))); + assert_throws_js(TypeError, () => new CSSRotate(coord, 0, 0, CSS.deg(0))); + assert_throws_js(TypeError, () => new CSSRotate(0, coord, 0, CSS.deg(0))); + assert_throws_js(TypeError, () => new CSSRotate(0, 0, coord, CSS.deg(0))); }, 'Constructing a CSSRotate with ' + desc + ' for the coordinates throws a TypeError'); } @@ -37,7 +37,7 @@ for (const {value, desc} of gInvalidCoordTestCases) { test(() => { let result = new CSSRotate(0, 0, 0, CSS.deg(0)); - assert_throws(new TypeError(), () => result[attr] = value); + assert_throws_js(TypeError, () => result[attr] = value); assert_style_value_equals(result[attr], CSS.number(0)); }, 'Updating CSSRotate.' + attr + ' to ' + desc + ' throws a TypeError'); } @@ -46,7 +46,7 @@ for (const {angle, desc} of gInvalidAngleTestCases) { test(() => { let result = new CSSRotate(CSS.deg(0)); - assert_throws(new TypeError(), () => result.angle = angle); + assert_throws_js(TypeError, () => result.angle = angle); assert_style_value_equals(result.angle, CSS.deg(0)); }, 'Updating CSSRotate.angle to ' + desc + ' throws a TypeError'); } diff --git a/css/css-typed-om/stylevalue-subclasses/cssScale.tentative.html b/css/css-typed-om/stylevalue-subclasses/cssScale.tentative.html index d52a8f1a2261ee..9bbe6c92f115b1 100644 --- a/css/css-typed-om/stylevalue-subclasses/cssScale.tentative.html +++ b/css/css-typed-om/stylevalue-subclasses/cssScale.tentative.html @@ -15,11 +15,11 @@ for (const {coord, desc} of gInvalidCoordTestCases) { test(() => { - assert_throws(new TypeError(), () => new CSSScale(coord, 0)); - assert_throws(new TypeError(), () => new CSSScale(0, coord)); - assert_throws(new TypeError(), () => new CSSScale(coord, 0, 0)); - assert_throws(new TypeError(), () => new CSSScale(0, coord, 0)); - assert_throws(new TypeError(), () => new CSSScale(0, 0, coord)); + assert_throws_js(TypeError, () => new CSSScale(coord, 0)); + assert_throws_js(TypeError, () => new CSSScale(0, coord)); + assert_throws_js(TypeError, () => new CSSScale(coord, 0, 0)); + assert_throws_js(TypeError, () => new CSSScale(0, coord, 0)); + assert_throws_js(TypeError, () => new CSSScale(0, 0, coord)); }, 'Constructing a CSSScale with ' + desc + ' for the coordinates throws a TypeError'); } @@ -27,7 +27,7 @@ for (const {value, desc} of gInvalidCoordTestCases) { test(() => { let result = new CSSScale(0, 0, 0); - assert_throws(new TypeError(), () => result[attr] = value); + assert_throws_js(TypeError, () => result[attr] = value); assert_style_value_equals(result[attr], CSS.number(0)); }, 'Updating CSSScale.' + attr + ' to ' + desc + ' throws a TypeError'); } diff --git a/css/css-typed-om/stylevalue-subclasses/cssSkew.tentative.html b/css/css-typed-om/stylevalue-subclasses/cssSkew.tentative.html index 2b22d9bcd21816..0a410859b22976 100644 --- a/css/css-typed-om/stylevalue-subclasses/cssSkew.tentative.html +++ b/css/css-typed-om/stylevalue-subclasses/cssSkew.tentative.html @@ -20,8 +20,8 @@ for (const {value, desc} of gInvalidTestCases) { test(() => { - assert_throws(new TypeError(), () => new CSSSkew(value, CSS.deg(0))); - assert_throws(new TypeError(), () => new CSSSkew(CSS.deg(0), value)); + assert_throws_js(TypeError, () => new CSSSkew(value, CSS.deg(0))); + assert_throws_js(TypeError, () => new CSSSkew(CSS.deg(0), value)); }, 'Constructing a CSSSkew with ' + desc + ' throws a TypeError'); } @@ -29,7 +29,7 @@ for (const {value, desc} of gInvalidTestCases) { test(() => { let skew = new CSSSkew(CSS.deg(0), CSS.deg(0)); - assert_throws(new TypeError(), () => skew[attr] = value); + assert_throws_js(TypeError, () => skew[attr] = value); assert_style_value_equals(skew[attr], CSS.deg(0)); }, 'Updating CSSSkew.' + attr + ' with ' + desc + ' throws a TypeError'); } diff --git a/css/css-typed-om/stylevalue-subclasses/cssSkewX.tentative.html b/css/css-typed-om/stylevalue-subclasses/cssSkewX.tentative.html index 1e614146563fb9..59d7c064edd401 100644 --- a/css/css-typed-om/stylevalue-subclasses/cssSkewX.tentative.html +++ b/css/css-typed-om/stylevalue-subclasses/cssSkewX.tentative.html @@ -20,14 +20,14 @@ for (const {value, desc} of gInvalidTestCases) { test(() => { - assert_throws(new TypeError(), () => new CSSSkewX(value)); + assert_throws_js(TypeError, () => new CSSSkewX(value)); }, 'Constructing a CSSSkewX with ' + desc + ' throws a TypeError'); } for (const {value, desc} of gInvalidTestCases) { test(() => { let skewX = new CSSSkewX(CSS.deg(0)); - assert_throws(new TypeError(), () => skewX.ax = value); + assert_throws_js(TypeError, () => skewX.ax = value); assert_style_value_equals(skewX.ax, CSS.deg(0)); }, 'Updating CSSSkewX.ax with ' + desc + ' throws a TypeError'); } diff --git a/css/css-typed-om/stylevalue-subclasses/cssSkewY.tentative.html b/css/css-typed-om/stylevalue-subclasses/cssSkewY.tentative.html index 643d2f686bb814..6a6fe55a97672a 100644 --- a/css/css-typed-om/stylevalue-subclasses/cssSkewY.tentative.html +++ b/css/css-typed-om/stylevalue-subclasses/cssSkewY.tentative.html @@ -20,14 +20,14 @@ for (const {value, desc} of gInvalidTestCases) { test(() => { - assert_throws(new TypeError(), () => new CSSSkewY(value)); + assert_throws_js(TypeError, () => new CSSSkewY(value)); }, 'Constructing a CSSSkewY with ' + desc + ' throws a TypeError'); } for (const {value, desc} of gInvalidTestCases) { test(() => { let skewY = new CSSSkewY(CSS.deg(0)); - assert_throws(new TypeError(), () => skewY.ay = value); + assert_throws_js(TypeError, () => skewY.ay = value); assert_style_value_equals(skewY.ay, CSS.deg(0)); }, 'Updating CSSSkewY.ay with ' + desc + ' throws a TypeError'); } diff --git a/css/css-typed-om/stylevalue-subclasses/cssTransformComponent-toMatrix-relative-units.html b/css/css-typed-om/stylevalue-subclasses/cssTransformComponent-toMatrix-relative-units.html index 67b63a6b6661c2..432943b6da03c1 100644 --- a/css/css-typed-om/stylevalue-subclasses/cssTransformComponent-toMatrix-relative-units.html +++ b/css/css-typed-om/stylevalue-subclasses/cssTransformComponent-toMatrix-relative-units.html @@ -10,7 +10,7 @@ 'use strict'; test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { return new CSSTranslate( new CSSUnitValue(1, 'px'), new CSSUnitValue(1, 'em') @@ -19,7 +19,7 @@ }, 'CSSTranslate.toMatrix() containing relative units throws TypeError'); test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { return new CSSPerspective(new CSSUnitValue(1, 'em')).toMatrix(); }); }, 'CSSPerspective.toMatrix() containing relative units throws TypeError'); diff --git a/css/css-typed-om/stylevalue-subclasses/cssTransformValue.tentative.html b/css/css-typed-om/stylevalue-subclasses/cssTransformValue.tentative.html index 47dc05dbec6a77..4c1a4861fe8dd6 100644 --- a/css/css-typed-om/stylevalue-subclasses/cssTransformValue.tentative.html +++ b/css/css-typed-om/stylevalue-subclasses/cssTransformValue.tentative.html @@ -10,8 +10,8 @@ 'use strict'; test(() => { - assert_throws(new TypeError(), () => new CSSTransformValue()); - assert_throws(new TypeError(), () => new CSSTransformValue([])); + assert_throws_js(TypeError, () => new CSSTransformValue()); + assert_throws_js(TypeError, () => new CSSTransformValue([])); }, 'Constructing a CSSTransformValue with no components throws TypeError'); test(() => { @@ -78,7 +78,7 @@ test(() => { let transform = new CSSTransformValue([new CSSScale(1, 2)]); - assert_throws(new TypeError(), () => transform.is2D = false); + assert_throws_js(TypeError, () => transform.is2D = false); assert_equals(transform.is2D, true); }, 'CSSTransformValue.is2D is readonly'); diff --git a/css/css-typed-om/stylevalue-subclasses/cssTranslate.tentative.html b/css/css-typed-om/stylevalue-subclasses/cssTranslate.tentative.html index 7ce281d43b6c4c..0554351db3b320 100644 --- a/css/css-typed-om/stylevalue-subclasses/cssTranslate.tentative.html +++ b/css/css-typed-om/stylevalue-subclasses/cssTranslate.tentative.html @@ -15,21 +15,21 @@ for (const {coord, desc} of gInvalidCoordTestCases) { test(() => { - assert_throws(new TypeError(), () => new CSSTranslate(coord, CSS.px(0), CSS.px(0))); - assert_throws(new TypeError(), () => new CSSTranslate(CSS.px(0), coord, CSS.px(0))); - assert_throws(new TypeError(), () => new CSSTranslate(CSS.px(0), CSS.px(0), coord)); + assert_throws_js(TypeError, () => new CSSTranslate(coord, CSS.px(0), CSS.px(0))); + assert_throws_js(TypeError, () => new CSSTranslate(CSS.px(0), coord, CSS.px(0))); + assert_throws_js(TypeError, () => new CSSTranslate(CSS.px(0), CSS.px(0), coord)); }, 'Constructing a CSSTranslate with ' + desc + ' for the coordinates throws a TypeError'); } test(() => { - assert_throws(new TypeError(), () => new CSSTranslate(CSS.px(0), CSS.px(0), CSS.percent(0))); + assert_throws_js(TypeError, () => new CSSTranslate(CSS.px(0), CSS.px(0), CSS.percent(0))); }, 'Constructing a CSSTranslate with a percent for the Z coordinate throws a TypeError'); for (const attr of ['x', 'y', 'z']) { for (const {value, desc} of gInvalidCoordTestCases) { test(() => { let result = new CSSTranslate(CSS.px(0), CSS.px(0), CSS.px(0)); - assert_throws(new TypeError(), () => result[attr] = value); + assert_throws_js(TypeError, () => result[attr] = value); assert_style_value_equals(result[attr], CSS.px(0)); }, 'Updating CSSTranslate.' + attr + ' to ' + desc + ' throws a TypeError'); } @@ -37,7 +37,7 @@ test(() => { let result = new CSSTranslate(CSS.px(0), CSS.px(0), CSS.px(0)); - assert_throws(new TypeError(), () => result.z = CSS.percent(0)); + assert_throws_js(TypeError, () => result.z = CSS.percent(0)); assert_style_value_equals(result.z, CSS.px(0)); }, 'Updating CSSTranslate.z to a percent throws a TypeError'); diff --git a/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-indexed-getter-setter.html b/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-indexed-getter-setter.html index 9f0403fbae406e..65a65ac0dfe681 100644 --- a/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-indexed-getter-setter.html +++ b/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-indexed-getter-setter.html @@ -47,7 +47,7 @@ test(() => { let result = new CSSUnparsedValue(['foo', 'bar']); - assert_throws(new RangeError(), () => result[3] = 'foo'); + assert_throws_js(RangeError, () => result[3] = 'foo'); assert_equals(result[3], undefined, 'fragment does not change'); }, 'Setting out of range index in CSSUnparsedValue throws RangeError'); diff --git a/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-invalid.html b/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-invalid.html index 3696e9997edf7b..4da6a322bd63c0 100644 --- a/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-invalid.html +++ b/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-invalid.html @@ -11,12 +11,12 @@ 'use strict'; test(() => { - assert_throws(new TypeError(), () => new CSSVariableReferenceValue('')); + assert_throws_js(TypeError, () => new CSSVariableReferenceValue('')); }, 'Constructing a CSSVariableReferenceValue with an empty variable name ' + 'throws a TypeError'); test(() => { - assert_throws(new TypeError(), () => new CSSVariableReferenceValue('bar')); + assert_throws_js(TypeError, () => new CSSVariableReferenceValue('bar')); }, 'Constructing a CSSVariableReferenceValue with an invalid variable name ' + 'throws SyntaxError'); diff --git a/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-variable.html b/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-variable.html index 236758bf1f281b..51b60a8df5527b 100644 --- a/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-variable.html +++ b/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-variable.html @@ -18,14 +18,14 @@ test(() => { let result = new CSSVariableReferenceValue('--foo'); - assert_throws(new TypeError(), () => result.variable = ''); + assert_throws_js(TypeError, () => result.variable = ''); assert_equals(result.variable, '--foo', 'variable does not change'); }, 'Updating CSSVariableReferenceValue.variable to the empty string ' + 'throws TypeError'); test(() => { let result = new CSSVariableReferenceValue('--foo'); - assert_throws(new TypeError(), () => result.variable = 'bar'); + assert_throws_js(TypeError, () => result.variable = 'bar'); assert_equals(result.variable, '--foo', 'variable does not change'); }, 'Updating CSSVariableReferenceValue.variable to an invalid custom ' + 'property name throws TypeError'); diff --git a/css/css-typed-om/stylevalue-subclasses/numeric-objects/add-two-types.tentative.html b/css/css-typed-om/stylevalue-subclasses/numeric-objects/add-two-types.tentative.html index 313ff5acfdb227..3571d542f8cb85 100644 --- a/css/css-typed-om/stylevalue-subclasses/numeric-objects/add-two-types.tentative.html +++ b/css/css-typed-om/stylevalue-subclasses/numeric-objects/add-two-types.tentative.html @@ -13,7 +13,7 @@ test(() => { const a = new CSSUnitValue(0, 'number'); const b = new CSSUnitValue(0, 'px'); - assert_throws(new TypeError(), () => new CSSMathSum(a, b)); + assert_throws_js(TypeError, () => new CSSMathSum(a, b)); }, 'Adding two types with different non-null percent hints throws TypeError'); test(() => { @@ -40,7 +40,7 @@ test(() => { const a = new CSSMathProduct(new CSSUnitValue(0, 'px'), new CSSUnitValue(0, 'px')); const b = new CSSUnitValue(0, 'percent'); - assert_throws(new TypeError(), () => new CSSMathSum(a, b)); + assert_throws_js(TypeError, () => new CSSMathSum(a, b)); }, 'Adding a type with percent 2 returns type with percent hint throws TypeError'); test(() => { diff --git a/css/css-typed-om/stylevalue-subclasses/numeric-objects/arithmetic.tentative.html b/css/css-typed-om/stylevalue-subclasses/numeric-objects/arithmetic.tentative.html index d58bb075ce292c..cb9a7a71027df1 100644 --- a/css/css-typed-om/stylevalue-subclasses/numeric-objects/arithmetic.tentative.html +++ b/css/css-typed-om/stylevalue-subclasses/numeric-objects/arithmetic.tentative.html @@ -62,7 +62,7 @@ }, 'Calling ' + mathType.name + '.' + methodName + ' with number CSSUnitValues simplifies to a CSSUnitValue'); test(() => { - assert_throws(new TypeError(), () => new CSS.px(0)[methodName](CSS.px(1), CSS.s(2))); + assert_throws_js(TypeError, () => new CSS.px(0)[methodName](CSS.px(1), CSS.s(2))); }, 'Calling CSSNumericValue.' + methodName + ' with incompatible types throws TypeError'); } @@ -145,9 +145,9 @@ }, 'Calling CSSNumericValue.div inverts all argument values'); test(() => { - assert_throws(new RangeError(), () => CSS.number(2).div(CSS.number(0))); - assert_throws(new RangeError(), () => CSS.number(3).div(CSS.px(10) ,CSS.number(0))); - assert_throws(new RangeError(), () => CSS.number(2).div(CSS.number(0), CSS.number(0))); + assert_throws_js(RangeError, () => CSS.number(2).div(CSS.number(0))); + assert_throws_js(RangeError, () => CSS.number(3).div(CSS.px(10) ,CSS.number(0))); + assert_throws_js(RangeError, () => CSS.number(2).div(CSS.number(0), CSS.number(0))); }, 'Can not divide with CSSUnitValue which has zero value and number type'); diff --git a/css/css-typed-om/stylevalue-subclasses/numeric-objects/cssUnitValue.html b/css/css-typed-om/stylevalue-subclasses/numeric-objects/cssUnitValue.html index 411b36fe1ed717..b44c67129fc465 100644 --- a/css/css-typed-om/stylevalue-subclasses/numeric-objects/cssUnitValue.html +++ b/css/css-typed-om/stylevalue-subclasses/numeric-objects/cssUnitValue.html @@ -11,11 +11,11 @@ 'use strict'; test(() => { - assert_throws(new TypeError(), () => new CSSUnitValue(0, 'lemon')); + assert_throws_js(TypeError, () => new CSSUnitValue(0, 'lemon')); }, 'Constructing CSSUnitValue with an unknown unit throws a TypeError'); test(() => { - assert_throws(new TypeError(), () => new CSSUnitValue(0, '')); + assert_throws_js(TypeError, () => new CSSUnitValue(0, '')); }, 'Constructing CSSUnitValue with a empty string unit throws a TypeError'); for (const unit of gValidUnits) { diff --git a/css/css-typed-om/stylevalue-subclasses/numeric-objects/cssnumericvalue-multiply-two-types.tentative.html b/css/css-typed-om/stylevalue-subclasses/numeric-objects/cssnumericvalue-multiply-two-types.tentative.html index 38045ee0fe5a78..e09c57e641b998 100644 --- a/css/css-typed-om/stylevalue-subclasses/numeric-objects/cssnumericvalue-multiply-two-types.tentative.html +++ b/css/css-typed-om/stylevalue-subclasses/numeric-objects/cssnumericvalue-multiply-two-types.tentative.html @@ -13,7 +13,7 @@ test(() => { const a = new CSSMathSum(new CSSUnitValue(0, 'px'), new CSSUnitValue(0, 'percent')); const b = new CSSMathSum(new CSSUnitValue(0, 's'), new CSSUnitValue(0, 'percent')); - assert_throws(new TypeError(), () => new CSSMathProduct(a, b)); + assert_throws_js(TypeError, () => new CSSMathProduct(a, b)); }, 'Multiplying two types with different non-null percent hints throws TypeError'); test(() => { diff --git a/css/css-typed-om/the-stylepropertymap/computed/get-invalid.html b/css/css-typed-om/the-stylepropertymap/computed/get-invalid.html index 8117d18b764ced..403c2691f405bd 100644 --- a/css/css-typed-om/the-stylepropertymap/computed/get-invalid.html +++ b/css/css-typed-om/the-stylepropertymap/computed/get-invalid.html @@ -12,7 +12,7 @@ test(t => { const styleMap = createComputedStyleMap(t); - assert_throws(new TypeError(), () => styleMap.get('lemon')); + assert_throws_js(TypeError, () => styleMap.get('lemon')); }, 'Calling StylePropertyMap.get with an unsupported property throws a TypeError'); diff --git a/css/css-typed-om/the-stylepropertymap/computed/getAll.tentative.html b/css/css-typed-om/the-stylepropertymap/computed/getAll.tentative.html index ca7d3b6a65f550..1673a52bc0c124 100644 --- a/css/css-typed-om/the-stylepropertymap/computed/getAll.tentative.html +++ b/css/css-typed-om/the-stylepropertymap/computed/getAll.tentative.html @@ -11,7 +11,7 @@ test(t => { const styleMap = createComputedStyleMap(t); - assert_throws(new TypeError(), () => styleMap.getAll('lemon')); + assert_throws_js(TypeError, () => styleMap.getAll('lemon')); }, 'Calling StylePropertyMap.getAll with an unsupported property throws a TypeError'); test(t => { diff --git a/css/css-typed-om/the-stylepropertymap/computed/has.tentative.html b/css/css-typed-om/the-stylepropertymap/computed/has.tentative.html index d387304d43a93e..53924c4a4834b1 100644 --- a/css/css-typed-om/the-stylepropertymap/computed/has.tentative.html +++ b/css/css-typed-om/the-stylepropertymap/computed/has.tentative.html @@ -11,7 +11,7 @@ test(t => { const styleMap = createComputedStyleMap(t); - assert_throws(new TypeError(), () => styleMap.has('lemon')); + assert_throws_js(TypeError, () => styleMap.has('lemon')); }, 'Calling StylePropertyMap.has with an unsupported property throws a TypeError'); const gTestCases = [ diff --git a/css/css-typed-om/the-stylepropertymap/declared/append.tentative.html b/css/css-typed-om/the-stylepropertymap/declared/append.tentative.html index 3f94a899ea5213..ced6e81aaad390 100644 --- a/css/css-typed-om/the-stylepropertymap/declared/append.tentative.html +++ b/css/css-typed-om/the-stylepropertymap/declared/append.tentative.html @@ -24,7 +24,7 @@ for (const {property, values, desc} of gInvalidTestCases) { test(t => { let styleMap = createDeclaredStyleMap(t, ''); - assert_throws(new TypeError(), () => styleMap.append(property, ...values)); + assert_throws_js(TypeError, () => styleMap.append(property, ...values)); }, 'Calling StylePropertyMap.append with ' + desc + ' throws TypeError'); } diff --git a/css/css-typed-om/the-stylepropertymap/declared/delete-invalid.html b/css/css-typed-om/the-stylepropertymap/declared/delete-invalid.html index 547ea26976252c..04dcccf5e89584 100644 --- a/css/css-typed-om/the-stylepropertymap/declared/delete-invalid.html +++ b/css/css-typed-om/the-stylepropertymap/declared/delete-invalid.html @@ -12,7 +12,7 @@ test(t => { let styleMap = createDeclaredStyleMap(t, ''); - assert_throws(new TypeError(), () => styleMap.delete('lemon')); + assert_throws_js(TypeError, () => styleMap.delete('lemon')); }, 'Deleting an unsupported property name throws a TypeError'); diff --git a/css/css-typed-om/the-stylepropertymap/declared/get-invalid.html b/css/css-typed-om/the-stylepropertymap/declared/get-invalid.html index a91d1978130ac5..0cd1412945be25 100644 --- a/css/css-typed-om/the-stylepropertymap/declared/get-invalid.html +++ b/css/css-typed-om/the-stylepropertymap/declared/get-invalid.html @@ -12,7 +12,7 @@ test(t => { const styleMap = createDeclaredStyleMap(t); - assert_throws(new TypeError(), () => styleMap.get('lemon')); + assert_throws_js(TypeError, () => styleMap.get('lemon')); }, 'Calling StylePropertyMap.get with an unsupported property throws a TypeError'); diff --git a/css/css-typed-om/the-stylepropertymap/declared/getAll.tentative.html b/css/css-typed-om/the-stylepropertymap/declared/getAll.tentative.html index dd4e90b22f48ef..97baf08a784e70 100644 --- a/css/css-typed-om/the-stylepropertymap/declared/getAll.tentative.html +++ b/css/css-typed-om/the-stylepropertymap/declared/getAll.tentative.html @@ -11,7 +11,7 @@ test(t => { const styleMap = createDeclaredStyleMap(t); - assert_throws(new TypeError(), () => styleMap.getAll('lemon')); + assert_throws_js(TypeError, () => styleMap.getAll('lemon')); }, 'Calling StylePropertyMap.getAll with an unsupported property throws a TypeError'); test(t => { diff --git a/css/css-typed-om/the-stylepropertymap/declared/has.tentative.html b/css/css-typed-om/the-stylepropertymap/declared/has.tentative.html index 93d29d94c3f54d..6ea24c7ea9f0b4 100644 --- a/css/css-typed-om/the-stylepropertymap/declared/has.tentative.html +++ b/css/css-typed-om/the-stylepropertymap/declared/has.tentative.html @@ -11,7 +11,7 @@ test(t => { const styleMap = createDeclaredStyleMap(t); - assert_throws(new TypeError(), () => styleMap.has('lemon')); + assert_throws_js(TypeError, () => styleMap.has('lemon')); }, 'Calling StylePropertyMap.has with an unsupported property throws a TypeError'); const gTestCases = [ diff --git a/css/css-typed-om/the-stylepropertymap/declared/set-shorthand.html b/css/css-typed-om/the-stylepropertymap/declared/set-shorthand.html index 2d6ec13ffc26c1..7a025df64793cb 100644 --- a/css/css-typed-om/the-stylepropertymap/declared/set-shorthand.html +++ b/css/css-typed-om/the-stylepropertymap/declared/set-shorthand.html @@ -17,7 +17,7 @@ for (const {property, values, desc} of gInvalidTestCases) { test(t => { let styleMap = createInlineStyleMap(t, ''); - assert_throws(new TypeError(), () => styleMap.set(property, ...values)); + assert_throws_js(TypeError, () => styleMap.set(property, ...values)); }, 'Setting a shorthand with ' + desc + ' on css rule throws TypeError'); } diff --git a/css/css-typed-om/the-stylepropertymap/declared/set.tentative.html b/css/css-typed-om/the-stylepropertymap/declared/set.tentative.html index 6161f94d53cb2f..d9c24fafc22b89 100644 --- a/css/css-typed-om/the-stylepropertymap/declared/set.tentative.html +++ b/css/css-typed-om/the-stylepropertymap/declared/set.tentative.html @@ -19,23 +19,23 @@ for (const {property, values, desc} of gInvalidTestCases) { test(t => { let styleMap = createDeclaredStyleMap(t, ''); - assert_throws(new TypeError(), () => styleMap.set(property, ...values)); + assert_throws_js(TypeError, () => styleMap.set(property, ...values)); }, 'Setting a StylePropertyMap with ' + desc + ' throws TypeError'); } test(t => { let styleMap = createDeclaredStyleMap(t, ''); - assert_throws(new TypeError(), () => styleMap.set('width', CSS.px(10), CSS.px(10))); + assert_throws_js(TypeError, () => styleMap.set('width', CSS.px(10), CSS.px(10))); }, 'Setting a non list-valued property with multiple arguments throws TypeError'); test(t => { let styleMap = createDeclaredStyleMap(t, ''); - assert_throws(new TypeError(), () => styleMap.set('width', '1s, 2s')); + assert_throws_js(TypeError, () => styleMap.set('width', '1s, 2s')); }, 'Setting a non list-valued property with list-valued string throws TypeError'); test(t => { let styleMap = createDeclaredStyleMap(t, ''); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { styleMap.set('transition-duration', '1s', new CSSUnparsedValue([])); }); }, 'Setting a list-valued property with a CSSUnparsedValue and other ' + @@ -43,7 +43,7 @@ test(t => { let styleMap = createDeclaredStyleMap(t, ''); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { styleMap.set('transition-duration', '1s', 'var(--A)'); }); }, 'Setting a list-valued property with a var ref() and other values ' + diff --git a/css/css-typed-om/the-stylepropertymap/inline/append.tentative.html b/css/css-typed-om/the-stylepropertymap/inline/append.tentative.html index 36c14d76b6e205..ee9a9e4ddbcf78 100644 --- a/css/css-typed-om/the-stylepropertymap/inline/append.tentative.html +++ b/css/css-typed-om/the-stylepropertymap/inline/append.tentative.html @@ -24,7 +24,7 @@ for (const {property, values, desc} of gInvalidTestCases) { test(t => { let styleMap = createInlineStyleMap(t, ''); - assert_throws(new TypeError(), () => styleMap.append(property, ...values)); + assert_throws_js(TypeError, () => styleMap.append(property, ...values)); }, 'Calling StylePropertyMap.append with ' + desc + ' throws TypeError'); } diff --git a/css/css-typed-om/the-stylepropertymap/inline/delete-invalid.html b/css/css-typed-om/the-stylepropertymap/inline/delete-invalid.html index cc2657ecbdc4f0..a4f1b620b03e31 100644 --- a/css/css-typed-om/the-stylepropertymap/inline/delete-invalid.html +++ b/css/css-typed-om/the-stylepropertymap/inline/delete-invalid.html @@ -12,7 +12,7 @@ test(t => { let styleMap = createInlineStyleMap(t, ''); - assert_throws(new TypeError(), () => styleMap.delete('lemon')); + assert_throws_js(TypeError, () => styleMap.delete('lemon')); }, 'Deleting an unsupported property name throws a TypeError'); diff --git a/css/css-typed-om/the-stylepropertymap/inline/get-invalid.html b/css/css-typed-om/the-stylepropertymap/inline/get-invalid.html index b847567008ccdc..07f4a6dc7c42f7 100644 --- a/css/css-typed-om/the-stylepropertymap/inline/get-invalid.html +++ b/css/css-typed-om/the-stylepropertymap/inline/get-invalid.html @@ -12,7 +12,7 @@ test(t => { const styleMap = createInlineStyleMap(t); - assert_throws(new TypeError(), () => styleMap.get('lemon')); + assert_throws_js(TypeError, () => styleMap.get('lemon')); }, 'Calling StylePropertyMap.get with an unsupported property throws a TypeError'); diff --git a/css/css-typed-om/the-stylepropertymap/inline/getAll.tentative.html b/css/css-typed-om/the-stylepropertymap/inline/getAll.tentative.html index c7e370086db8ff..935417ddcc0226 100644 --- a/css/css-typed-om/the-stylepropertymap/inline/getAll.tentative.html +++ b/css/css-typed-om/the-stylepropertymap/inline/getAll.tentative.html @@ -11,7 +11,7 @@ test(t => { const styleMap = createInlineStyleMap(t); - assert_throws(new TypeError(), () => styleMap.getAll('lemon')); + assert_throws_js(TypeError, () => styleMap.getAll('lemon')); }, 'Calling StylePropertyMap.getAll with an unsupported property throws a TypeError'); test(t => { diff --git a/css/css-typed-om/the-stylepropertymap/inline/has.tentative.html b/css/css-typed-om/the-stylepropertymap/inline/has.tentative.html index d2528831d85305..0427d5a606a73c 100644 --- a/css/css-typed-om/the-stylepropertymap/inline/has.tentative.html +++ b/css/css-typed-om/the-stylepropertymap/inline/has.tentative.html @@ -11,7 +11,7 @@ test(t => { const styleMap = createInlineStyleMap(t); - assert_throws(new TypeError(), () => styleMap.has('lemon')); + assert_throws_js(TypeError, () => styleMap.has('lemon')); }, 'Calling StylePropertyMap.has with an unsupported property throws a TypeError'); const gTestCases = [ diff --git a/css/css-typed-om/the-stylepropertymap/inline/set-shorthand.html b/css/css-typed-om/the-stylepropertymap/inline/set-shorthand.html index e00d07cc502874..87ecadcb75c7c3 100644 --- a/css/css-typed-om/the-stylepropertymap/inline/set-shorthand.html +++ b/css/css-typed-om/the-stylepropertymap/inline/set-shorthand.html @@ -17,7 +17,7 @@ for (const {property, values, desc} of gInvalidTestCases) { test(t => { let styleMap = createInlineStyleMap(t, ''); - assert_throws(new TypeError(), () => styleMap.set(property, ...values)); + assert_throws_js(TypeError, () => styleMap.set(property, ...values)); }, 'Setting a shorthand with ' + desc + ' on inline style throws TypeError'); } diff --git a/css/css-typed-om/the-stylepropertymap/inline/set.tentative.html b/css/css-typed-om/the-stylepropertymap/inline/set.tentative.html index 411323a2f0c70b..048ad87e8b1360 100644 --- a/css/css-typed-om/the-stylepropertymap/inline/set.tentative.html +++ b/css/css-typed-om/the-stylepropertymap/inline/set.tentative.html @@ -19,23 +19,23 @@ for (const {property, values, desc} of gInvalidTestCases) { test(t => { let styleMap = createInlineStyleMap(t, ''); - assert_throws(new TypeError(), () => styleMap.set(property, ...values)); + assert_throws_js(TypeError, () => styleMap.set(property, ...values)); }, 'Setting a StylePropertyMap with ' + desc + ' throws TypeError'); } test(t => { let styleMap = createInlineStyleMap(t, ''); - assert_throws(new TypeError(), () => styleMap.set('width', CSS.px(10), CSS.px(10))); + assert_throws_js(TypeError, () => styleMap.set('width', CSS.px(10), CSS.px(10))); }, 'Setting a non list-valued property with multiple arguments throws TypeError'); test(t => { let styleMap = createInlineStyleMap(t, ''); - assert_throws(new TypeError(), () => styleMap.set('width', '1s, 2s')); + assert_throws_js(TypeError, () => styleMap.set('width', '1s, 2s')); }, 'Setting a non list-valued property with list-valued string throws TypeError'); test(t => { let styleMap = createInlineStyleMap(t, ''); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { styleMap.set('transition-duration', '1s', new CSSUnparsedValue([])); }); }, 'Setting a list-valued property with a CSSUnparsedValue and other ' + @@ -43,7 +43,7 @@ test(t => { let styleMap = createInlineStyleMap(t, ''); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { styleMap.set('transition-duration', '1s', 'var(--A)'); }); }, 'Setting a list-valued property with a var ref() and other values ' + diff --git a/css/css-typed-om/the-stylepropertymap/properties/resources/testsuite.js b/css/css-typed-om/the-stylepropertymap/properties/resources/testsuite.js index 3ca0b55f3f111b..27042c787a1bfc 100644 --- a/css/css-typed-om/the-stylepropertymap/properties/resources/testsuite.js +++ b/css/css-typed-om/the-stylepropertymap/properties/resources/testsuite.js @@ -357,7 +357,7 @@ function testPropertyInvalid(propertyName, examples, description) { test(t => { let styleMap = createInlineStyleMap(t); for (const example of examples) { - assert_throws(new TypeError(), () => styleMap.set(propertyName, example.input)); + assert_throws_js(TypeError, () => styleMap.set(propertyName, example.input)); } }, `Setting '${propertyName}' to ${description} throws TypeError`); } diff --git a/css/cssom-view/elementFromPoint-parameters.html b/css/cssom-view/elementFromPoint-parameters.html index 899e411bdd302f..35afec994ee4b4 100644 --- a/css/cssom-view/elementFromPoint-parameters.html +++ b/css/cssom-view/elementFromPoint-parameters.html @@ -7,10 +7,10 @@ diff --git a/css/filter-effects/svgfeblendelement-mode-001.html b/css/filter-effects/svgfeblendelement-mode-001.html index 8c9e3ea05805a5..f27a23f51a2976 100644 --- a/css/filter-effects/svgfeblendelement-mode-001.html +++ b/css/filter-effects/svgfeblendelement-mode-001.html @@ -57,15 +57,15 @@ assert_equals(element.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN); assert_equals(element.getAttribute('mode'), "lighten"); - assert_throws(new TypeError(), function() { element.mode.baseVal = 17; }); + assert_throws_js(TypeError, function() { element.mode.baseVal = 17; }); assert_equals(element.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN); assert_equals(element.getAttribute('mode'), "lighten"); - assert_throws(new TypeError(), function() { element.mode.baseVal = -1; }); + assert_throws_js(TypeError, function() { element.mode.baseVal = -1; }); assert_equals(element.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN); assert_equals(element.getAttribute('mode'), "lighten"); - assert_throws(new TypeError(), function() { element.mode.baseVal = 0; }); + assert_throws_js(TypeError, function() { element.mode.baseVal = 0; }); assert_equals(element.mode.baseVal, SVGFEBlendElement.SVG_FEBLEND_MODE_LIGHTEN); assert_equals(element.getAttribute('mode'), "lighten"); }, document.title + ", setter, invalid value"); diff --git a/css/geometry/DOMMatrix-001.html b/css/geometry/DOMMatrix-001.html index a42adb4425f43b..d1a33455f5c32e 100644 --- a/css/geometry/DOMMatrix-001.html +++ b/css/geometry/DOMMatrix-001.html @@ -195,7 +195,7 @@ [], // 0 elements ].forEach(function(sequence) { test(function() { - assert_throws(new TypeError(), function() { new self[constr](sequence); }); + assert_throws_js(TypeError, function() { new self[constr](sequence); }); }, `new ${constr}(sequence) ${sequence.length} elements`); }); }); diff --git a/css/geometry/DOMMatrix-css-string.worker.js b/css/geometry/DOMMatrix-css-string.worker.js index 42f919d3f09c07..d11638b26a664b 100644 --- a/css/geometry/DOMMatrix-css-string.worker.js +++ b/css/geometry/DOMMatrix-css-string.worker.js @@ -5,12 +5,12 @@ importScripts("/resources/testharness.js"); ['DOMMatrix', 'DOMMatrixReadOnly'].forEach(constr => { test(() => { assert_true(constr in self, `${constr} should exist`); - assert_throws(new TypeError(), () => new self[constr]('matrix(1,0,0,1,0,0)') ); + assert_throws_js(TypeError, () => new self[constr]('matrix(1,0,0,1,0,0)') ); }, `${constr} constructor with string argument in worker`); test(() => { assert_true(constr in self, `${constr} should exist`); - assert_throws(new TypeError(), () => new self[constr]('') ); + assert_throws_js(TypeError, () => new self[constr]('') ); }, `${constr} constructor with empty string argument in worker`); test(() => { diff --git a/css/geometry/DOMMatrix2DInit-validate-fixup.html b/css/geometry/DOMMatrix2DInit-validate-fixup.html index 7ef4ca8b0605f7..480d67a481d309 100644 --- a/css/geometry/DOMMatrix2DInit-validate-fixup.html +++ b/css/geometry/DOMMatrix2DInit-validate-fixup.html @@ -51,11 +51,11 @@ ].forEach(dict => { test(() => { ctx.resetTransform(); - assert_throws(new TypeError(), () => ctx.setTransform(dict)); + assert_throws_js(TypeError, () => ctx.setTransform(dict)); }, `setTransform(${format_dict(dict)}) (invalid)`); test(() => { - assert_throws(new TypeError(), () => drawRectWithAddPathTransform(ctx, dict)); + assert_throws_js(TypeError, () => drawRectWithAddPathTransform(ctx, dict)); }, `addPath(${format_dict(dict)}) (invalid)`); }); diff --git a/css/geometry/DOMMatrixInit-validate-fixup.html b/css/geometry/DOMMatrixInit-validate-fixup.html index 8835c1ba48a7d2..b89b75205eb1f8 100644 --- a/css/geometry/DOMMatrixInit-validate-fixup.html +++ b/css/geometry/DOMMatrixInit-validate-fixup.html @@ -27,7 +27,7 @@ ].forEach(dict => { test(() => { assert_true('fromMatrix' in DOMMatrix, 'fromMatrix should exist'); - assert_throws(new TypeError(), () => DOMMatrix.fromMatrix(dict)); + assert_throws_js(TypeError, () => DOMMatrix.fromMatrix(dict)); }, `${format_dict(dict)} (invalid)`); }); diff --git a/css/geometry/DOMPoint-002.html b/css/geometry/DOMPoint-002.html index b7f5a911772b21..96276d86f5aada 100644 --- a/css/geometry/DOMPoint-002.html +++ b/css/geometry/DOMPoint-002.html @@ -78,7 +78,7 @@ },'test DOMPoint matrixTransform'); test(function() { var point = new DOMPoint(42, 84); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { point.matrixTransform({ is2D: true, m33: 1.0000001 }); }); },'test DOMPoint matrixTransform with inconsistent input'); diff --git a/css/geometry/DOMQuad-001.html b/css/geometry/DOMQuad-001.html index 38c54285d94b51..331bb6159563d2 100644 --- a/css/geometry/DOMQuad-001.html +++ b/css/geometry/DOMQuad-001.html @@ -28,19 +28,19 @@ checkDOMQuad(function() { return new DOMQuad(); }, initial, 'testConstructor0'); test(function() { - assert_throws(new TypeError(), function() { new DOMQuad(1); }); + assert_throws_js(TypeError, function() { new DOMQuad(1); }); },'testConstructor1'); test(function() { - assert_throws(new TypeError(), function() { new DOMQuad(1, 2); }); + assert_throws_js(TypeError, function() { new DOMQuad(1, 2); }); },'testConstructor2'); test(function() { - assert_throws(new TypeError(), function() { new DOMQuad(1, 2, 3); }); + assert_throws_js(TypeError, function() { new DOMQuad(1, 2, 3); }); },'testConstructor3'); test(function() { - assert_throws(new TypeError(), function() { new DOMQuad(1, 2, 3, 4); }); + assert_throws_js(TypeError, function() { new DOMQuad(1, 2, 3, 4); }); },'testConstructor4'); checkDOMQuad( @@ -85,7 +85,7 @@ checkDOMQuad(function() { return new DOMQuad({}, {}, {}, {}, NaN); }, initial, 'testConstructor14'); test(function() { - assert_throws(new TypeError(), function() { new DOMQuad({}, {}, {}, NaN); }); + assert_throws_js(TypeError, function() { new DOMQuad({}, {}, {}, NaN); }); },'testConstructor15'); checkDOMQuad(function() { diff --git a/css/geometry/DOMQuad-002.html b/css/geometry/DOMQuad-002.html index 9e3ef98895ad0f..5734be1f2938a2 100644 --- a/css/geometry/DOMQuad-002.html +++ b/css/geometry/DOMQuad-002.html @@ -73,15 +73,15 @@ },'test Constructor with four DOMPoint args'); test(function() { - assert_throws(new TypeError(), function() { new DOMQuad(1, 2, 3, 4); }); + assert_throws_js(TypeError, function() { new DOMQuad(1, 2, 3, 4); }); },'test Constructor with invaild integer args'); test(function() { - assert_throws(new TypeError(), function() { new DOMQuad("1", "2", "3", "4"); }); + assert_throws_js(TypeError, function() { new DOMQuad("1", "2", "3", "4"); }); },'test Constructor with invaild string args'); test(function() { - assert_throws(new TypeError(), function() { new DOMQuad({}, {}, {}, NaN); }); + assert_throws_js(TypeError, function() { new DOMQuad({}, {}, {}, NaN); }); },'test Constructor with NaN'); test(function() { diff --git a/custom-elements/form-associated/ElementInternals-validation.html b/custom-elements/form-associated/ElementInternals-validation.html index d71161476918a3..277ee22550f9fa 100644 --- a/custom-elements/form-associated/ElementInternals-validation.html +++ b/custom-elements/form-associated/ElementInternals-validation.html @@ -115,7 +115,7 @@ assert_true(validity.valid); assert_equals(control.i.validationMessage, ''); - assert_throws(new TypeError(), () => { control.i.setValidity({valueMissing: true}); }, + assert_throws_js(TypeError, () => { control.i.setValidity({valueMissing: true}); }, 'setValidity() requires the second argument if the first argument contains true'); }, 'validity and setValidity()'); diff --git a/dom/collections/HTMLCollection-as-prototype.html b/dom/collections/HTMLCollection-as-prototype.html index 75546a77c5e5b0..d572d35c041496 100644 --- a/dom/collections/HTMLCollection-as-prototype.html +++ b/dom/collections/HTMLCollection-as-prototype.html @@ -7,7 +7,7 @@ diff --git a/dom/nodes/Node-replaceChild.html b/dom/nodes/Node-replaceChild.html index 3c289a4c14d018..33bea1f2397768 100644 --- a/dom/nodes/Node-replaceChild.html +++ b/dom/nodes/Node-replaceChild.html @@ -15,15 +15,15 @@ // IDL. test(function() { var a = document.createElement("div"); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { a.replaceChild(null, null); }); var b = document.createElement("div"); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { a.replaceChild(b, null); }); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { a.replaceChild(null, b); }); }, "Passing null to replaceChild should throw a TypeError.") diff --git a/dom/nodes/insert-adjacent.html b/dom/nodes/insert-adjacent.html index 247b7d1742b398..447f156d35b88e 100644 --- a/dom/nodes/insert-adjacent.html +++ b/dom/nodes/insert-adjacent.html @@ -43,7 +43,7 @@ }); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { el.insertAdjacentElement('afterbegin', document.implementation.createDocumentType("html")) }) diff --git a/dom/ranges/Range-comparePoint-2.html b/dom/ranges/Range-comparePoint-2.html index 356c8d351fb0a9..99403eee906364 100644 --- a/dom/ranges/Range-comparePoint-2.html +++ b/dom/ranges/Range-comparePoint-2.html @@ -13,7 +13,7 @@ }) test(function() { var r = document.createRange(); - assert_throws(new TypeError(), function() { r.comparePoint(null, 0) }) + assert_throws_js(TypeError, function() { r.comparePoint(null, 0) }) }) test(function() { var doc = document.implementation.createHTMLDocument("tralala") diff --git a/dom/ranges/Range-intersectsNode-binding.html b/dom/ranges/Range-intersectsNode-binding.html index 729388428ec31f..57d159b03035e5 100644 --- a/dom/ranges/Range-intersectsNode-binding.html +++ b/dom/ranges/Range-intersectsNode-binding.html @@ -8,18 +8,18 @@ diff --git a/dom/traversal/TreeWalker-acceptNode-filter.html b/dom/traversal/TreeWalker-acceptNode-filter.html index 5d521f016f4949..0e5c0c3cd0056d 100644 --- a/dom/traversal/TreeWalker-acceptNode-filter.html +++ b/dom/traversal/TreeWalker-acceptNode-filter.html @@ -88,18 +88,18 @@ test(function() { var walker = document.createTreeWalker(testElement, NodeFilter.SHOW_ELEMENT, {}); - assert_throws(new TypeError(), function () { walker.firstChild(); }); + assert_throws_js(TypeError, function () { walker.firstChild(); }); assert_node(walker.currentNode, { type: Element, id: 'root' }); - assert_throws(new TypeError(), function () { walker.nextNode(); }); + assert_throws_js(TypeError, function () { walker.nextNode(); }); assert_node(walker.currentNode, { type: Element, id: 'root' }); }, 'Testing with object lacking acceptNode property'); test(function() { var walker = document.createTreeWalker(testElement, NodeFilter.SHOW_ELEMENT, { acceptNode: "foo" }); - assert_throws(new TypeError(), function () { walker.firstChild(); }); + assert_throws_js(TypeError, function () { walker.firstChild(); }); assert_node(walker.currentNode, { type: Element, id: 'root' }); - assert_throws(new TypeError(), function () { walker.nextNode(); }); + assert_throws_js(TypeError, function () { walker.nextNode(); }); assert_node(walker.currentNode, { type: Element, id: 'root' }); }, 'Testing with object with non-function acceptNode property'); diff --git a/dom/traversal/TreeWalker-basic.html b/dom/traversal/TreeWalker-basic.html index 100cb10de3e912..4e14ac421ef5e9 100644 --- a/dom/traversal/TreeWalker-basic.html +++ b/dom/traversal/TreeWalker-basic.html @@ -106,11 +106,11 @@ test(function () { - assert_throws(new TypeError(), function () { document.createTreeWalker(); }); - assert_throws(new TypeError(), function () { document.createTreeWalker(null); }); - assert_throws(new TypeError(), function () { document.createTreeWalker(undefined); }); - assert_throws(new TypeError(), function () { document.createTreeWalker(new Object()); }); - assert_throws(new TypeError(), function () { document.createTreeWalker(1); }); + assert_throws_js(TypeError, function () { document.createTreeWalker(); }); + assert_throws_js(TypeError, function () { document.createTreeWalker(null); }); + assert_throws_js(TypeError, function () { document.createTreeWalker(undefined); }); + assert_throws_js(TypeError, function () { document.createTreeWalker(new Object()); }); + assert_throws_js(TypeError, function () { document.createTreeWalker(1); }); }, 'Give an invalid root node to document.createTreeWalker().'); test(function () diff --git a/domparsing/DOMParser-parseFromString-html.html b/domparsing/DOMParser-parseFromString-html.html index 2660d1d6c87ab6..5e1dd1291decf4 100644 --- a/domparsing/DOMParser-parseFromString-html.html +++ b/domparsing/DOMParser-parseFromString-html.html @@ -72,7 +72,7 @@ }, 'DOMParser should handle the content of as raw text'); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new DOMParser().parseFromString("", "text/foo-this-is-invalid"); }) }, "DOMParser throws on an invalid enum value") diff --git a/domparsing/createContextualFragment.html b/domparsing/createContextualFragment.html index a885a5dcb5ab14..170c0c464d90fb 100644 --- a/domparsing/createContextualFragment.html +++ b/domparsing/createContextualFragment.html @@ -17,7 +17,7 @@ test(function() { var range = document.createRange(); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { range.createContextualFragment(); }); }, "Must throw TypeError when calling without arguments"); diff --git a/domxpath/evaluator-constructor.html b/domxpath/evaluator-constructor.html index 8239d9c395e3c9..8350ceb4499d57 100644 --- a/domxpath/evaluator-constructor.html +++ b/domxpath/evaluator-constructor.html @@ -11,6 +11,6 @@ assert_true(x instanceof XPathEvaluator); }, "Constructor with 'new'"); test(function() { - assert_throws(new TypeError(), "var x = XPathEvaluator()"); + assert_throws_js(TypeError, "var x = XPathEvaluator()"); }, "Constructor without 'new'"); </script> diff --git a/domxpath/lexical-structure.html b/domxpath/lexical-structure.html index f93820b0e4176d..05961ab226bbfd 100644 --- a/domxpath/lexical-structure.html +++ b/domxpath/lexical-structure.html @@ -13,17 +13,17 @@ parse(' \'a"bc\' '); parse(' "a\'bc" '); - assert_throws(new SyntaxError(), () => { parse(' \u2019xyz\u2019 '); }); + assert_throws_dom('SyntaxError', () => { parse(' \u2019xyz\u2019 '); }); }, 'Literal: Only \' and " should be handled as literal quotes.'); // https://www.w3.org/TR/1999/REC-xpath-19991116/#NT-ExprWhitespace test(() => { parse(' \t\r\n.\r\n\t '); - assert_throws(new SyntaxError(), () => { parse('\x0B\x0C .'); }); - assert_throws(new SyntaxError(), () => { parse('\x0E\x0F .'); }); - assert_throws(new SyntaxError(), () => { parse('\u3000 .'); }); - assert_throws(new SyntaxError(), () => { parse('\u2029 .'); }); + assert_throws_dom('SyntaxError', () => { parse('\x0B\x0C .'); }); + assert_throws_dom('SyntaxError', () => { parse('\x0E\x0F .'); }); + assert_throws_dom('SyntaxError', () => { parse('\u3000 .'); }); + assert_throws_dom('SyntaxError', () => { parse('\u2029 .'); }); }, 'ExprWhitespace: Only #x20 #x9 #xD or #xA must be handled as a whitespace.'); </script> </body> diff --git a/encoding/api-invalid-label.any.js b/encoding/api-invalid-label.any.js index 38c0e9a55fd480..2dafb67c07d464 100644 --- a/encoding/api-invalid-label.any.js +++ b/encoding/api-invalid-label.any.js @@ -19,6 +19,6 @@ setup(function() { tests.forEach(function(input) { test(function() { - assert_throws(new RangeError(), function() { new TextDecoder(input); }); + assert_throws_js(RangeError, function() { new TextDecoder(input); }); }, 'Invalid label ' + format_value(input) + ' should be rejected by TextDecoder.'); }); diff --git a/encoding/api-replacement-encodings.any.js b/encoding/api-replacement-encodings.any.js index 6d1e494ac3979b..9031cf6638cad8 100644 --- a/encoding/api-replacement-encodings.any.js +++ b/encoding/api-replacement-encodings.any.js @@ -7,7 +7,7 @@ encodings_table.forEach(function(section) { }).forEach(function(encoding) { encoding.labels.forEach(function(label) { test(function() { - assert_throws(new RangeError(), function() { new TextDecoder(label); }); + assert_throws_js(RangeError, function() { new TextDecoder(label); }); }, 'Label for "replacement" should be rejected by API: ' + label); }); }); diff --git a/encoding/encodeInto.any.js b/encoding/encodeInto.any.js index 7ea0b80eeb458d..7e18c812499a52 100644 --- a/encoding/encodeInto.any.js +++ b/encoding/encodeInto.any.js @@ -128,14 +128,14 @@ Float64Array].forEach(view => { ["ArrayBuffer", "SharedArrayBuffer"].forEach((arrayBufferOrSharedArrayBuffer) => { test(() => { - assert_throws(new TypeError(), () => new TextEncoder().encodeInto("", new view(new self[arrayBufferOrSharedArrayBuffer](0)))); + assert_throws_js(TypeError, () => new TextEncoder().encodeInto("", new view(new self[arrayBufferOrSharedArrayBuffer](0)))); }, "Invalid encodeInto() destination: " + view.name + ", backed by: " + arrayBufferOrSharedArrayBuffer); }); }); ["ArrayBuffer", "SharedArrayBuffer"].forEach((arrayBufferOrSharedArrayBuffer) => { test(() => { - assert_throws(new TypeError(), () => new TextEncoder().encodeInto("", new self[arrayBufferOrSharedArrayBuffer](10))); + assert_throws_js(TypeError, () => new TextEncoder().encodeInto("", new self[arrayBufferOrSharedArrayBuffer](10))); }, "Invalid encodeInto() destination: " + arrayBufferOrSharedArrayBuffer); }); diff --git a/encoding/streams/decode-attributes.any.js b/encoding/streams/decode-attributes.any.js index 21b70201271a20..3fe442bf133c74 100644 --- a/encoding/streams/decode-attributes.any.js +++ b/encoding/streams/decode-attributes.any.js @@ -46,25 +46,25 @@ for (const trueValue of [true, 1, {}, [], 'yes']) { } test(() => { - assert_throws(new RangeError(), () => new TextDecoderStream(''), + assert_throws_js(RangeError, () => new TextDecoderStream(''), 'the constructor should throw'); }, 'constructing with an invalid encoding should throw'); test(() => { - assert_throws(new TypeError(), () => new TextDecoderStream({ + assert_throws_js(TypeError, () => new TextDecoderStream({ toString() { return {}; } }), 'the constructor should throw'); }, 'constructing with a non-stringifiable encoding should throw'); test(() => { - assert_throws(new Error(), + assert_throws_js(Error, () => new TextDecoderStream('utf-8', { get fatal() { throw new Error(); } }), 'the constructor should throw'); }, 'a throwing fatal member should cause the constructor to throw'); test(() => { - assert_throws(new Error(), + assert_throws_js(Error, () => new TextDecoderStream('utf-8', { get ignoreBOM() { throw new Error(); } }), 'the constructor should throw'); diff --git a/encoding/textdecoder-fatal-single-byte.any.js b/encoding/textdecoder-fatal-single-byte.any.js index d3e9ae9c9a7774..87e3707be4bfee 100644 --- a/encoding/textdecoder-fatal-single-byte.any.js +++ b/encoding/textdecoder-fatal-single-byte.any.js @@ -37,7 +37,7 @@ singleByteEncodings.forEach(function(t) { for (var i = 0; i < 256; ++i) { if (t.bad.indexOf(i) != -1) { test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new TextDecoder(t.encoding, {fatal: true}).decode(new Uint8Array([i])); }); }, 'Throw due to fatal flag: ' + t.encoding + ' doesn\'t have a pointer ' + i); diff --git a/encoding/textdecoder-fatal-streaming.any.js b/encoding/textdecoder-fatal-streaming.any.js index e4fa64dbd7c433..0d58b2e1d7d8a1 100644 --- a/encoding/textdecoder-fatal-streaming.any.js +++ b/encoding/textdecoder-fatal-streaming.any.js @@ -7,7 +7,7 @@ test(function() { {encoding: 'utf-16be', sequence: [0x00]} ].forEach(function(testCase) { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { var decoder = new TextDecoder(testCase.encoding, {fatal: true}); decoder.decode(new Uint8Array(testCase.sequence)); }, 'Unterminated ' + testCase.encoding + ' sequence should throw if fatal flag is set'); @@ -28,12 +28,12 @@ test(function() { assert_equals(decoder.decode(odd, {stream: true}), ''); assert_equals(decoder.decode(odd), '\u0000'); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { decoder.decode(even, {stream: true}); decoder.decode(odd) }); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { decoder.decode(odd, {stream: true}); decoder.decode(even); }); diff --git a/encoding/textdecoder-fatal.any.js b/encoding/textdecoder-fatal.any.js index ba8aa5d06c3e2d..5ee4b65ebe3dfd 100644 --- a/encoding/textdecoder-fatal.any.js +++ b/encoding/textdecoder-fatal.any.js @@ -51,7 +51,7 @@ var bad = [ bad.forEach(function(t) { test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new TextDecoder(t.encoding, {fatal: true}).decode(new Uint8Array(t.input)) }); }, 'Fatal flag: ' + t.encoding + ' - ' + t.name); diff --git a/encoding/textdecoder-utf16-surrogates.any.js b/encoding/textdecoder-utf16-surrogates.any.js index 3b8418703da77d..b08ea56cee38a2 100644 --- a/encoding/textdecoder-utf16-surrogates.any.js +++ b/encoding/textdecoder-utf16-surrogates.any.js @@ -38,7 +38,7 @@ bad.forEach(function(t) { assert_equals(new TextDecoder(t.encoding).decode(new Uint8Array(t.input)), t.expected); }, t.encoding + ' - ' + t.name); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new TextDecoder(t.encoding, {fatal: true}).decode(new Uint8Array(t.input)) }); }, t.encoding + ' - ' + t.name + ' (fatal flag set)'); diff --git a/fetch/api/headers/headers-basic.html b/fetch/api/headers/headers-basic.html index 1d3f4d462b89f6..254ef051c1227c 100644 --- a/fetch/api/headers/headers-basic.html +++ b/fetch/api/headers/headers-basic.html @@ -25,7 +25,7 @@ var parameters = [null, 1]; parameters.forEach(function(parameter) { test(function() { - assert_throws(new TypeError(), function() { new Headers(parameter) }); + assert_throws_js(TypeError, function() { new Headers(parameter) }); }, "Create headers with " + parameter + " should throw"); }); diff --git a/fetch/api/headers/headers-errors.html b/fetch/api/headers/headers-errors.html index 194ff32f1559f2..7f9916d87fe2ac 100644 --- a/fetch/api/headers/headers-errors.html +++ b/fetch/api/headers/headers-errors.html @@ -12,19 +12,19 @@ <script> test(function() { - assert_throws(new TypeError() , function() { new Headers([["name"]]); }); + assert_throws_js(TypeError, function() { new Headers([["name"]]); }); }, "Create headers giving an array having one string as init argument"); test(function() { - assert_throws(new TypeError() , function() { new Headers([["invalid", "invalidValue1", "invalidValue2"]]); }); + assert_throws_js(TypeError, function() { new Headers([["invalid", "invalidValue1", "invalidValue2"]]); }); }, "Create headers giving an array having three strings as init argument"); test(function() { - assert_throws(new TypeError() , function() { new Headers([["invalidĀ", "Value1"]]); }); + assert_throws_js(TypeError, function() { new Headers([["invalidĀ", "Value1"]]); }); }, "Create headers giving bad header name as init argument"); test(function() { - assert_throws(new TypeError() , function() { new Headers([["name", "invalidValueĀ"]]); }); + assert_throws_js(TypeError, function() { new Headers([["name", "invalidValueĀ"]]); }); }, "Create headers giving bad header value as init argument"); var badNames = ["invalidĀ", {}]; @@ -33,57 +33,57 @@ badNames.forEach(function(name) { test(function() { var headers = new Headers(); - assert_throws(new TypeError() , function() { headers.get(name); }); + assert_throws_js(TypeError, function() { headers.get(name); }); }, "Check headers get with an invalid name " + name); }); badNames.forEach(function(name) { test(function() { var headers = new Headers(); - assert_throws(new TypeError() , function() { headers.delete(name); }); + assert_throws_js(TypeError, function() { headers.delete(name); }); }, "Check headers delete with an invalid name " + name); }); badNames.forEach(function(name) { test(function() { var headers = new Headers(); - assert_throws(new TypeError() , function() { headers.has(name); }); + assert_throws_js(TypeError, function() { headers.has(name); }); }, "Check headers has with an invalid name " + name); }); badNames.forEach(function(name) { test(function() { var headers = new Headers(); - assert_throws(new TypeError() , function() { headers.set(name, "Value1"); }); + assert_throws_js(TypeError, function() { headers.set(name, "Value1"); }); }, "Check headers set with an invalid name " + name); }); badValues.forEach(function(value) { test(function() { var headers = new Headers(); - assert_throws(new TypeError() , function() { headers.set("name", value); }); + assert_throws_js(TypeError, function() { headers.set("name", value); }); }, "Check headers set with an invalid value " + value); }); badNames.forEach(function(name) { test(function() { var headers = new Headers(); - assert_throws(new TypeError() , function() { headers.append("invalidĀ", "Value1"); }); + assert_throws_js(TypeError, function() { headers.append("invalidĀ", "Value1"); }); }, "Check headers append with an invalid name " + name); }); badValues.forEach(function(value) { test(function() { var headers = new Headers(); - assert_throws(new TypeError() , function() { headers.append("name", value); }); + assert_throws_js(TypeError, function() { headers.append("name", value); }); }, "Check headers append with an invalid value " + value); }); test(function() { var headers = new Headers([["name", "value"]]); - assert_throws(new TypeError() , function() { headers.forEach(); }); - assert_throws(new TypeError() , function() { headers.forEach(undefined); }); - assert_throws(new TypeError() , function() { headers.forEach(1); }); + assert_throws_js(TypeError, function() { headers.forEach(); }); + assert_throws_js(TypeError, function() { headers.forEach(undefined); }); + assert_throws_js(TypeError, function() { headers.forEach(1); }); }, "Headers forEach throws if argument is not callable"); test(function() { diff --git a/fetch/api/headers/headers-record.html b/fetch/api/headers/headers-record.html index 34acc3b1c557ce..0a217c3ddb287f 100644 --- a/fetch/api/headers/headers-record.html +++ b/fetch/api/headers/headers-record.html @@ -256,7 +256,7 @@ var proxy = new Proxy(lyingProxy, loggingHandler); // Returning duplicate keys from ownKeys() throws a TypeError. - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { var h = new Headers(proxy); }); assert_equals(log.length, 2); @@ -279,7 +279,7 @@ }, c: "d" }; var proxy = new Proxy(record, loggingHandler); - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { var h = new Headers(proxy); }); assert_equals(log.length, 7); diff --git a/fetch/api/request/request-cache.js b/fetch/api/request/request-cache.js index 009d4408a56f60..f2fbecf4969291 100644 --- a/fetch/api/request/request-cache.js +++ b/fetch/api/request/request-cache.js @@ -154,7 +154,7 @@ function make_test(type, info) { assert_equals(text, expected_response_text(type, identifier, init, content)); }, function(reason) { if ("response" in info && info.response[idx] === "error") { - assert_throws(new TypeError(), function() { throw reason; }); + assert_throws_js(TypeError, function() { throw reason; }); } else { throw reason; } diff --git a/fetch/api/request/request-disturbed.html b/fetch/api/request/request-disturbed.html index d247a7ff2db3b8..27614e7e7428d4 100644 --- a/fetch/api/request/request-disturbed.html +++ b/fetch/api/request/request-disturbed.html @@ -40,12 +40,12 @@ test(function() { assert_true(bodyConsumed.bodyUsed , "bodyUsed is true when request is disturbed"); - assert_throws(new TypeError(), function() { bodyConsumed.clone(); }); + assert_throws_js(TypeError, function() { bodyConsumed.clone(); }); }, "Check cloning a disturbed request"); test(function() { assert_true(bodyConsumed.bodyUsed , "bodyUsed is true when request is disturbed"); - assert_throws(new TypeError(), function() { new Request(bodyConsumed); }); + assert_throws_js(TypeError, function() { new Request(bodyConsumed); }); }, "Check creating a new request from a disturbed request"); promise_test(function() { @@ -100,13 +100,13 @@ assert_false(req.bodyUsed, 'Request should not be flagged as used if it has not been ' + 'consumed.'); - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { new Request(req, {method: 'GET'}); }, 'A get request may not have body.'); assert_false(req.bodyUsed, 'After the GET case'); - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { new Request(req, {method: 'CONNECT'}); }, 'Request() with a forbidden method must throw.'); diff --git a/fetch/api/request/request-error.html b/fetch/api/request/request-error.html index 70be9fb0e7c014..622ba3f4c28c6d 100644 --- a/fetch/api/request/request-error.html +++ b/fetch/api/request/request-error.html @@ -15,8 +15,8 @@ // badRequestArgTests is from response-error.js for (const { args, testName } of badRequestArgTests) { test(() => { - assert_throws( - new TypeError(), + assert_throws_js( + TypeError, () => new Request(...args), "Expect TypeError exception" ); diff --git a/fetch/api/request/request-init-002.html b/fetch/api/request/request-init-002.html index 221b415a3c182f..14be27742208be 100644 --- a/fetch/api/request/request-init-002.html +++ b/fetch/api/request/request-init-002.html @@ -31,8 +31,8 @@ promise_test(function(test) { var request = new Request("", makeRequestInit(body, "POST")); if (body) { - assert_throws(new TypeError(), function() { new Request("", makeRequestInit(body, "GET")); }); - assert_throws(new TypeError(), function() { new Request("", makeRequestInit(body, "HEAD")); }); + assert_throws_js(TypeError, function() { new Request("", makeRequestInit(body, "GET")); }); + assert_throws_js(TypeError, function() { new Request("", makeRequestInit(body, "HEAD")); }); } else { new Request("", makeRequestInit(body, "GET")); // should not throw } diff --git a/fetch/api/request/request-init-stream.any.js b/fetch/api/request/request-init-stream.any.js index df5fb26a0d8fc0..e7ffa729d15b84 100644 --- a/fetch/api/request/request-init-stream.any.js +++ b/fetch/api/request/request-init-stream.any.js @@ -3,7 +3,7 @@ "use strict"; async function assert_request(test, input, init) { - assert_throws(new TypeError(), () => new Request(input, init), "new Request()"); + assert_throws_js(TypeError, () => new Request(input, init), "new Request()"); await promise_rejects_js(test, TypeError, fetch(input, init), "fetch()"); } diff --git a/fetch/api/request/request-keepalive.html b/fetch/api/request/request-keepalive.html index 602fabc4db3471..e165422166e953 100644 --- a/fetch/api/request/request-keepalive.html +++ b/fetch/api/request/request-keepalive.html @@ -21,7 +21,7 @@ test(() => { const init = {method: 'POST', keepalive: true, body: new ReadableStream()}; - assert_throws(new TypeError(), () => {new Request('/', init)}); + assert_throws_js(TypeError, () => {new Request('/', init)}); }, 'keepalive flag with stream body'); </script> </body> diff --git a/fetch/api/response/response-clone.html b/fetch/api/response/response-clone.html index f586c81bac7ca6..f5ebd7940e1eab 100644 --- a/fetch/api/response/response-clone.html +++ b/fetch/api/response/response-clone.html @@ -58,7 +58,7 @@ var disturbedResponse = new Response("data"); return disturbedResponse.text().then(function() { assert_true(disturbedResponse.bodyUsed, "response is disturbed"); - assert_throws(new TypeError() , function() { disturbedResponse.clone(); }, + assert_throws_js(TypeError, function() { disturbedResponse.clone(); }, "Expect TypeError exception"); }); }, "Cannot clone a disturbed response"); diff --git a/fetch/api/response/response-error.html b/fetch/api/response/response-error.html index 1e68f6d01c6c76..7cbb138345964f 100644 --- a/fetch/api/response/response-error.html +++ b/fetch/api/response/response-error.html @@ -13,7 +13,7 @@ var invalidStatus = [0, 100, 199, 600, 1000]; invalidStatus.forEach(function(status) { test(function() { - assert_throws(new RangeError() , function() { new Response("", { "status" : status }); }, + assert_throws_js(RangeError, function() { new Response("", { "status" : status }); }, "Expect RangeError exception when status is " + status); },"Throws RangeError when responseInit's status is " + status); }); @@ -21,7 +21,7 @@ var invalidStatusText = ["\n", "Ā"]; invalidStatusText.forEach(function(statusText) { test(function() { - assert_throws(new TypeError() , function() { new Response("", { "statusText" : statusText }); }, + assert_throws_js(TypeError, function() { new Response("", { "statusText" : statusText }); }, "Expect TypeError exception " + statusText); },"Throws TypeError when responseInit's statusText is " + statusText); }); @@ -29,7 +29,7 @@ var nullBodyStatus = [204, 205, 304]; nullBodyStatus.forEach(function(status) { test(function() { - assert_throws(new TypeError() , + assert_throws_js(TypeError, function() { new Response("body", {"status" : status }); }, "Expect TypeError exception "); },"Throws TypeError when building a response with body and a body status of " + status); diff --git a/fetch/api/response/response-from-stream.any.js b/fetch/api/response/response-from-stream.any.js index 93b29b42867f47..ea5192bfb10dcf 100644 --- a/fetch/api/response/response-from-stream.any.js +++ b/fetch/api/response/response-from-stream.any.js @@ -5,13 +5,13 @@ test(() => { const stream = new ReadableStream(); stream.getReader(); - assert_throws(new TypeError(), () => new Response(stream)); + assert_throws_js(TypeError, () => new Response(stream)); }, "Constructing a Response with a stream on which getReader() is called"); test(() => { const stream = new ReadableStream(); stream.getReader().read(); - assert_throws(new TypeError(), () => new Response(stream)); + assert_throws_js(TypeError, () => new Response(stream)); }, "Constructing a Response with a stream on which read() is called"); promise_test(async () => { @@ -19,5 +19,5 @@ promise_test(async () => { reader = stream.getReader(); await reader.read(); reader.releaseLock(); - assert_throws(new TypeError(), () => new Response(stream)); + assert_throws_js(TypeError, () => new Response(stream)); }, "Constructing a Response with a stream on which read() and releaseLock() are called"); diff --git a/fetch/api/response/response-static-redirect.html b/fetch/api/response/response-static-redirect.html index a7492229fd06b6..f647b6debeb893 100644 --- a/fetch/api/response/response-static-redirect.html +++ b/fetch/api/response/response-static-redirect.html @@ -37,14 +37,14 @@ test(function() { var invalidUrl = "http://:This is not an url"; - assert_throws(new TypeError(), function() { Response.redirect(invalidUrl); }, + assert_throws_js(TypeError, function() { Response.redirect(invalidUrl); }, "Expect TypeError exception"); }, "Check error returned when giving invalid url to redirect()"); var invalidRedirectStatus = [200, 309, 400, 500]; invalidRedirectStatus.forEach(function(invalidStatus) { test(function() { - assert_throws(new RangeError() , function() { Response.redirect(url, invalidStatus); }, + assert_throws_js(RangeError, function() { Response.redirect(url, invalidStatus); }, "Expect RangeError exception"); }, "Check error returned when giving invalid status to redirect(), status = " + invalidStatus); }); diff --git a/fetch/api/response/response-stream-disturbed-5.html b/fetch/api/response/response-stream-disturbed-5.html index 546b7b88801e8e..830a41bc809620 100644 --- a/fetch/api/response/response-stream-disturbed-5.html +++ b/fetch/api/response/response-stream-disturbed-5.html @@ -16,7 +16,7 @@ return fetch("../resources/data.json").then(function(response) { response.blob(); assert_not_equals(response.body, null); - assert_throws(new TypeError(), function() { response.body.getReader(); }); + assert_throws_js(TypeError, function() { response.body.getReader(); }); }); }, "Getting a body reader after consuming as blob"); @@ -24,7 +24,7 @@ return fetch("../resources/data.json").then(function(response) { response.text(); assert_not_equals(response.body, null); - assert_throws(new TypeError(), function() { response.body.getReader(); }); + assert_throws_js(TypeError, function() { response.body.getReader(); }); }); }, "Getting a body reader after consuming as text"); @@ -32,7 +32,7 @@ return fetch("../resources/data.json").then(function(response) { response.json(); assert_not_equals(response.body, null); - assert_throws(new TypeError(), function() { response.body.getReader(); }); + assert_throws_js(TypeError, function() { response.body.getReader(); }); }); }, "Getting a body reader after consuming as json"); @@ -40,7 +40,7 @@ return fetch("../resources/data.json").then(function(response) { response.arrayBuffer(); assert_not_equals(response.body, null); - assert_throws(new TypeError(), function() { response.body.getReader(); }); + assert_throws_js(TypeError, function() { response.body.getReader(); }); }); }, "Getting a body reader after consuming as arrayBuffer"); diff --git a/fetch/http-cache/http-cache.js b/fetch/http-cache/http-cache.js index ce49ad853631c3..2ab51165f359b7 100644 --- a/fetch/http-cache/http-cache.js +++ b/fetch/http-cache/http-cache.js @@ -59,7 +59,7 @@ function makeFetchFunctions(requests, uuid) { .then(makeCheckResponse(idx, config)) .then(makeCheckResponseBody(config, uuid), function (reason) { if ('expected_type' in config && config.expected_type === 'error') { - assert_throws(new TypeError(), function () { throw reason }) + assert_throws_js(TypeError, function () { throw reason }) } else { throw reason } diff --git a/fullscreen/rendering/fullscreen-pseudo-class-support.html b/fullscreen/rendering/fullscreen-pseudo-class-support.html index ccd3f0e22be91d..fb2ff318b9ed79 100644 --- a/fullscreen/rendering/fullscreen-pseudo-class-support.html +++ b/fullscreen/rendering/fullscreen-pseudo-class-support.html @@ -12,8 +12,8 @@ // would fail. test(t => { // precondition is to throw for unknown pseudo-classes: - assert_throws(new SyntaxError(), () => document.body.matches(':halfscreen')); - assert_throws(new SyntaxError(), () => document.querySelector(':halfscreen')); + assert_throws_dom("SyntaxError", () => document.body.matches(':halfscreen')); + assert_throws_dom("SyntaxError", () => document.querySelector(':halfscreen')); // the actual test: assert_false(document.body.matches(':fullscreen')); assert_equals(document.querySelector(':fullscreen'), null); diff --git a/generic-sensor/generic-sensor-tests.js b/generic-sensor/generic-sensor-tests.js index f0d37fb9f24b68..276484ce03c582 100644 --- a/generic-sensor/generic-sensor-tests.js +++ b/generic-sensor/generic-sensor-tests.js @@ -486,7 +486,7 @@ function runGenericSensorTests(sensorName, {} ]; invalidFreqs.map(freq => { - assert_throws(new TypeError(), + assert_throws_js(TypeError, () => { new sensorType({frequency: freq}) }, `when freq is ${freq}`); }); @@ -538,7 +538,7 @@ function runGenericSensorTests(sensorName, true ]; invalidRefFrames.map(refFrame => { - assert_throws(new TypeError(), + assert_throws_js(TypeError, () => { new sensorType({referenceFrame: refFrame}) }, `when refFrame is ${refFrame}`); }); diff --git a/geolocation-API/getCurrentPosition_TypeError.html b/geolocation-API/getCurrentPosition_TypeError.html index a2e578469793d7..6726e8ab6c7d89 100644 --- a/geolocation-API/getCurrentPosition_TypeError.html +++ b/geolocation-API/getCurrentPosition_TypeError.html @@ -11,42 +11,42 @@ <script> // Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00027 test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { geo.getCurrentPosition(); }); }, 'Call getCurrentPosition without arguments, check that exception is thrown'); // Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00011 test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { geo.getCurrentPosition(null); }); }, 'Call getCurrentPosition with null success callback, check that exception is thrown'); // Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00013 test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { geo.getCurrentPosition(null, null); }); }, 'Call getCurrentPosition with null success and error callbacks, check that exception is thrown'); // Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00028 test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { geo.getCurrentPosition(3); }); }, 'Call getCurrentPosition() with wrong type for first argument. Exception expected.'); // Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00029 test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { geo.getCurrentPosition(dummyFunction, 4); }); }, 'Call getCurrentPosition() with wrong type for second argument. Exception expected.'); // Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00030 test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { geo.getCurrentPosition(dummyFunction, dummyFunction, 4); }); }, 'Call getCurrentPosition() with wrong type for third argument. Exception expected.'); diff --git a/geolocation-API/watchPosition_TypeError.html b/geolocation-API/watchPosition_TypeError.html index 9d7efd5e7b92c0..dd8287f5713ea7 100644 --- a/geolocation-API/watchPosition_TypeError.html +++ b/geolocation-API/watchPosition_TypeError.html @@ -11,42 +11,42 @@ <script> // Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00058 test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { geo.watchPosition(); }); }, 'Call watchPosition without arguments, check that exception is thrown'); // Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00015 test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { geo.watchPosition(null); }); }, 'Call watchPosition with null success callback, check that exception is thrown'); // Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00017 test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { geo.watchPosition(null, null); }); }, 'Call watchPosition with null success and error callbacks, check that exception is thrown'); // Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00059 test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { geo.watchPosition(3); }); }, 'Call watchPosition() with wrong type for first argument. Exception expected.'); // Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00060 test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { geo.watchPosition(dummyFunction, 4); }); }, 'Call watchPosition() with wrong type for second argument. Exception expected.'); // Rewrite http://dev.w3.org/geo/api/test-suite/t.html?00061 test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { geo.watchPosition(dummyFunction, dummyFunction, 4); }); }, 'Call watchPosition() with wrong type for third argument. Exception expected.'); diff --git a/html/browsers/the-window-object/window-indexed-properties-strict.html b/html/browsers/the-window-object/window-indexed-properties-strict.html index e059b12261653b..faf214d12d527c 100644 --- a/html/browsers/the-window-object/window-indexed-properties-strict.html +++ b/html/browsers/the-window-object/window-indexed-properties-strict.html @@ -20,24 +20,24 @@ }); test(function() { "use strict"; - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { window[0] = "foo"; }); - assert_throws(new TypeError(), () => Object.defineProperty(window, 0, { value: "bar" })) - assert_throws(new TypeError(), () => Object.defineProperty(window, 0, { get() { return "baz" } })) - assert_throws(new TypeError(), () => Object.defineProperty(window, 0, { set(v) { return "qux" } })) + assert_throws_js(TypeError, () => Object.defineProperty(window, 0, { value: "bar" })) + assert_throws_js(TypeError, () => Object.defineProperty(window, 0, { get() { return "baz" } })) + assert_throws_js(TypeError, () => Object.defineProperty(window, 0, { set(v) { return "qux" } })) assert_equals(window[0], document.getElementsByTagName("iframe")[0].contentWindow); - assert_throws(new TypeError(), () => delete window[0]); + assert_throws_js(TypeError, () => delete window[0]); }); test(function() { "use strict"; - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { window[1] = "foo"; }); - assert_throws(new TypeError(), () => Object.defineProperty(window, 1, { value: "bar" })) - assert_throws(new TypeError(), () => Object.defineProperty(window, 1, { get() { return "baz" } })) - assert_throws(new TypeError(), () => Object.defineProperty(window, 1, { set(v) { return "qux" } })) + assert_throws_js(TypeError, () => Object.defineProperty(window, 1, { value: "bar" })) + assert_throws_js(TypeError, () => Object.defineProperty(window, 1, { get() { return "baz" } })) + assert_throws_js(TypeError, () => Object.defineProperty(window, 1, { set(v) { return "qux" } })) assert_equals(window[1], undefined); assert_equals(Object.getOwnPropertyDescriptor(window, 1), undefined); assert_equals(delete window[1], true); diff --git a/html/browsers/the-window-object/window-indexed-properties.html b/html/browsers/the-window-object/window-indexed-properties.html index 49247179738f68..0f896cb636e973 100644 --- a/html/browsers/the-window-object/window-indexed-properties.html +++ b/html/browsers/the-window-object/window-indexed-properties.html @@ -25,18 +25,18 @@ }, "Ensure indexed properties have the correct configuration"); test(function() { window[0] = "foo"; - assert_throws(new TypeError(), () => Object.defineProperty(window, 0, { value: "bar" })) - assert_throws(new TypeError(), () => Object.defineProperty(window, 0, { get() { return "baz" } })) - assert_throws(new TypeError(), () => Object.defineProperty(window, 0, { set() { return "quz" } })) + assert_throws_js(TypeError, () => Object.defineProperty(window, 0, { value: "bar" })) + assert_throws_js(TypeError, () => Object.defineProperty(window, 0, { get() { return "baz" } })) + assert_throws_js(TypeError, () => Object.defineProperty(window, 0, { set() { return "quz" } })) assert_equals(window[0], document.getElementsByTagName("iframe")[0].contentWindow); assert_equals(delete window[0], false); }); test(function() { window[1] = "foo"; - assert_throws(new TypeError(), () => Object.defineProperty(window, 1, { value: "bar" })) - assert_throws(new TypeError(), () => Object.defineProperty(window, 1, { get() { return "baz" } })) - assert_throws(new TypeError(), () => Object.defineProperty(window, 1, { set(v) { return "quz" } })) + assert_throws_js(TypeError, () => Object.defineProperty(window, 1, { value: "bar" })) + assert_throws_js(TypeError, () => Object.defineProperty(window, 1, { get() { return "baz" } })) + assert_throws_js(TypeError, () => Object.defineProperty(window, 1, { set(v) { return "quz" } })) assert_equals(window[1], undefined); assert_equals(Object.getOwnPropertyDescriptor(window, 1), undefined); assert_equals(delete window[1], true); diff --git a/html/dom/documents/dom-tree-accessors/Document.body.html b/html/dom/documents/dom-tree-accessors/Document.body.html index f4212502956847..6eceaaf1b5c3b0 100644 --- a/html/dom/documents/dom-tree-accessors/Document.body.html +++ b/html/dom/documents/dom-tree-accessors/Document.body.html @@ -128,7 +128,7 @@ var originalBody = document.body; test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { document.body = "text" }) assert_equals(document.body, originalBody); diff --git a/html/editing/dnd/synthetic/001.html b/html/editing/dnd/synthetic/001.html index ddad72095b2453..00f93f5a286db3 100644 --- a/html/editing/dnd/synthetic/001.html +++ b/html/editing/dnd/synthetic/001.html @@ -52,7 +52,7 @@ assert_true(ranlistener); }, 'DragEvent constructor with undefined as the dataTransfer parameter should be able to fire the event' ); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { var evt = new DragEvent('dragstart', {dataTransfer:{}}); }); }, 'DragEvent constructor with custom object as the dataTransfer parameter should throw TypeError' ); diff --git a/html/editing/dnd/target-origin/001-manual.html b/html/editing/dnd/target-origin/001-manual.html index 4622c76a92f1dd..b5eaa7e11038ec 100644 --- a/html/editing/dnd/target-origin/001-manual.html +++ b/html/editing/dnd/target-origin/001-manual.html @@ -15,7 +15,7 @@ assert_true( !!e.dataTransfer.allowTargetOrigin ); }, 'allowTargetOrigin should be supported' ); test(function() { - assert_throws( new TypeError(), function () { e.dataTransfer.allowTargetOrigin(); } ); + assert_throws_js( TypeError, function () { e.dataTransfer.allowTargetOrigin(); } ); }, 'no parameter should throw TypeError' ); test(function() { assert_throws( 'SYNTAX_ERR', function () { e.dataTransfer.allowTargetOrigin(''); } ); diff --git a/html/infrastructure/common-dom-interfaces/collections/historical.html b/html/infrastructure/common-dom-interfaces/collections/historical.html index ef8345aa72420c..91142c864e94f2 100644 --- a/html/infrastructure/common-dom-interfaces/collections/historical.html +++ b/html/infrastructure/common-dom-interfaces/collections/historical.html @@ -11,7 +11,7 @@ test(function() { var collection = document.getElementById('form').elements; assert_equals(typeof collection, 'object', 'typeof'); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { collection('foo'); }); }, 'HTMLFormControlsCollection legacycaller should not be supported'); @@ -19,7 +19,7 @@ test(function() { var collection = document.getElementById('select').options; assert_equals(typeof collection, 'object', 'typeof'); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { collection('bar'); }); }, 'HTMLOptionsCollection legacycaller should not be supported'); diff --git a/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.html b/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.html index 095931ad785553..14faa2128ed0bd 100644 --- a/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.html +++ b/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.html @@ -225,12 +225,12 @@ }, "legacy caller with no argument"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new document.all("picture"); }, "New should not work on document.all()"); // https://esdiscuss.org/topic/isconstructor#content-11 - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new (new Proxy(document.all, { construct: function() { return {}; diff --git a/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection.html b/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection.html index d39cc460e5b1e3..130716a9cc7022 100644 --- a/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection.html +++ b/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection.html @@ -209,7 +209,7 @@ test(function() { var add = document.createElement("p"); - assert_throws(new TypeError(), function() {b_opts.add(add);}); + assert_throws_js(TypeError, function() {b_opts.add(add);}); }, "Add non-option to collection"); </script> diff --git a/html/semantics/embedded-content/media-elements/historical.html b/html/semantics/embedded-content/media-elements/historical.html index efdd90f7b152ac..d98a74df4e158d 100644 --- a/html/semantics/embedded-content/media-elements/historical.html +++ b/html/semantics/embedded-content/media-elements/historical.html @@ -39,7 +39,7 @@ // TextTrackCue constructor: added in r5723, removed in r7742. test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new TextTrackCue(0, 0, ''); }); }, 'TextTrackCue constructor should not be supported'); diff --git a/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLMediaElement/addTextTrack.html b/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLMediaElement/addTextTrack.html index 2a76b0a66bab3c..0e1a48f78a9688 100644 --- a/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLMediaElement/addTextTrack.html +++ b/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLMediaElement/addTextTrack.html @@ -6,19 +6,19 @@ <script> var video = document.createElement('video'); test(function(){ - assert_throws(new TypeError(), function(){ + assert_throws_js(TypeError, function(){ video.addTextTrack('foo'); }); - assert_throws(new TypeError(), function(){ + assert_throws_js(TypeError, function(){ video.addTextTrack(undefined); }); - assert_throws(new TypeError(), function(){ + assert_throws_js(TypeError, function(){ video.addTextTrack(null); }); }, document.title + ' bogus first arg'); test(function(){ - assert_throws(new TypeError(), function(){ + assert_throws_js(TypeError, function(){ video.addTextTrack('SUBTITLES'); }); }, document.title + ' uppercase first arg'); diff --git a/html/semantics/embedded-content/media-elements/interfaces/TextTrackCue/constructor.html b/html/semantics/embedded-content/media-elements/interfaces/TextTrackCue/constructor.html index c066f60399b7ac..8ee9adb1c0d30a 100644 --- a/html/semantics/embedded-content/media-elements/interfaces/TextTrackCue/constructor.html +++ b/html/semantics/embedded-content/media-elements/interfaces/TextTrackCue/constructor.html @@ -13,7 +13,7 @@ }, "TextTrackCue and VTTCue are separate interfaces"); test(function() { - assert_throws(new TypeError(), function() + assert_throws_js(TypeError, function() { new TextTrackCue(0, 0, ""); }); diff --git a/html/semantics/embedded-content/media-elements/interfaces/TextTrackCue/endTime.html b/html/semantics/embedded-content/media-elements/interfaces/TextTrackCue/endTime.html index b99a12e05aae6b..a7c10a3d4dfd7c 100644 --- a/html/semantics/embedded-content/media-elements/interfaces/TextTrackCue/endTime.html +++ b/html/semantics/embedded-content/media-elements/interfaces/TextTrackCue/endTime.html @@ -14,9 +14,9 @@ assert_equals(c1.endTime, -1); c1.endTime = c1.endTime; assert_equals(c1.endTime, -1); - assert_throws(new TypeError(), function(){ c1.endTime = NaN; }); - assert_throws(new TypeError(), function(){ c1.endTime = +Infinity; }); - assert_throws(new TypeError(), function(){ c1.endTime = -Infinity; }); + assert_throws_js(TypeError, function(){ c1.endTime = NaN; }); + assert_throws_js(TypeError, function(){ c1.endTime = +Infinity; }); + assert_throws_js(TypeError, function(){ c1.endTime = -Infinity; }); }, document.title+', script-created cue'); var t_parsed = async_test(document.title+', parsed cue'); diff --git a/html/semantics/embedded-content/media-elements/interfaces/TextTrackCue/startTime.html b/html/semantics/embedded-content/media-elements/interfaces/TextTrackCue/startTime.html index 232a7f23b3e667..7fba1df415aa38 100644 --- a/html/semantics/embedded-content/media-elements/interfaces/TextTrackCue/startTime.html +++ b/html/semantics/embedded-content/media-elements/interfaces/TextTrackCue/startTime.html @@ -14,9 +14,9 @@ assert_equals(c1.startTime, -1); c1.startTime = c1.startTime; assert_equals(c1.startTime, -1); - assert_throws(new TypeError(), function(){ c1.startTime = NaN; }); - assert_throws(new TypeError(), function(){ c1.startTime = +Infinity; }); - assert_throws(new TypeError(), function(){ c1.startTime = -Infinity; }); + assert_throws_js(TypeError, function(){ c1.startTime = NaN; }); + assert_throws_js(TypeError, function(){ c1.startTime = +Infinity; }); + assert_throws_js(TypeError, function(){ c1.startTime = -Infinity; }); }, document.title+', script-created cue'); var t_parsed = async_test(document.title+', parsed cue'); diff --git a/html/semantics/embedded-content/media-elements/interfaces/TextTrackCueList/getter.html b/html/semantics/embedded-content/media-elements/interfaces/TextTrackCueList/getter.html index d9cd871720eb4a..8056d245433fe4 100644 --- a/html/semantics/embedded-content/media-elements/interfaces/TextTrackCueList/getter.html +++ b/html/semantics/embedded-content/media-elements/interfaces/TextTrackCueList/getter.html @@ -36,12 +36,12 @@ 'use strict'; var cues = t1.cues; assert_equals(cues[0], undefined); - assert_throws(new TypeError(), function() { cues[0] = 'foo'; }); + assert_throws_js(TypeError, function() { cues[0] = 'foo'; }); assert_equals(cues[0], undefined); var c1 = new VTTCue(0, 1, 'text1'); t1.addCue(c1); assert_equals(cues[0], c1); - assert_throws(new TypeError(), function() { cues[0] = 'foo'; }); + assert_throws_js(TypeError, function() { cues[0] = 'foo'; }); assert_equals(cues[0], c1); t1.removeCue(c1); }, document.title+', no indexed set/create (strict)'); diff --git a/html/semantics/embedded-content/media-elements/interfaces/TextTrackList/getter.html b/html/semantics/embedded-content/media-elements/interfaces/TextTrackList/getter.html index 8c5fb3759400b6..9baa4594194fed 100644 --- a/html/semantics/embedded-content/media-elements/interfaces/TextTrackList/getter.html +++ b/html/semantics/embedded-content/media-elements/interfaces/TextTrackList/getter.html @@ -25,7 +25,7 @@ test(function(){ 'use strict'; var track_before = video.textTracks[0]; - assert_throws(new TypeError(), function(){ video.textTracks[0] = 'foo'; }); + assert_throws_js(TypeError, function(){ video.textTracks[0] = 'foo'; }); assert_equals(video.textTracks[0], track_before); }, document.title+', no indexed set/create (strict)'); diff --git a/html/semantics/embedded-content/media-elements/track/track-element/track-addtrack-kind.html b/html/semantics/embedded-content/media-elements/track/track-element/track-addtrack-kind.html index 4503a06bb2cd25..d058bf2987886e 100644 --- a/html/semantics/embedded-content/media-elements/track/track-element/track-addtrack-kind.html +++ b/html/semantics/embedded-content/media-elements/track/track-element/track-addtrack-kind.html @@ -13,7 +13,7 @@ var video = document.createElement("video"); assert_equals(video.textTracks.length, 0); - assert_throws(new TypeError(), function() { video.addTextTrack("kaptions"); }); + assert_throws_js(TypeError, function() { video.addTextTrack("kaptions"); }); assert_equals(video.textTracks.length, 0); addTrack("subtitles"); diff --git a/html/semantics/embedded-content/media-elements/volume_nonfinite.html b/html/semantics/embedded-content/media-elements/volume_nonfinite.html index 6e90a2ebcdb54a..fce50c2e20eaf5 100644 --- a/html/semantics/embedded-content/media-elements/volume_nonfinite.html +++ b/html/semantics/embedded-content/media-elements/volume_nonfinite.html @@ -9,7 +9,7 @@ [NaN, Infinity, -Infinity].forEach(function(aValue) { test(function() { var el = document.createElement(aElement); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { el.volume = aValue; }); }, "Setting " + aElement + ".volume to " + String(aValue) + " should throw a TypeError"); diff --git a/html/semantics/embedded-content/the-audio-element/audio_constructor.html b/html/semantics/embedded-content/the-audio-element/audio_constructor.html index 57f91572bc5a30..c5b5b80ac13237 100644 --- a/html/semantics/embedded-content/the-audio-element/audio_constructor.html +++ b/html/semantics/embedded-content/the-audio-element/audio_constructor.html @@ -39,17 +39,17 @@ }, "Prototype of object created with named constructor"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { Audio(); }); }, "Calling Audio should throw"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { HTMLAudioElement(); }); }, "Calling HTMLAudioElement should throw"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new HTMLAudioElement(); }); }, "Constructing HTMLAudioElement should throw"); diff --git a/html/semantics/embedded-content/the-canvas-element/context.arguments.missing.html b/html/semantics/embedded-content/the-canvas-element/context.arguments.missing.html index f1ef93b93acac6..fcda9043fc78ff 100644 --- a/html/semantics/embedded-content/the-canvas-element/context.arguments.missing.html +++ b/html/semantics/embedded-content/the-canvas-element/context.arguments.missing.html @@ -19,7 +19,7 @@ <h1>context.arguments.missing</h1> var t = async_test(""); _addTest(function(canvas, ctx) { -assert_throws(new TypeError(), function() { canvas.getContext(); }); +assert_throws_js(TypeError, function() { canvas.getContext(); }); }); diff --git a/html/semantics/embedded-content/the-canvas-element/historical.html b/html/semantics/embedded-content/the-canvas-element/historical.html index e485e10d991ca1..33044ffb1bd074 100644 --- a/html/semantics/embedded-content/the-canvas-element/historical.html +++ b/html/semantics/embedded-content/the-canvas-element/historical.html @@ -34,10 +34,10 @@ t("CanvasProxy", window); t("commit", canvas); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new CanvasRenderingContext2D(); }, 'no arguments'); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new CanvasRenderingContext2D(1, 1); }, 'with arguments'); }, "CanvasRenderingContext2D constructors"); diff --git a/html/semantics/embedded-content/the-canvas-element/imagedata.html b/html/semantics/embedded-content/the-canvas-element/imagedata.html index 61331956e49659..1ba45ae45e8286 100644 --- a/html/semantics/embedded-content/the-canvas-element/imagedata.html +++ b/html/semantics/embedded-content/the-canvas-element/imagedata.html @@ -43,7 +43,7 @@ }, "ImageData(buffer, w, h), buffer.length == 4 * w * h must be true"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new ImageData(new Int8Array(1), 1); }); }, "ImageData(buffer, w, opt h), Uint8ClampedArray argument type check"); diff --git a/html/semantics/embedded-content/the-embed-element/historical.html b/html/semantics/embedded-content/the-embed-element/historical.html index 168a8468e06edf..9df7280bb6065e 100644 --- a/html/semantics/embedded-content/the-embed-element/historical.html +++ b/html/semantics/embedded-content/the-embed-element/historical.html @@ -8,7 +8,7 @@ test(function() { var elm = document.getElementById('embed'); assert_equals(typeof elm, 'object', 'typeof'); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { elm(); }); }, 'embed legacycaller should not be supported'); diff --git a/html/semantics/embedded-content/the-object-element/historical.html b/html/semantics/embedded-content/the-object-element/historical.html index 2f293d372ec190..c7a577a9d417fd 100644 --- a/html/semantics/embedded-content/the-object-element/historical.html +++ b/html/semantics/embedded-content/the-object-element/historical.html @@ -8,7 +8,7 @@ test(function() { var elm = document.getElementById('object'); assert_equals(typeof elm, 'object', 'typeof'); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { elm(); }); }, 'object legacycaller should not be supported'); diff --git a/html/semantics/forms/textfieldselection/textfieldselection-setRangeText.html b/html/semantics/forms/textfieldselection/textfieldselection-setRangeText.html index 66b5e30a04e773..a5c30ee2f0803b 100644 --- a/html/semantics/forms/textfieldselection/textfieldselection-setRangeText.html +++ b/html/semantics/forms/textfieldselection/textfieldselection-setRangeText.html @@ -100,7 +100,7 @@ }, element.id + " setRangeText with 3rd argument greater than 2nd argument throws an IndexSizeError exception"); test(function(){ - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { element.setRangeText(); }); }, element.id + " setRangeText without argument throws a type error"); diff --git a/html/semantics/forms/the-form-element/form-indexed-element.html b/html/semantics/forms/the-form-element/form-indexed-element.html index 66f00e7615d59d..5ea96d3d1b21ac 100644 --- a/html/semantics/forms/the-form-element/form-indexed-element.html +++ b/html/semantics/forms/the-form-element/form-indexed-element.html @@ -36,7 +36,7 @@ delete form[0]; assert_equals(form[0], old_item); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { "use strict"; delete form[0]; }); diff --git a/html/semantics/forms/the-form-element/form-nameditem.html b/html/semantics/forms/the-form-element/form-nameditem.html index e794f07c03b092..7b7d573615e4f4 100644 --- a/html/semantics/forms/the-form-element/form-nameditem.html +++ b/html/semantics/forms/the-form-element/form-nameditem.html @@ -145,7 +145,7 @@ var form = document.getElementsByTagName("form")[0] var indices = [-1, 0, 1, 2, 3] indices.forEach(function(i) { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { form.radio(i) }) }) @@ -258,18 +258,18 @@ form["l1"] = 5; assert_equals(form["l1"], old_item); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { "use strict"; form["l1"] = 5; }); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { Object.defineProperty(form, "l1", { value: 5 }); }); delete form["l1"]; assert_equals(form["l1"], old_item); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { "use strict"; delete form["l1"]; }); @@ -319,7 +319,7 @@ delete form["new-name2"]; assert_equals(form["new-name2"], 5); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { "use strict"; delete form["new-name2"]; }); diff --git a/html/semantics/forms/the-form-element/form-requestsubmit.html b/html/semantics/forms/the-form-element/form-requestsubmit.html index 1c7b7870bdf214..83b0b2ef36fa62 100644 --- a/html/semantics/forms/the-form-element/form-requestsubmit.html +++ b/html/semantics/forms/the-form-element/form-requestsubmit.html @@ -14,11 +14,11 @@ '<button type="button"></button>' + '</form>'); let form = document.querySelector('form'); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { form.requestSubmit(document.body); }); for (let control of form.elements) { - assert_throws(new TypeError(), () => { form.requestSubmit(control); }); + assert_throws_js(TypeError, () => { form.requestSubmit(control); }); } }, 'Passing an element which is not a submit button should throw'); diff --git a/html/semantics/forms/the-input-element/files.html b/html/semantics/forms/the-input-element/files.html index 93088330d378cb..a4157a3d6baaa0 100644 --- a/html/semantics/forms/the-input-element/files.html +++ b/html/semantics/forms/the-input-element/files.html @@ -65,7 +65,7 @@ i1.files = null; assert_equals(i1.files, files, "files cannot be set to null"); - assert_throws(new TypeError(), () => i1.files = [], "files cannot be set to an array"); - assert_throws(new TypeError(), () => i1.files = [new File([], "x")], "files cannot be set to an array (even when it contains File objects)"); + assert_throws_js(TypeError, () => i1.files = [], "files cannot be set to an array"); + assert_throws_js(TypeError, () => i1.files = [new File([], "x")], "files cannot be set to an array (even when it contains File objects)"); }, "setting <input type=file>.files"); </script> diff --git a/html/semantics/forms/the-meter-element/meter.html b/html/semantics/forms/the-meter-element/meter.html index 1c1ce4f18c2f52..c7c260c957ded1 100644 --- a/html/semantics/forms/the-meter-element/meter.html +++ b/html/semantics/forms/the-meter-element/meter.html @@ -72,12 +72,12 @@ <h1>Meter Element</h1> } test(function() { var meter = document.createElement("meter"); - assert_throws(new TypeError(), function() { meter.value = "foobar"; }, "value attribute"); - assert_throws(new TypeError(), function() { meter.min = "foobar"; }, "min attribute"); - assert_throws(new TypeError(), function() { meter.max = "foobar"; }, "max attribute"); - assert_throws(new TypeError(), function() { meter.low = "foobar"; }, "low attribute"); - assert_throws(new TypeError(), function() { meter.high = "foobar"; }, "high attribute"); - assert_throws(new TypeError(), function() { meter.optimum = "foobar"; }, "optimum attribute"); + assert_throws_js(TypeError, function() { meter.value = "foobar"; }, "value attribute"); + assert_throws_js(TypeError, function() { meter.min = "foobar"; }, "min attribute"); + assert_throws_js(TypeError, function() { meter.max = "foobar"; }, "max attribute"); + assert_throws_js(TypeError, function() { meter.low = "foobar"; }, "low attribute"); + assert_throws_js(TypeError, function() { meter.high = "foobar"; }, "high attribute"); + assert_throws_js(TypeError, function() { meter.optimum = "foobar"; }, "optimum attribute"); }, "Invalid floating-point number values"); </script> diff --git a/html/semantics/tabular-data/the-table-element/caption-methods.html b/html/semantics/tabular-data/the-table-element/caption-methods.html index ec95eab39fb26a..8db43b80dfce74 100644 --- a/html/semantics/tabular-data/the-table-element/caption-methods.html +++ b/html/semantics/tabular-data/the-table-element/caption-methods.html @@ -173,7 +173,7 @@ test(function() { var table8 = document.createElement("table"); var caption = document.createElement("captİon"); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { table8.caption = caption; }); }, "Assigning a non-caption to table.caption") @@ -181,7 +181,7 @@ test(function() { var table9 = document.createElement("table"); var caption = document.createElementNS("http://www.example.com", "caption"); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { table9.caption = caption; }); }, "Assigning a foreign caption to table.caption") diff --git a/html/semantics/tabular-data/the-table-element/tFoot.html b/html/semantics/tabular-data/the-table-element/tFoot.html index e83d193f35f7a6..a3c822c6d7a8c7 100644 --- a/html/semantics/tabular-data/the-table-element/tFoot.html +++ b/html/semantics/tabular-data/the-table-element/tFoot.html @@ -46,7 +46,7 @@ assert_equals(t.tFoot.previousSibling, tbody2); assert_equals(t.tFoot.nextSibling, null); - assert_throws(new TypeError(), function(){ + assert_throws_js(TypeError, function(){ t.tFoot = document.createElement("div"); }); diff --git a/html/semantics/tabular-data/the-table-element/tHead.html b/html/semantics/tabular-data/the-table-element/tHead.html index 78a874824df202..c4117f52c1e09c 100644 --- a/html/semantics/tabular-data/the-table-element/tHead.html +++ b/html/semantics/tabular-data/the-table-element/tHead.html @@ -45,7 +45,7 @@ assert_equals(t.tHead.previousSibling, tcaption); assert_equals(t.tHead.nextSibling, tbody1); - assert_throws(new TypeError(), function(){ + assert_throws_js(TypeError, function(){ t.tHead = document.createElement("div"); }); diff --git a/html/webappapis/microtask-queuing/queue-microtask.any.js b/html/webappapis/microtask-queuing/queue-microtask.any.js index b39931719a88ad..e67765fade3bc6 100644 --- a/html/webappapis/microtask-queuing/queue-microtask.any.js +++ b/html/webappapis/microtask-queuing/queue-microtask.any.js @@ -6,12 +6,12 @@ test(() => { }, "It exists and is a function"); test(() => { - assert_throws(new TypeError(), () => queueMicrotask(), "no argument"); - assert_throws(new TypeError(), () => queueMicrotask(undefined), "undefined"); - assert_throws(new TypeError(), () => queueMicrotask(null), "null"); - assert_throws(new TypeError(), () => queueMicrotask(0), "0"); - assert_throws(new TypeError(), () => queueMicrotask({ handleEvent() { } }), "an event handler object"); - assert_throws(new TypeError(), () => queueMicrotask("window.x = 5;"), "a string"); + assert_throws_js(TypeError, () => queueMicrotask(), "no argument"); + assert_throws_js(TypeError, () => queueMicrotask(undefined), "undefined"); + assert_throws_js(TypeError, () => queueMicrotask(null), "null"); + assert_throws_js(TypeError, () => queueMicrotask(0), "0"); + assert_throws_js(TypeError, () => queueMicrotask({ handleEvent() { } }), "an event handler object"); + assert_throws_js(TypeError, () => queueMicrotask("window.x = 5;"), "a string"); }, "It throws when given non-functions"); async_test(t => { diff --git a/html/webappapis/scripting/events/messageevent-constructor.https.html b/html/webappapis/scripting/events/messageevent-constructor.https.html index 70b5ff6e568bc3..c0dc4d231ceac9 100644 --- a/html/webappapis/scripting/events/messageevent-constructor.https.html +++ b/html/webappapis/scripting/events/messageevent-constructor.https.html @@ -35,7 +35,7 @@ }, "MessageEventInit dictionary") test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new MessageEvent("test", { ports: null }) }) }, "Passing null for ports member") @@ -67,7 +67,7 @@ test(function() { var ev = document.createEvent("messageevent") - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { ev.initMessageEvent("test", true, false, "testData", "testOrigin", "testId", window, null) }) }, "Passing null for ports parameter to initMessageEvent") diff --git a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.js b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.js index a890b350198253..f195a70fdf9a41 100644 --- a/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.js +++ b/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.js @@ -4,7 +4,7 @@ test(() => { const sab = new SharedArrayBuffer(16); const ta = new Int32Array(sab); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { Atomics.wait(ta, 0, 0, 10); }); }, `[[CanBlock]] in a ${self.constructor.name}`); diff --git a/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-event-constructor.html b/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-event-constructor.html index 17cc35c21b0af6..888750721281df 100644 --- a/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-event-constructor.html +++ b/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-event-constructor.html @@ -16,7 +16,7 @@ assert_equals(new PromiseRejectionEvent('eventType', { promise: p }).reason, undefined); // No promise is passed. - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { new PromiseRejectionEvent('eventType', { bubbles: false }); }, diff --git a/js/builtins/Array.prototype.join-order.html b/js/builtins/Array.prototype.join-order.html index e5589803a68bd0..13d49a8d192ac5 100644 --- a/js/builtins/Array.prototype.join-order.html +++ b/js/builtins/Array.prototype.join-order.html @@ -11,12 +11,12 @@ // Step 1. test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { [].join.call(null, { toString: function() { assert_unreached(); } }); }); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { [].join.call(undefined, { toString: function() { assert_unreached(); } }); diff --git a/js/builtins/Object.prototype.hasOwnProperty-prototype-chain.html b/js/builtins/Object.prototype.hasOwnProperty-prototype-chain.html index 402f1ae6fd5bfe..e64d0b7163283d 100644 --- a/js/builtins/Object.prototype.hasOwnProperty-prototype-chain.html +++ b/js/builtins/Object.prototype.hasOwnProperty-prototype-chain.html @@ -34,7 +34,7 @@ test(function() { [null, undefined].forEach(function(that) { - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { that.hasOwnProperty('hasOwnProperty'); }); }); }); diff --git a/js/builtins/WeakMap.prototype-properties.html b/js/builtins/WeakMap.prototype-properties.html index ecf4a8e311ecfc..2c2bddfeb7159b 100644 --- a/js/builtins/WeakMap.prototype-properties.html +++ b/js/builtins/WeakMap.prototype-properties.html @@ -25,16 +25,16 @@ function test_thisval(fun, args) { // Step 1-2 test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { WeakMap.prototype[fun].apply(null, args); }); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { WeakMap.prototype[fun].apply(undefined, args); }); }, "WeakMap.prototype." + fun + ": ToObject on this") // Step 3 test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { WeakMap.prototype[fun].apply({}, args); }); }, "WeakMap.prototype." + fun + ": this has no [[WeakMapData]] internal property") diff --git a/media-source/URL-createObjectURL-null.html b/media-source/URL-createObjectURL-null.html index a4177dd846be89..f2f973a776e5fc 100644 --- a/media-source/URL-createObjectURL-null.html +++ b/media-source/URL-createObjectURL-null.html @@ -10,7 +10,7 @@ <div id="log"></div> <script> test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { window.URL.createObjectURL(null); }); }, "URL.createObjectURL(null)"); diff --git a/media-source/mediasource-endofstream-invaliderror.html b/media-source/mediasource-endofstream-invaliderror.html index 0327e44cc0d8a0..20a118d717100c 100644 --- a/media-source/mediasource-endofstream-invaliderror.html +++ b/media-source/mediasource-endofstream-invaliderror.html @@ -15,7 +15,7 @@ mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'")); assert_equals(mediaSource.readyState, 'open'); - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { mediaSource.endOfStream('garbage'); }, 'endOfStream(\'garbage\') throws TypeError'); @@ -28,7 +28,7 @@ mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'")); assert_equals(mediaSource.readyState, 'open'); - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { mediaSource.endOfStream(''); }, 'endOfStream(\'\') throws TypeError'); @@ -41,7 +41,7 @@ mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'")); assert_equals(mediaSource.readyState, 'open'); - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { mediaSource.endOfStream(null); }, 'endOfStream(null) throws TypeError'); diff --git a/media-source/mediasource-removesourcebuffer.html b/media-source/mediasource-removesourcebuffer.html index 0388565329ff0d..7e1ec26b24d9d6 100644 --- a/media-source/mediasource-removesourcebuffer.html +++ b/media-source/mediasource-removesourcebuffer.html @@ -27,7 +27,7 @@ mediasource_test(function(test, mediaElement, mediaSource) { - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { mediaSource.removeSourceBuffer(null); }, "removeSourceBuffer() threw an exception when passed null."); test.done(); diff --git a/media-source/mediasource-sourcebuffer-trackdefaults.html b/media-source/mediasource-sourcebuffer-trackdefaults.html index 0eb9d2643af288..6064f87cb28a3d 100644 --- a/media-source/mediasource-sourcebuffer-trackdefaults.html +++ b/media-source/mediasource-sourcebuffer-trackdefaults.html @@ -70,7 +70,7 @@ sourceBufferTrackDefaultsTest(function(test, mediaElement, mediaSource, sourceBuffer) { - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { sourceBuffer.trackDefaults = null; }, "null should be disallowed by trackDefaults setter"); test.done(); diff --git a/media-source/mediasource-trackdefault.html b/media-source/mediasource-trackdefault.html index 5fc2e5e97d6a04..e6c9e76ef91a38 100644 --- a/media-source/mediasource-trackdefault.html +++ b/media-source/mediasource-trackdefault.html @@ -16,7 +16,7 @@ function checkConstructionFails(type, language, label, kinds, byteStreamTrackID) { - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { new TrackDefault(type, language, label, kinds, byteStreamTrackID); }, "TrackDefault construction threw an exception"); } diff --git a/mediacapture-image/ImageCapture-creation.https.html b/mediacapture-image/ImageCapture-creation.https.html index 387dceee37a8ee..ffecf1d5804e5c 100644 --- a/mediacapture-image/ImageCapture-creation.https.html +++ b/mediacapture-image/ImageCapture-creation.https.html @@ -82,11 +82,11 @@ "", true ]; - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { var capturer = new ImageCapture(); }, 'an ImageCapturer can not be created with no parameter'); invalidParameters.map(parameter => { - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { var capturer = new ImageCapture(parameter); }, `an ImageCapturer can not be created with a ${parameter} parameter`); }); diff --git a/mediacapture-streams/historical.https.html b/mediacapture-streams/historical.https.html index 9437c51552abf1..84326cec0a61ad 100644 --- a/mediacapture-streams/historical.https.html +++ b/mediacapture-streams/historical.https.html @@ -18,7 +18,7 @@ test(() => { const mediaStream = new MediaStream(); - assert_throws(new TypeError(), () => URL.createObjectURL(mediaStream)); + assert_throws_js(TypeError, () => URL.createObjectURL(mediaStream)); }, "Passing MediaStream to URL.createObjectURL() should throw"); test(() => { diff --git a/mediasession/mediametadata.html b/mediasession/mediametadata.html index 11f6a5f9767248..ff00e54ee7c6c3 100644 --- a/mediasession/mediametadata.html +++ b/mediasession/mediametadata.html @@ -38,8 +38,8 @@ var metadata = new MediaMetadata({}); assert_not_equals(metadata, null); - assert_throws(new TypeError(), _ => new MediaMetadata('foobar')); - assert_throws(new TypeError(), _ => new MediaMetadata(42)); + assert_throws_js(TypeError, _ => new MediaMetadata('foobar')); + assert_throws_js(TypeError, _ => new MediaMetadata(42)); }, 'Test that MediaMetadata is constructed using a dictionary'); test(function() { @@ -113,7 +113,7 @@ test(function() { var metadata = new MediaMetadata({ artwork: [ { src: 'http://foo.com/' } ] }); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { metadata.artwork.push({ src: 'http://example.com/', sizes: '40x40', type: 'image/png', }); @@ -163,14 +163,14 @@ test(function() { var metadata = 42; - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { metadata new MediaMetadata({ artwork: [ { src: 'http://[example.com]' }] }); }); assert_equals(metadata, 42); metadata = new MediaMetadata(); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { metadata.artwork = [ // Valid url. { src: 'http://example.com' }, @@ -189,12 +189,12 @@ }, "Test MediaImage default values"); test(function() { - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { new MediaMetadata({ artwork: [ {} ] }); }); var metadata = new MediaMetadata(); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { metadata.artwork = [ { type: 'image/png', sizes: '40x40' } ]; }); }, "Test that MediaImage.src is required") diff --git a/mimesniff/mime-types/parsing.any.js b/mimesniff/mime-types/parsing.any.js index 640a46b9e98ee1..ae396c4f095b6a 100644 --- a/mimesniff/mime-types/parsing.any.js +++ b/mimesniff/mime-types/parsing.any.js @@ -34,8 +34,8 @@ function runTests(tests) { promise_test(() => { const compatibleNess = isByteCompatible(val.input); if(compatibleNess === "incompatible" || compatibleNess === "header-value-incompatible") { - assert_throws(new TypeError(), () => new Request("about:blank", { headers: [["Content-Type", val.input]] })); - assert_throws(new TypeError(), () => new Response(null, { headers: [["Content-Type", val.input]] })); + assert_throws_js(TypeError, () => new Request("about:blank", { headers: [["Content-Type", val.input]] })); + assert_throws_js(TypeError, () => new Response(null, { headers: [["Content-Type", val.input]] })); return Promise.resolve(); } else { return Promise.all([ diff --git a/notifications/constructor-invalid.html b/notifications/constructor-invalid.html index 88df165e169c03..1995ccc4f5f979 100644 --- a/notifications/constructor-invalid.html +++ b/notifications/constructor-invalid.html @@ -12,7 +12,7 @@ this.set_status(this.NOTRUN, "You must allow notifications for this" + " origin before running this test.") } - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new Notification() }) }, "Called the notification constructor with no arguments.") diff --git a/offscreen-canvas/conformance-requirements/2d.missingargs.html b/offscreen-canvas/conformance-requirements/2d.missingargs.html index 4c810495c8f224..77d35fdbf4e0ca 100644 --- a/offscreen-canvas/conformance-requirements/2d.missingargs.html +++ b/offscreen-canvas/conformance-requirements/2d.missingargs.html @@ -20,102 +20,102 @@ <h1>2d.missingargs</h1> var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.scale(); }); -assert_throws(new TypeError(), function() { ctx.scale(1); }); -assert_throws(new TypeError(), function() { ctx.rotate(); }); -assert_throws(new TypeError(), function() { ctx.translate(); }); -assert_throws(new TypeError(), function() { ctx.translate(0); }); +assert_throws_js(TypeError, function() { ctx.scale(); }); +assert_throws_js(TypeError, function() { ctx.scale(1); }); +assert_throws_js(TypeError, function() { ctx.rotate(); }); +assert_throws_js(TypeError, function() { ctx.translate(); }); +assert_throws_js(TypeError, function() { ctx.translate(0); }); if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) - assert_throws(new TypeError(), function() { ctx.transform(); }); - assert_throws(new TypeError(), function() { ctx.transform(1); }); - assert_throws(new TypeError(), function() { ctx.transform(1, 0); }); - assert_throws(new TypeError(), function() { ctx.transform(1, 0, 0); }); - assert_throws(new TypeError(), function() { ctx.transform(1, 0, 0, 1); }); - assert_throws(new TypeError(), function() { ctx.transform(1, 0, 0, 1, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(); }); + assert_throws_js(TypeError, function() { ctx.transform(1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1, 0); }); } if (ctx.setTransform) { - assert_throws(new TypeError(), function() { ctx.setTransform(1); }); - assert_throws(new TypeError(), function() { ctx.setTransform(1, 0); }); - assert_throws(new TypeError(), function() { ctx.setTransform(1, 0, 0); }); - assert_throws(new TypeError(), function() { ctx.setTransform(1, 0, 0, 1); }); - assert_throws(new TypeError(), function() { ctx.setTransform(1, 0, 0, 1, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1, 0); }); } -assert_throws(new TypeError(), function() { ctx.createLinearGradient(); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.createPattern(offscreenCanvas); }); -assert_throws(new TypeError(), function() { ctx.clearRect(); }); -assert_throws(new TypeError(), function() { ctx.clearRect(0); }); -assert_throws(new TypeError(), function() { ctx.clearRect(0, 0); }); -assert_throws(new TypeError(), function() { ctx.clearRect(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.fillRect(); }); -assert_throws(new TypeError(), function() { ctx.fillRect(0); }); -assert_throws(new TypeError(), function() { ctx.fillRect(0, 0); }); -assert_throws(new TypeError(), function() { ctx.fillRect(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.strokeRect(); }); -assert_throws(new TypeError(), function() { ctx.strokeRect(0); }); -assert_throws(new TypeError(), function() { ctx.strokeRect(0, 0); }); -assert_throws(new TypeError(), function() { ctx.strokeRect(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.moveTo(); }); -assert_throws(new TypeError(), function() { ctx.moveTo(0); }); -assert_throws(new TypeError(), function() { ctx.lineTo(); }); -assert_throws(new TypeError(), function() { ctx.lineTo(0); }); -assert_throws(new TypeError(), function() { ctx.quadraticCurveTo(); }); -assert_throws(new TypeError(), function() { ctx.quadraticCurveTo(0); }); -assert_throws(new TypeError(), function() { ctx.quadraticCurveTo(0, 0); }); -assert_throws(new TypeError(), function() { ctx.quadraticCurveTo(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.bezierCurveTo(); }); -assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0); }); -assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0, 0); }); -assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0, 0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.arcTo(); }); -assert_throws(new TypeError(), function() { ctx.arcTo(0); }); -assert_throws(new TypeError(), function() { ctx.arcTo(0, 0); }); -assert_throws(new TypeError(), function() { ctx.arcTo(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.arcTo(0, 0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.rect(); }); -assert_throws(new TypeError(), function() { ctx.rect(0); }); -assert_throws(new TypeError(), function() { ctx.rect(0, 0); }); -assert_throws(new TypeError(), function() { ctx.rect(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.arc(); }); -assert_throws(new TypeError(), function() { ctx.arc(0); }); -assert_throws(new TypeError(), function() { ctx.arc(0, 0); }); -assert_throws(new TypeError(), function() { ctx.arc(0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.arc(0, 0, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.drawImage(); }); -assert_throws(new TypeError(), function() { ctx.drawImage(offscreenCanvas); }); -assert_throws(new TypeError(), function() { ctx.drawImage(offscreenCanvas, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.createPattern(offscreenCanvas); }); +assert_throws_js(TypeError, function() { ctx.clearRect(); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.moveTo(); }); +assert_throws_js(TypeError, function() { ctx.moveTo(0); }); +assert_throws_js(TypeError, function() { ctx.lineTo(); }); +assert_throws_js(TypeError, function() { ctx.lineTo(0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.rect(); }); +assert_throws_js(TypeError, function() { ctx.rect(0); }); +assert_throws_js(TypeError, function() { ctx.rect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.rect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arc(); }); +assert_throws_js(TypeError, function() { ctx.arc(0); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage(); }); +assert_throws_js(TypeError, function() { ctx.drawImage(offscreenCanvas); }); +assert_throws_js(TypeError, function() { ctx.drawImage(offscreenCanvas, 0); }); // TODO: n >= 3 args on drawImage could be either a valid overload, // or too few for another overload, or too many for another // overload - what should happen? if (ctx.createImageData) { - assert_throws(new TypeError(), function() { ctx.createImageData(); }); - assert_throws(new TypeError(), function() { ctx.createImageData(1); }); + assert_throws_js(TypeError, function() { ctx.createImageData(); }); + assert_throws_js(TypeError, function() { ctx.createImageData(1); }); } if (ctx.getImageData) { - assert_throws(new TypeError(), function() { ctx.getImageData(); }); - assert_throws(new TypeError(), function() { ctx.getImageData(0); }); - assert_throws(new TypeError(), function() { ctx.getImageData(0, 0); }); - assert_throws(new TypeError(), function() { ctx.getImageData(0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.getImageData(); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0, 1); }); } if (ctx.putImageData) { var imgdata = ctx.getImageData(0, 0, 1, 1); - assert_throws(new TypeError(), function() { ctx.putImageData(); }); - assert_throws(new TypeError(), function() { ctx.putImageData(imgdata); }); - assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 0); }); + assert_throws_js(TypeError, function() { ctx.putImageData(); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0); }); } var g = ctx.createLinearGradient(0, 0, 0, 0); -assert_throws(new TypeError(), function() { g.addColorStop(); }); -assert_throws(new TypeError(), function() { g.addColorStop(0); }); +assert_throws_js(TypeError, function() { g.addColorStop(); }); +assert_throws_js(TypeError, function() { g.addColorStop(0); }); t.done(); }); diff --git a/offscreen-canvas/conformance-requirements/2d.missingargs.worker.js b/offscreen-canvas/conformance-requirements/2d.missingargs.worker.js index b8bc127b877c08..0fc7c4d2bb5301 100644 --- a/offscreen-canvas/conformance-requirements/2d.missingargs.worker.js +++ b/offscreen-canvas/conformance-requirements/2d.missingargs.worker.js @@ -16,102 +16,102 @@ t.step(function() { var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.scale(); }); -assert_throws(new TypeError(), function() { ctx.scale(1); }); -assert_throws(new TypeError(), function() { ctx.rotate(); }); -assert_throws(new TypeError(), function() { ctx.translate(); }); -assert_throws(new TypeError(), function() { ctx.translate(0); }); +assert_throws_js(TypeError, function() { ctx.scale(); }); +assert_throws_js(TypeError, function() { ctx.scale(1); }); +assert_throws_js(TypeError, function() { ctx.rotate(); }); +assert_throws_js(TypeError, function() { ctx.translate(); }); +assert_throws_js(TypeError, function() { ctx.translate(0); }); if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) - assert_throws(new TypeError(), function() { ctx.transform(); }); - assert_throws(new TypeError(), function() { ctx.transform(1); }); - assert_throws(new TypeError(), function() { ctx.transform(1, 0); }); - assert_throws(new TypeError(), function() { ctx.transform(1, 0, 0); }); - assert_throws(new TypeError(), function() { ctx.transform(1, 0, 0, 1); }); - assert_throws(new TypeError(), function() { ctx.transform(1, 0, 0, 1, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(); }); + assert_throws_js(TypeError, function() { ctx.transform(1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.transform(1, 0, 0, 1, 0); }); } if (ctx.setTransform) { - assert_throws(new TypeError(), function() { ctx.setTransform(1); }); - assert_throws(new TypeError(), function() { ctx.setTransform(1, 0); }); - assert_throws(new TypeError(), function() { ctx.setTransform(1, 0, 0); }); - assert_throws(new TypeError(), function() { ctx.setTransform(1, 0, 0, 1); }); - assert_throws(new TypeError(), function() { ctx.setTransform(1, 0, 0, 1, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.setTransform(1, 0, 0, 1, 0); }); } -assert_throws(new TypeError(), function() { ctx.createLinearGradient(); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.createPattern(offscreenCanvas); }); -assert_throws(new TypeError(), function() { ctx.clearRect(); }); -assert_throws(new TypeError(), function() { ctx.clearRect(0); }); -assert_throws(new TypeError(), function() { ctx.clearRect(0, 0); }); -assert_throws(new TypeError(), function() { ctx.clearRect(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.fillRect(); }); -assert_throws(new TypeError(), function() { ctx.fillRect(0); }); -assert_throws(new TypeError(), function() { ctx.fillRect(0, 0); }); -assert_throws(new TypeError(), function() { ctx.fillRect(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.strokeRect(); }); -assert_throws(new TypeError(), function() { ctx.strokeRect(0); }); -assert_throws(new TypeError(), function() { ctx.strokeRect(0, 0); }); -assert_throws(new TypeError(), function() { ctx.strokeRect(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.moveTo(); }); -assert_throws(new TypeError(), function() { ctx.moveTo(0); }); -assert_throws(new TypeError(), function() { ctx.lineTo(); }); -assert_throws(new TypeError(), function() { ctx.lineTo(0); }); -assert_throws(new TypeError(), function() { ctx.quadraticCurveTo(); }); -assert_throws(new TypeError(), function() { ctx.quadraticCurveTo(0); }); -assert_throws(new TypeError(), function() { ctx.quadraticCurveTo(0, 0); }); -assert_throws(new TypeError(), function() { ctx.quadraticCurveTo(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.bezierCurveTo(); }); -assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0); }); -assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0, 0); }); -assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0, 0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.arcTo(); }); -assert_throws(new TypeError(), function() { ctx.arcTo(0); }); -assert_throws(new TypeError(), function() { ctx.arcTo(0, 0); }); -assert_throws(new TypeError(), function() { ctx.arcTo(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.arcTo(0, 0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.rect(); }); -assert_throws(new TypeError(), function() { ctx.rect(0); }); -assert_throws(new TypeError(), function() { ctx.rect(0, 0); }); -assert_throws(new TypeError(), function() { ctx.rect(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.arc(); }); -assert_throws(new TypeError(), function() { ctx.arc(0); }); -assert_throws(new TypeError(), function() { ctx.arc(0, 0); }); -assert_throws(new TypeError(), function() { ctx.arc(0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.arc(0, 0, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.drawImage(); }); -assert_throws(new TypeError(), function() { ctx.drawImage(offscreenCanvas); }); -assert_throws(new TypeError(), function() { ctx.drawImage(offscreenCanvas, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.createPattern(offscreenCanvas); }); +assert_throws_js(TypeError, function() { ctx.clearRect(); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.clearRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.fillRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.strokeRect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.moveTo(); }); +assert_throws_js(TypeError, function() { ctx.moveTo(0); }); +assert_throws_js(TypeError, function() { ctx.lineTo(); }); +assert_throws_js(TypeError, function() { ctx.lineTo(0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.quadraticCurveTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.bezierCurveTo(0, 0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arcTo(0, 0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.rect(); }); +assert_throws_js(TypeError, function() { ctx.rect(0); }); +assert_throws_js(TypeError, function() { ctx.rect(0, 0); }); +assert_throws_js(TypeError, function() { ctx.rect(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.arc(); }); +assert_throws_js(TypeError, function() { ctx.arc(0); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.arc(0, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage(); }); +assert_throws_js(TypeError, function() { ctx.drawImage(offscreenCanvas); }); +assert_throws_js(TypeError, function() { ctx.drawImage(offscreenCanvas, 0); }); // TODO: n >= 3 args on drawImage could be either a valid overload, // or too few for another overload, or too many for another // overload - what should happen? if (ctx.createImageData) { - assert_throws(new TypeError(), function() { ctx.createImageData(); }); - assert_throws(new TypeError(), function() { ctx.createImageData(1); }); + assert_throws_js(TypeError, function() { ctx.createImageData(); }); + assert_throws_js(TypeError, function() { ctx.createImageData(1); }); } if (ctx.getImageData) { - assert_throws(new TypeError(), function() { ctx.getImageData(); }); - assert_throws(new TypeError(), function() { ctx.getImageData(0); }); - assert_throws(new TypeError(), function() { ctx.getImageData(0, 0); }); - assert_throws(new TypeError(), function() { ctx.getImageData(0, 0, 1); }); + assert_throws_js(TypeError, function() { ctx.getImageData(); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0); }); + assert_throws_js(TypeError, function() { ctx.getImageData(0, 0, 1); }); } if (ctx.putImageData) { var imgdata = ctx.getImageData(0, 0, 1, 1); - assert_throws(new TypeError(), function() { ctx.putImageData(); }); - assert_throws(new TypeError(), function() { ctx.putImageData(imgdata); }); - assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 0); }); + assert_throws_js(TypeError, function() { ctx.putImageData(); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata); }); + assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0); }); } var g = ctx.createLinearGradient(0, 0, 0, 0); -assert_throws(new TypeError(), function() { g.addColorStop(); }); -assert_throws(new TypeError(), function() { g.addColorStop(0); }); +assert_throws_js(TypeError, function() { g.addColorStop(); }); +assert_throws_js(TypeError, function() { g.addColorStop(0); }); t.done(); }); diff --git a/offscreen-canvas/drawing-images-to-the-canvas/2d.drawImage.null.html b/offscreen-canvas/drawing-images-to-the-canvas/2d.drawImage.null.html index 0cf9ca26d73147..ffc7c9b08b5011 100644 --- a/offscreen-canvas/drawing-images-to-the-canvas/2d.drawImage.null.html +++ b/offscreen-canvas/drawing-images-to-the-canvas/2d.drawImage.null.html @@ -21,7 +21,7 @@ <h1>2d.drawImage.null</h1> var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.drawImage(null, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage(null, 0, 0); }); t.done(); }); diff --git a/offscreen-canvas/drawing-images-to-the-canvas/2d.drawImage.null.worker.js b/offscreen-canvas/drawing-images-to-the-canvas/2d.drawImage.null.worker.js index 8ed0887ecd8797..4591facb2ce1ab 100644 --- a/offscreen-canvas/drawing-images-to-the-canvas/2d.drawImage.null.worker.js +++ b/offscreen-canvas/drawing-images-to-the-canvas/2d.drawImage.null.worker.js @@ -16,7 +16,7 @@ t.step(function() { var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.drawImage(null, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage(null, 0, 0); }); t.done(); }); diff --git a/offscreen-canvas/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html b/offscreen-canvas/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html index 5cb283466bd587..c003ae2571d57d 100644 --- a/offscreen-canvas/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html +++ b/offscreen-canvas/drawing-images-to-the-canvas/2d.drawImage.wrongtype.html @@ -21,9 +21,9 @@ <h1>2d.drawImage.wrongtype</h1> var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.drawImage(undefined, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.drawImage(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.drawImage("", 0, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage(undefined, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage("", 0, 0); }); t.done(); }); diff --git a/offscreen-canvas/drawing-images-to-the-canvas/2d.drawImage.wrongtype.worker.js b/offscreen-canvas/drawing-images-to-the-canvas/2d.drawImage.wrongtype.worker.js index ffdc25021635a8..5ab86698b9599a 100644 --- a/offscreen-canvas/drawing-images-to-the-canvas/2d.drawImage.wrongtype.worker.js +++ b/offscreen-canvas/drawing-images-to-the-canvas/2d.drawImage.wrongtype.worker.js @@ -16,9 +16,9 @@ t.step(function() { var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.drawImage(undefined, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.drawImage(0, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.drawImage("", 0, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage(undefined, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage(0, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.drawImage("", 0, 0); }); t.done(); }); diff --git a/offscreen-canvas/fill-and-stroke-styles/2d.gradient.linear.nonfinite.html b/offscreen-canvas/fill-and-stroke-styles/2d.gradient.linear.nonfinite.html index 51d48ac0fe13bd..b20299bdc6c043 100644 --- a/offscreen-canvas/fill-and-stroke-styles/2d.gradient.linear.nonfinite.html +++ b/offscreen-canvas/fill-and-stroke-styles/2d.gradient.linear.nonfinite.html @@ -20,29 +20,29 @@ <h1>2d.gradient.linear.nonfinite</h1> var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(-Infinity, 0, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(NaN, 0, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, -Infinity, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, NaN, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, Infinity, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, -Infinity, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, NaN, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1, -Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1, NaN); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, 1, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, Infinity, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, 1, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, Infinity, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, 1, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(-Infinity, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(NaN, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, -Infinity, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, NaN, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, -Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, NaN, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1, NaN); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, Infinity, Infinity); }); t.done(); }); diff --git a/offscreen-canvas/fill-and-stroke-styles/2d.gradient.linear.nonfinite.worker.js b/offscreen-canvas/fill-and-stroke-styles/2d.gradient.linear.nonfinite.worker.js index c8268b009937b0..5d9ad6883042f6 100644 --- a/offscreen-canvas/fill-and-stroke-styles/2d.gradient.linear.nonfinite.worker.js +++ b/offscreen-canvas/fill-and-stroke-styles/2d.gradient.linear.nonfinite.worker.js @@ -16,29 +16,29 @@ t.step(function() { var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(-Infinity, 0, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(NaN, 0, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, -Infinity, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, NaN, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, Infinity, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, -Infinity, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, NaN, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1, -Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, 1, NaN); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, 1, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, Infinity, 1, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, Infinity, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(Infinity, 0, 1, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, Infinity, 0); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, Infinity, 1, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createLinearGradient(0, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(-Infinity, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(NaN, 0, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, -Infinity, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, NaN, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, -Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, NaN, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, 1, NaN); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, 1, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, Infinity, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(Infinity, 0, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, Infinity, 0); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, Infinity, 1, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createLinearGradient(0, 0, Infinity, Infinity); }); t.done(); }); diff --git a/offscreen-canvas/fill-and-stroke-styles/2d.gradient.object.invalidoffset.html b/offscreen-canvas/fill-and-stroke-styles/2d.gradient.object.invalidoffset.html index d841895c97e8c3..23e5439d973b47 100644 --- a/offscreen-canvas/fill-and-stroke-styles/2d.gradient.object.invalidoffset.html +++ b/offscreen-canvas/fill-and-stroke-styles/2d.gradient.object.invalidoffset.html @@ -23,9 +23,9 @@ <h1>2d.gradient.object.invalidoffset</h1> var g = ctx.createLinearGradient(0, 0, 100, 0); assert_throws("INDEX_SIZE_ERR", function() { g.addColorStop(-1, '#000'); }); assert_throws("INDEX_SIZE_ERR", function() { g.addColorStop(2, '#000'); }); -assert_throws(new TypeError(), function() { g.addColorStop(Infinity, '#000'); }); -assert_throws(new TypeError(), function() { g.addColorStop(-Infinity, '#000'); }); -assert_throws(new TypeError(), function() { g.addColorStop(NaN, '#000'); }); +assert_throws_js(TypeError, function() { g.addColorStop(Infinity, '#000'); }); +assert_throws_js(TypeError, function() { g.addColorStop(-Infinity, '#000'); }); +assert_throws_js(TypeError, function() { g.addColorStop(NaN, '#000'); }); t.done(); }); diff --git a/offscreen-canvas/fill-and-stroke-styles/2d.gradient.object.invalidoffset.worker.js b/offscreen-canvas/fill-and-stroke-styles/2d.gradient.object.invalidoffset.worker.js index 23b5d7a3d856cd..8f7b8624a5ce8f 100644 --- a/offscreen-canvas/fill-and-stroke-styles/2d.gradient.object.invalidoffset.worker.js +++ b/offscreen-canvas/fill-and-stroke-styles/2d.gradient.object.invalidoffset.worker.js @@ -19,9 +19,9 @@ var ctx = offscreenCanvas.getContext('2d'); var g = ctx.createLinearGradient(0, 0, 100, 0); assert_throws("INDEX_SIZE_ERR", function() { g.addColorStop(-1, '#000'); }); assert_throws("INDEX_SIZE_ERR", function() { g.addColorStop(2, '#000'); }); -assert_throws(new TypeError(), function() { g.addColorStop(Infinity, '#000'); }); -assert_throws(new TypeError(), function() { g.addColorStop(-Infinity, '#000'); }); -assert_throws(new TypeError(), function() { g.addColorStop(NaN, '#000'); }); +assert_throws_js(TypeError, function() { g.addColorStop(Infinity, '#000'); }); +assert_throws_js(TypeError, function() { g.addColorStop(-Infinity, '#000'); }); +assert_throws_js(TypeError, function() { g.addColorStop(NaN, '#000'); }); t.done(); }); diff --git a/offscreen-canvas/fill-and-stroke-styles/2d.gradient.radial.nonfinite.html b/offscreen-canvas/fill-and-stroke-styles/2d.gradient.radial.nonfinite.html index ce657dec4c2573..207ebbc10d8787 100644 --- a/offscreen-canvas/fill-and-stroke-styles/2d.gradient.radial.nonfinite.html +++ b/offscreen-canvas/fill-and-stroke-styles/2d.gradient.radial.nonfinite.html @@ -20,81 +20,81 @@ <h1>2d.gradient.radial.nonfinite</h1> var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(-Infinity, 0, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(NaN, 0, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, -Infinity, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, NaN, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, -Infinity, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, NaN, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, -Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, NaN, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, -Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, NaN, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, 0, -Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, 0, NaN); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(-Infinity, 0, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(NaN, 0, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, -Infinity, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, NaN, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, -Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, NaN, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, -Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, NaN, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, -Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, NaN, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0, NaN); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, Infinity); }); t.done(); }); diff --git a/offscreen-canvas/fill-and-stroke-styles/2d.gradient.radial.nonfinite.worker.js b/offscreen-canvas/fill-and-stroke-styles/2d.gradient.radial.nonfinite.worker.js index 6a2d6e0eb04973..e07060cf2c0b5e 100644 --- a/offscreen-canvas/fill-and-stroke-styles/2d.gradient.radial.nonfinite.worker.js +++ b/offscreen-canvas/fill-and-stroke-styles/2d.gradient.radial.nonfinite.worker.js @@ -16,81 +16,81 @@ t.step(function() { var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(-Infinity, 0, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(NaN, 0, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, -Infinity, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, NaN, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, -Infinity, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, NaN, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, -Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, NaN, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, -Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, NaN, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, 0, -Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, 0, NaN); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, 1); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(-Infinity, 0, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(NaN, 0, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, -Infinity, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, NaN, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, -Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, NaN, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, -Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, NaN, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, -Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, NaN, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, 0, NaN); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, Infinity, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(Infinity, 0, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, Infinity, 1, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, Infinity, 0, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, 1); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, Infinity, 0, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createRadialGradient(0, 0, 1, 0, Infinity, Infinity); }); t.done(); }); diff --git a/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.null.html b/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.null.html index 193bb9dd4c01b3..0bf03d53d7f559 100644 --- a/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.null.html +++ b/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.null.html @@ -20,7 +20,7 @@ <h1>2d.pattern.image.null</h1> var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.createPattern(null, 'repeat'); }); +assert_throws_js(TypeError, function() { ctx.createPattern(null, 'repeat'); }); t.done(); }); diff --git a/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.null.worker.js b/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.null.worker.js index 6b5ad64c7c4652..73af4f44af1ad7 100644 --- a/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.null.worker.js +++ b/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.null.worker.js @@ -16,7 +16,7 @@ t.step(function() { var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.createPattern(null, 'repeat'); }); +assert_throws_js(TypeError, function() { ctx.createPattern(null, 'repeat'); }); t.done(); }); diff --git a/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.string.html b/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.string.html index 0722f8f28173f5..f38cddbcc5d594 100644 --- a/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.string.html +++ b/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.string.html @@ -20,7 +20,7 @@ <h1>2d.pattern.image.string</h1> var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.createPattern('../images/red.png', 'repeat'); }); +assert_throws_js(TypeError, function() { ctx.createPattern('../images/red.png', 'repeat'); }); t.done(); }); diff --git a/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.string.worker.js b/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.string.worker.js index c64f978c3fa9d7..bade91af85dea6 100644 --- a/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.string.worker.js +++ b/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.string.worker.js @@ -16,7 +16,7 @@ t.step(function() { var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.createPattern('../images/red.png', 'repeat'); }); +assert_throws_js(TypeError, function() { ctx.createPattern('../images/red.png', 'repeat'); }); t.done(); }); diff --git a/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.undefined.html b/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.undefined.html index 8dff9482813900..1d106cc075aba4 100644 --- a/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.undefined.html +++ b/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.undefined.html @@ -20,7 +20,7 @@ <h1>2d.pattern.image.undefined</h1> var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.createPattern(undefined, 'repeat'); }); +assert_throws_js(TypeError, function() { ctx.createPattern(undefined, 'repeat'); }); t.done(); }); diff --git a/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.undefined.worker.js b/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.undefined.worker.js index 52163c091c50c5..d53b19aed0c7e8 100644 --- a/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.undefined.worker.js +++ b/offscreen-canvas/fill-and-stroke-styles/2d.pattern.image.undefined.worker.js @@ -16,7 +16,7 @@ t.step(function() { var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.createPattern(undefined, 'repeat'); }); +assert_throws_js(TypeError, function() { ctx.createPattern(undefined, 'repeat'); }); t.done(); }); diff --git a/offscreen-canvas/pixel-manipulation/2d.imageData.create1.zero.html b/offscreen-canvas/pixel-manipulation/2d.imageData.create1.zero.html index 1000e44c863204..9c72eb1c6ce561 100644 --- a/offscreen-canvas/pixel-manipulation/2d.imageData.create1.zero.html +++ b/offscreen-canvas/pixel-manipulation/2d.imageData.create1.zero.html @@ -20,7 +20,7 @@ <h1>2d.imageData.create1.zero</h1> var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.createImageData(null); }); +assert_throws_js(TypeError, function() { ctx.createImageData(null); }); t.done(); }); diff --git a/offscreen-canvas/pixel-manipulation/2d.imageData.create1.zero.worker.js b/offscreen-canvas/pixel-manipulation/2d.imageData.create1.zero.worker.js index 693fc5927bfd58..dc35289fd39a36 100644 --- a/offscreen-canvas/pixel-manipulation/2d.imageData.create1.zero.worker.js +++ b/offscreen-canvas/pixel-manipulation/2d.imageData.create1.zero.worker.js @@ -16,7 +16,7 @@ t.step(function() { var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.createImageData(null); }); +assert_throws_js(TypeError, function() { ctx.createImageData(null); }); t.done(); }); diff --git a/offscreen-canvas/pixel-manipulation/2d.imageData.create2.nonfinite.html b/offscreen-canvas/pixel-manipulation/2d.imageData.create2.nonfinite.html index 6f8afc0303fa1d..ba25bd689e742c 100644 --- a/offscreen-canvas/pixel-manipulation/2d.imageData.create2.nonfinite.html +++ b/offscreen-canvas/pixel-manipulation/2d.imageData.create2.nonfinite.html @@ -20,23 +20,23 @@ <h1>2d.imageData.create2.nonfinite</h1> var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.createImageData(Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.createImageData(-Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.createImageData(NaN, 10); }); -assert_throws(new TypeError(), function() { ctx.createImageData(10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createImageData(10, -Infinity); }); -assert_throws(new TypeError(), function() { ctx.createImageData(10, NaN); }); -assert_throws(new TypeError(), function() { ctx.createImageData(Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(-Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, NaN); }); +assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, Infinity); }); var posinfobj = { valueOf: function() { return Infinity; } }, neginfobj = { valueOf: function() { return -Infinity; } }, nanobj = { valueOf: function() { return -Infinity; } }; -assert_throws(new TypeError(), function() { ctx.createImageData(posinfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.createImageData(neginfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.createImageData(nanobj, 10); }); -assert_throws(new TypeError(), function() { ctx.createImageData(10, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.createImageData(10, neginfobj); }); -assert_throws(new TypeError(), function() { ctx.createImageData(10, nanobj); }); -assert_throws(new TypeError(), function() { ctx.createImageData(posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(neginfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(nanobj, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, neginfobj); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, nanobj); }); +assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, posinfobj); }); t.done(); }); diff --git a/offscreen-canvas/pixel-manipulation/2d.imageData.create2.nonfinite.worker.js b/offscreen-canvas/pixel-manipulation/2d.imageData.create2.nonfinite.worker.js index 3f588b0ad6bdee..2c2e9dc2a0d275 100644 --- a/offscreen-canvas/pixel-manipulation/2d.imageData.create2.nonfinite.worker.js +++ b/offscreen-canvas/pixel-manipulation/2d.imageData.create2.nonfinite.worker.js @@ -16,23 +16,23 @@ t.step(function() { var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.createImageData(Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.createImageData(-Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.createImageData(NaN, 10); }); -assert_throws(new TypeError(), function() { ctx.createImageData(10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.createImageData(10, -Infinity); }); -assert_throws(new TypeError(), function() { ctx.createImageData(10, NaN); }); -assert_throws(new TypeError(), function() { ctx.createImageData(Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(-Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, NaN); }); +assert_throws_js(TypeError, function() { ctx.createImageData(Infinity, Infinity); }); var posinfobj = { valueOf: function() { return Infinity; } }, neginfobj = { valueOf: function() { return -Infinity; } }, nanobj = { valueOf: function() { return -Infinity; } }; -assert_throws(new TypeError(), function() { ctx.createImageData(posinfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.createImageData(neginfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.createImageData(nanobj, 10); }); -assert_throws(new TypeError(), function() { ctx.createImageData(10, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.createImageData(10, neginfobj); }); -assert_throws(new TypeError(), function() { ctx.createImageData(10, nanobj); }); -assert_throws(new TypeError(), function() { ctx.createImageData(posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(neginfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(nanobj, 10); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, neginfobj); }); +assert_throws_js(TypeError, function() { ctx.createImageData(10, nanobj); }); +assert_throws_js(TypeError, function() { ctx.createImageData(posinfobj, posinfobj); }); t.done(); }); diff --git a/offscreen-canvas/pixel-manipulation/2d.imageData.get.nonfinite.html b/offscreen-canvas/pixel-manipulation/2d.imageData.get.nonfinite.html index 8d30b552a4a10a..f40580e2345af5 100644 --- a/offscreen-canvas/pixel-manipulation/2d.imageData.get.nonfinite.html +++ b/offscreen-canvas/pixel-manipulation/2d.imageData.get.nonfinite.html @@ -20,55 +20,55 @@ <h1>2d.imageData.get.nonfinite</h1> var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(-Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(NaN, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, -Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, NaN, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, -Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, NaN, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, -Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, NaN); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(-Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(NaN, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, -Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, NaN, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, -Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, NaN); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, Infinity); }); var posinfobj = { valueOf: function() { return Infinity; } }, neginfobj = { valueOf: function() { return -Infinity; } }, nanobj = { valueOf: function() { return -Infinity; } }; -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(neginfobj, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(nanobj, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, posinfobj, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, neginfobj, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, nanobj, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, posinfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, neginfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, nanobj, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, neginfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, nanobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, posinfobj, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, posinfobj, 10, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, 10, posinfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, 10, posinfobj, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, 10, 10, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, posinfobj, posinfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, posinfobj, posinfobj, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, posinfobj, 10, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(neginfobj, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(nanobj, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, neginfobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, nanobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, neginfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, nanobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, neginfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, nanobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, posinfobj); }); t.done(); }); diff --git a/offscreen-canvas/pixel-manipulation/2d.imageData.get.nonfinite.worker.js b/offscreen-canvas/pixel-manipulation/2d.imageData.get.nonfinite.worker.js index b709ca6e99fce7..754fcf87d73b92 100644 --- a/offscreen-canvas/pixel-manipulation/2d.imageData.get.nonfinite.worker.js +++ b/offscreen-canvas/pixel-manipulation/2d.imageData.get.nonfinite.worker.js @@ -16,55 +16,55 @@ t.step(function() { var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(-Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(NaN, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, -Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, NaN, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, -Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, NaN, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, -Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, NaN); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(Infinity, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(-Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(NaN, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, -Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, NaN, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, -Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, NaN); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, Infinity, Infinity); }); var posinfobj = { valueOf: function() { return Infinity; } }, neginfobj = { valueOf: function() { return -Infinity; } }, nanobj = { valueOf: function() { return -Infinity; } }; -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(neginfobj, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(nanobj, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, posinfobj, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, neginfobj, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, nanobj, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, posinfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, neginfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, nanobj, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, neginfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, 10, nanobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, posinfobj, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, posinfobj, 10, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, 10, posinfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, 10, posinfobj, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(posinfobj, 10, 10, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, posinfobj, posinfobj, 10); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, posinfobj, posinfobj, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, posinfobj, 10, posinfobj); }); -assert_throws(new TypeError(), function() { ctx.getImageData(10, 10, posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(neginfobj, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(nanobj, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, neginfobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, nanobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, neginfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, nanobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, neginfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, 10, nanobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, posinfobj, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(posinfobj, 10, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, 10); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, posinfobj, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, posinfobj, 10, posinfobj); }); +assert_throws_js(TypeError, function() { ctx.getImageData(10, 10, posinfobj, posinfobj); }); t.done(); }); diff --git a/offscreen-canvas/pixel-manipulation/2d.imageData.put.nonfinite.html b/offscreen-canvas/pixel-manipulation/2d.imageData.put.nonfinite.html index 9519691b991f7a..357473121f2947 100644 --- a/offscreen-canvas/pixel-manipulation/2d.imageData.put.nonfinite.html +++ b/offscreen-canvas/pixel-manipulation/2d.imageData.put.nonfinite.html @@ -21,88 +21,88 @@ <h1>2d.imageData.put.nonfinite</h1> var ctx = offscreenCanvas.getContext('2d'); var imgdata = ctx.getImageData(0, 0, 10, 10); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, -Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, NaN, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, -Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, NaN); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, -Infinity, 10, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, NaN, 10, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, -Infinity, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, NaN, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, -Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, NaN, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, -Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, NaN, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, -Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, NaN, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, -Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, NaN); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, -Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, NaN, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, -Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, NaN, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, -Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, NaN); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, Infinity); }); t.done(); }); diff --git a/offscreen-canvas/pixel-manipulation/2d.imageData.put.nonfinite.worker.js b/offscreen-canvas/pixel-manipulation/2d.imageData.put.nonfinite.worker.js index 97b81d71eaccaa..c771a3ccbb5491 100644 --- a/offscreen-canvas/pixel-manipulation/2d.imageData.put.nonfinite.worker.js +++ b/offscreen-canvas/pixel-manipulation/2d.imageData.put.nonfinite.worker.js @@ -17,88 +17,88 @@ var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); var imgdata = ctx.getImageData(0, 0, 10, 10); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, -Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, NaN, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, -Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, NaN); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, -Infinity, 10, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, NaN, 10, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, -Infinity, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, NaN, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, -Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, NaN, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, -Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, NaN, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, -Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, NaN, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, -Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, NaN); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, 10); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, Infinity); }); -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, -Infinity, 10, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, NaN, 10, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, -Infinity, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, NaN, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, -Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, NaN, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, -Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, NaN, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, -Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, NaN, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, -Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, 10, NaN); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, Infinity, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, Infinity, 10, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, Infinity, 10, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, Infinity, 10, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, 10); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, Infinity, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, Infinity, 10, Infinity); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 10, 10, 10, 10, Infinity, Infinity); }); t.done(); }); diff --git a/offscreen-canvas/pixel-manipulation/2d.imageData.put.null.html b/offscreen-canvas/pixel-manipulation/2d.imageData.put.null.html index f36f93eeddd19b..aaf8e11a38e3fa 100644 --- a/offscreen-canvas/pixel-manipulation/2d.imageData.put.null.html +++ b/offscreen-canvas/pixel-manipulation/2d.imageData.put.null.html @@ -20,7 +20,7 @@ <h1>2d.imageData.put.null</h1> var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.putImageData(null, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.putImageData(null, 0, 0); }); t.done(); }); diff --git a/offscreen-canvas/pixel-manipulation/2d.imageData.put.null.worker.js b/offscreen-canvas/pixel-manipulation/2d.imageData.put.null.worker.js index e7c4b3bc0118bb..5f3417156be4dd 100644 --- a/offscreen-canvas/pixel-manipulation/2d.imageData.put.null.worker.js +++ b/offscreen-canvas/pixel-manipulation/2d.imageData.put.null.worker.js @@ -16,7 +16,7 @@ t.step(function() { var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); -assert_throws(new TypeError(), function() { ctx.putImageData(null, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.putImageData(null, 0, 0); }); t.done(); }); diff --git a/offscreen-canvas/pixel-manipulation/2d.imageData.put.wrongtype.html b/offscreen-canvas/pixel-manipulation/2d.imageData.put.wrongtype.html index 90700552371d34..95775e208aab92 100644 --- a/offscreen-canvas/pixel-manipulation/2d.imageData.put.wrongtype.html +++ b/offscreen-canvas/pixel-manipulation/2d.imageData.put.wrongtype.html @@ -21,9 +21,9 @@ <h1>2d.imageData.put.wrongtype</h1> var ctx = offscreenCanvas.getContext('2d'); var imgdata = { width: 1, height: 1, data: [255, 0, 0, 255] }; -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.putImageData("cheese", 0, 0); }); -assert_throws(new TypeError(), function() { ctx.putImageData(42, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.putImageData("cheese", 0, 0); }); +assert_throws_js(TypeError, function() { ctx.putImageData(42, 0, 0); }); t.done(); }); diff --git a/offscreen-canvas/pixel-manipulation/2d.imageData.put.wrongtype.worker.js b/offscreen-canvas/pixel-manipulation/2d.imageData.put.wrongtype.worker.js index 93dc33c07955cf..36437c291456a0 100644 --- a/offscreen-canvas/pixel-manipulation/2d.imageData.put.wrongtype.worker.js +++ b/offscreen-canvas/pixel-manipulation/2d.imageData.put.wrongtype.worker.js @@ -17,9 +17,9 @@ var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); var imgdata = { width: 1, height: 1, data: [255, 0, 0, 255] }; -assert_throws(new TypeError(), function() { ctx.putImageData(imgdata, 0, 0); }); -assert_throws(new TypeError(), function() { ctx.putImageData("cheese", 0, 0); }); -assert_throws(new TypeError(), function() { ctx.putImageData(42, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0, 0); }); +assert_throws_js(TypeError, function() { ctx.putImageData("cheese", 0, 0); }); +assert_throws_js(TypeError, function() { ctx.putImageData(42, 0, 0); }); t.done(); }); diff --git a/offscreen-canvas/the-offscreen-canvas/context.arguments.missing.html b/offscreen-canvas/the-offscreen-canvas/context.arguments.missing.html index ae8dd692148b3c..a8c7f5ce5c1828 100644 --- a/offscreen-canvas/the-offscreen-canvas/context.arguments.missing.html +++ b/offscreen-canvas/the-offscreen-canvas/context.arguments.missing.html @@ -21,7 +21,7 @@ <h1>context.arguments.missing</h1> var ctx = offscreenCanvas.getContext('2d'); var offscreenCanvas2 = new OffscreenCanvas(100, 50); -assert_throws(new TypeError(), function() { offscreenCanvas2.getContext(); }); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext(); }); t.done(); }); diff --git a/offscreen-canvas/the-offscreen-canvas/context.arguments.missing.worker.js b/offscreen-canvas/the-offscreen-canvas/context.arguments.missing.worker.js index 9dbd97c861a285..564790a23915b4 100644 --- a/offscreen-canvas/the-offscreen-canvas/context.arguments.missing.worker.js +++ b/offscreen-canvas/the-offscreen-canvas/context.arguments.missing.worker.js @@ -17,7 +17,7 @@ var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); var offscreenCanvas2 = new OffscreenCanvas(100, 50); -assert_throws(new TypeError(), function() { offscreenCanvas2.getContext(); }); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext(); }); t.done(); }); diff --git a/offscreen-canvas/the-offscreen-canvas/context.casesensitive.html b/offscreen-canvas/the-offscreen-canvas/context.casesensitive.html index 56431e2e4fc6c2..3a51e5468784c3 100644 --- a/offscreen-canvas/the-offscreen-canvas/context.casesensitive.html +++ b/offscreen-canvas/the-offscreen-canvas/context.casesensitive.html @@ -21,7 +21,7 @@ <h1>context.casesensitive</h1> var ctx = offscreenCanvas.getContext('2d'); var offscreenCanvas2 = new OffscreenCanvas(100, 50); -assert_throws(new TypeError(), function() { offscreenCanvas2.getContext('2D'); }); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext('2D'); }); t.done(); }); diff --git a/offscreen-canvas/the-offscreen-canvas/context.casesensitive.worker.js b/offscreen-canvas/the-offscreen-canvas/context.casesensitive.worker.js index b41c1f767f5388..e8d8b710a272fe 100644 --- a/offscreen-canvas/the-offscreen-canvas/context.casesensitive.worker.js +++ b/offscreen-canvas/the-offscreen-canvas/context.casesensitive.worker.js @@ -17,7 +17,7 @@ var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); var offscreenCanvas2 = new OffscreenCanvas(100, 50); -assert_throws(new TypeError(), function() { offscreenCanvas2.getContext('2D'); }); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext('2D'); }); t.done(); }); diff --git a/offscreen-canvas/the-offscreen-canvas/context.emptystring.html b/offscreen-canvas/the-offscreen-canvas/context.emptystring.html index 92f37506eaa44c..bb3c20211b8b84 100644 --- a/offscreen-canvas/the-offscreen-canvas/context.emptystring.html +++ b/offscreen-canvas/the-offscreen-canvas/context.emptystring.html @@ -21,7 +21,7 @@ <h1>context.emptystring</h1> var ctx = offscreenCanvas.getContext('2d'); var offscreenCanvas2 = new OffscreenCanvas(100, 50); -assert_throws(new TypeError(), function() { offscreenCanvas2.getContext(""); }); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext(""); }); t.done(); }); diff --git a/offscreen-canvas/the-offscreen-canvas/context.emptystring.worker.js b/offscreen-canvas/the-offscreen-canvas/context.emptystring.worker.js index 54406bb5bfe06a..fb172b21c2fd2e 100644 --- a/offscreen-canvas/the-offscreen-canvas/context.emptystring.worker.js +++ b/offscreen-canvas/the-offscreen-canvas/context.emptystring.worker.js @@ -17,7 +17,7 @@ var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); var offscreenCanvas2 = new OffscreenCanvas(100, 50); -assert_throws(new TypeError(), function() { offscreenCanvas2.getContext(""); }); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext(""); }); t.done(); }); diff --git a/offscreen-canvas/the-offscreen-canvas/context.unrecognised.badname.html b/offscreen-canvas/the-offscreen-canvas/context.unrecognised.badname.html index 8e846714fad82a..52f6bdade538d4 100644 --- a/offscreen-canvas/the-offscreen-canvas/context.unrecognised.badname.html +++ b/offscreen-canvas/the-offscreen-canvas/context.unrecognised.badname.html @@ -21,7 +21,7 @@ <h1>context.unrecognised.badname</h1> var ctx = offscreenCanvas.getContext('2d'); var offscreenCanvas2 = new OffscreenCanvas(100, 50); -assert_throws(new TypeError(), function() { offscreenCanvas2.getContext('This is not an implemented context in any real browser'); }); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext('This is not an implemented context in any real browser'); }); t.done(); }); diff --git a/offscreen-canvas/the-offscreen-canvas/context.unrecognised.badname.worker.js b/offscreen-canvas/the-offscreen-canvas/context.unrecognised.badname.worker.js index 855f997118b8b3..d9a08a50e3e38e 100644 --- a/offscreen-canvas/the-offscreen-canvas/context.unrecognised.badname.worker.js +++ b/offscreen-canvas/the-offscreen-canvas/context.unrecognised.badname.worker.js @@ -17,7 +17,7 @@ var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); var offscreenCanvas2 = new OffscreenCanvas(100, 50); -assert_throws(new TypeError(), function() { offscreenCanvas2.getContext('This is not an implemented context in any real browser'); }); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext('This is not an implemented context in any real browser'); }); t.done(); }); diff --git a/offscreen-canvas/the-offscreen-canvas/context.unrecognised.badsuffix.html b/offscreen-canvas/the-offscreen-canvas/context.unrecognised.badsuffix.html index 5511c4f21ec1ea..1c6c3f0679c16c 100644 --- a/offscreen-canvas/the-offscreen-canvas/context.unrecognised.badsuffix.html +++ b/offscreen-canvas/the-offscreen-canvas/context.unrecognised.badsuffix.html @@ -21,7 +21,7 @@ <h1>context.unrecognised.badsuffix</h1> var ctx = offscreenCanvas.getContext('2d'); var offscreenCanvas2 = new OffscreenCanvas(100, 50); -assert_throws(new TypeError(), function() { offscreenCanvas2.getContext("2d#"); }); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext("2d#"); }); t.done(); }); diff --git a/offscreen-canvas/the-offscreen-canvas/context.unrecognised.badsuffix.worker.js b/offscreen-canvas/the-offscreen-canvas/context.unrecognised.badsuffix.worker.js index c56ea7eb61538f..14905a8b67542c 100644 --- a/offscreen-canvas/the-offscreen-canvas/context.unrecognised.badsuffix.worker.js +++ b/offscreen-canvas/the-offscreen-canvas/context.unrecognised.badsuffix.worker.js @@ -17,7 +17,7 @@ var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); var offscreenCanvas2 = new OffscreenCanvas(100, 50); -assert_throws(new TypeError(), function() { offscreenCanvas2.getContext("2d#"); }); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext("2d#"); }); t.done(); }); diff --git a/offscreen-canvas/the-offscreen-canvas/context.unrecognised.nullsuffix.html b/offscreen-canvas/the-offscreen-canvas/context.unrecognised.nullsuffix.html index b8660ae7fc6da2..0ce674a837c502 100644 --- a/offscreen-canvas/the-offscreen-canvas/context.unrecognised.nullsuffix.html +++ b/offscreen-canvas/the-offscreen-canvas/context.unrecognised.nullsuffix.html @@ -21,7 +21,7 @@ <h1>context.unrecognised.nullsuffix</h1> var ctx = offscreenCanvas.getContext('2d'); var offscreenCanvas2 = new OffscreenCanvas(100, 50); -assert_throws(new TypeError(), function() { offscreenCanvas2.getContext("2d\0"); }); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext("2d\0"); }); t.done(); }); diff --git a/offscreen-canvas/the-offscreen-canvas/context.unrecognised.nullsuffix.worker.js b/offscreen-canvas/the-offscreen-canvas/context.unrecognised.nullsuffix.worker.js index efe45b9196bab9..def49a23655b66 100644 --- a/offscreen-canvas/the-offscreen-canvas/context.unrecognised.nullsuffix.worker.js +++ b/offscreen-canvas/the-offscreen-canvas/context.unrecognised.nullsuffix.worker.js @@ -17,7 +17,7 @@ var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); var offscreenCanvas2 = new OffscreenCanvas(100, 50); -assert_throws(new TypeError(), function() { offscreenCanvas2.getContext("2d\0"); }); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext("2d\0"); }); t.done(); }); diff --git a/offscreen-canvas/the-offscreen-canvas/context.unrecognised.unicode.html b/offscreen-canvas/the-offscreen-canvas/context.unrecognised.unicode.html index 89f2655d563674..6e041ad532906b 100644 --- a/offscreen-canvas/the-offscreen-canvas/context.unrecognised.unicode.html +++ b/offscreen-canvas/the-offscreen-canvas/context.unrecognised.unicode.html @@ -21,7 +21,7 @@ <h1>context.unrecognised.unicode</h1> var ctx = offscreenCanvas.getContext('2d'); var offscreenCanvas2 = new OffscreenCanvas(100, 50); -assert_throws(new TypeError(), function() { offscreenCanvas2.getContext("2\uFF44"); }); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext("2\uFF44"); }); t.done(); }); diff --git a/offscreen-canvas/the-offscreen-canvas/context.unrecognised.unicode.worker.js b/offscreen-canvas/the-offscreen-canvas/context.unrecognised.unicode.worker.js index a533117562d640..918fe58cad732f 100644 --- a/offscreen-canvas/the-offscreen-canvas/context.unrecognised.unicode.worker.js +++ b/offscreen-canvas/the-offscreen-canvas/context.unrecognised.unicode.worker.js @@ -17,7 +17,7 @@ var offscreenCanvas = new OffscreenCanvas(100, 50); var ctx = offscreenCanvas.getContext('2d'); var offscreenCanvas2 = new OffscreenCanvas(100, 50); -assert_throws(new TypeError(), function() { offscreenCanvas2.getContext("2\uFF44"); }); +assert_throws_js(TypeError, function() { offscreenCanvas2.getContext("2\uFF44"); }); t.done(); }); diff --git a/offscreen-canvas/the-offscreen-canvas/offscreencanvas.constructor.html b/offscreen-canvas/the-offscreen-canvas/offscreencanvas.constructor.html index a1760764dec276..cefe39d0fc80fe 100644 --- a/offscreen-canvas/the-offscreen-canvas/offscreencanvas.constructor.html +++ b/offscreen-canvas/the-offscreen-canvas/offscreencanvas.constructor.html @@ -24,19 +24,19 @@ assert_equals(offscreenCanvas1.width, 0); assert_equals(offscreenCanvas1.height, 0); - assert_throws(new TypeError(), function() { new OffscreenCanvas(-1, -1); }); + assert_throws_js(TypeError, function() { new OffscreenCanvas(-1, -1); }); var offscreenCanvas2 = new OffscreenCanvas(null, null); assert_equals(offscreenCanvas2.width, 0); assert_equals(offscreenCanvas2.height, 0); - assert_throws(new TypeError(), function() { offscreenCanvas2.width = -1; }); - assert_throws(new TypeError(), function() { offscreenCanvas2.height = -1; }); + assert_throws_js(TypeError, function() { offscreenCanvas2.width = -1; }); + assert_throws_js(TypeError, function() { offscreenCanvas2.height = -1; }); var obj = {Name: "John Doe", Age: 30}; - assert_throws(new TypeError(), function() { offscreenCanvas2.width = obj; }); - assert_throws(new TypeError(), function() { offscreenCanvas2.height = obj; }); - assert_throws(new TypeError(), function() { new OffscreenCanvas(obj, obj); }); + assert_throws_js(TypeError, function() { offscreenCanvas2.width = obj; }); + assert_throws_js(TypeError, function() { offscreenCanvas2.height = obj; }); + assert_throws_js(TypeError, function() { new OffscreenCanvas(obj, obj); }); }, "Test that OffscreenCanvas constructor handles invalid arguments correctly"); </script> diff --git a/offscreen-canvas/the-offscreen-canvas/offscreencanvas.constructor.worker.js b/offscreen-canvas/the-offscreen-canvas/offscreencanvas.constructor.worker.js index 285e4e1d948764..a9331101350dbe 100644 --- a/offscreen-canvas/the-offscreen-canvas/offscreencanvas.constructor.worker.js +++ b/offscreen-canvas/the-offscreen-canvas/offscreencanvas.constructor.worker.js @@ -25,19 +25,19 @@ t2.step(function() { assert_equals(offscreenCanvas1.width, 0); assert_equals(offscreenCanvas1.height, 0); - assert_throws(new TypeError(), function() { new OffscreenCanvas(-1, -1); }); + assert_throws_js(TypeError, function() { new OffscreenCanvas(-1, -1); }); var offscreenCanvas2 = new OffscreenCanvas(null, null); assert_equals(offscreenCanvas2.width, 0); assert_equals(offscreenCanvas2.height, 0); - assert_throws(new TypeError(), function() { offscreenCanvas2.width = -1; }); - assert_throws(new TypeError(), function() { offscreenCanvas2.height = -1; }); + assert_throws_js(TypeError, function() { offscreenCanvas2.width = -1; }); + assert_throws_js(TypeError, function() { offscreenCanvas2.height = -1; }); var obj = {Name: "John Doe", Age: 30}; - assert_throws(new TypeError(), function() { offscreenCanvas2.width = obj; }); - assert_throws(new TypeError(), function() { offscreenCanvas2.height = obj; }); - assert_throws(new TypeError(), function() { new OffscreenCanvas(obj, obj); }); + assert_throws_js(TypeError, function() { offscreenCanvas2.width = obj; }); + assert_throws_js(TypeError, function() { offscreenCanvas2.height = obj; }); + assert_throws_js(TypeError, function() { new OffscreenCanvas(obj, obj); }); t2.done(); }); diff --git a/offscreen-canvas/the-offscreen-canvas/offscreencanvas.getcontext.html b/offscreen-canvas/the-offscreen-canvas/offscreencanvas.getcontext.html index 7aaa0e6c36a7a1..0cb0abcc3b18a6 100644 --- a/offscreen-canvas/the-offscreen-canvas/offscreencanvas.getcontext.html +++ b/offscreen-canvas/the-offscreen-canvas/offscreencanvas.getcontext.html @@ -7,7 +7,7 @@ test(function() { var offscreenCanvas = new OffscreenCanvas(1, 1); - assert_throws(new TypeError(), function() { offscreenCanvas.getContext('3d'); }); + assert_throws_js(TypeError, function() { offscreenCanvas.getContext('3d'); }); }, "Test that getContext with un-supported string throws a TypeError."); test(function() { diff --git a/offscreen-canvas/the-offscreen-canvas/offscreencanvas.getcontext.worker.js b/offscreen-canvas/the-offscreen-canvas/offscreencanvas.getcontext.worker.js index ced412fb8945d1..d82b5a1c8d7cde 100644 --- a/offscreen-canvas/the-offscreen-canvas/offscreencanvas.getcontext.worker.js +++ b/offscreen-canvas/the-offscreen-canvas/offscreencanvas.getcontext.worker.js @@ -5,7 +5,7 @@ importScripts("/2dcontext/resources/canvas-tests.js"); test(function() { var offscreenCanvas = new OffscreenCanvas(1, 1); - assert_throws(new TypeError(), function() { offscreenCanvas.getContext('3d'); }); + assert_throws_js(TypeError, function() { offscreenCanvas.getContext('3d'); }); }, "Test that getContext with un-supported string throws a TypeError."); test(function() { diff --git a/payment-method-id/payment-request-ctor-pmi-handling.https.html b/payment-method-id/payment-request-ctor-pmi-handling.https.html index 5f888f0389f6c7..4ef083ebb4f224 100644 --- a/payment-method-id/payment-request-ctor-pmi-handling.https.html +++ b/payment-method-id/payment-request-ctor-pmi-handling.https.html @@ -111,8 +111,8 @@ ["visa","mastercard"], // stringifies to "visa,mastercard" ]; for (const invalidMethod of invalidMethods) { - assert_throws( - new RangeError(), + assert_throws_js( + RangeError, () => { const methods = [{ supportedMethods: invalidMethod }]; new PaymentRequest(methods, defaultDetails); @@ -135,8 +135,8 @@ "https://", ]; for (const invalidMethod of invalidMethods) { - assert_throws( - new RangeError(), + assert_throws_js( + RangeError, () => { const methods = [{ supportedMethods: invalidMethod }]; new PaymentRequest(methods, defaultDetails); diff --git a/payment-request/MerchantValidationEvent/constructor.https.html b/payment-request/MerchantValidationEvent/constructor.https.html index da30fef0019880..9fdf78ddb3dea4 100644 --- a/payment-request/MerchantValidationEvent/constructor.https.html +++ b/payment-request/MerchantValidationEvent/constructor.https.html @@ -64,7 +64,7 @@ test(() => { const validationURL = "http://\u005B"; // invalid URL - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new MerchantValidationEvent("test", { validationURL }); }); }, "Must throw TypeError if initialized with an invalid URL."); @@ -135,8 +135,8 @@ "unknown://example.com/pay", ]; for (const methodName of invalidPMIs) { - assert_throws( - new RangeError(), + assert_throws_js( + RangeError, () => { const event = new MerchantValidationEvent("test", { methodName }); }, diff --git a/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html b/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html index 226fd88ff84ab5..898e1916ca55d6 100644 --- a/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html +++ b/payment-request/PaymentAddress/attributes-and-toJSON-method-manual.https.html @@ -28,8 +28,8 @@ addr.addressLine instanceof Array, "Expected addressLine to be an array" ); - assert_throws( - new TypeError(), + assert_throws_js( + TypeError, () => { addr.addressLine.push("this must throw"); }, diff --git a/payment-request/constructor_convert_method_data.https.html b/payment-request/constructor_convert_method_data.https.html index 56866b43a481e7..f4a9a721d07c91 100644 --- a/payment-request/constructor_convert_method_data.https.html +++ b/payment-request/constructor_convert_method_data.https.html @@ -32,8 +32,8 @@ for (const supportedMethods of [].concat(knownPMIs).concat(unknownPMIs)) { const method = { supportedMethods }; const request = new PaymentRequest([method], details); - assert_throws( - new TypeError(), + assert_throws_js( + TypeError, () => { const badMethod = Object.assign( {}, @@ -55,8 +55,8 @@ // Only check the PMIs that are actually supported if (!(await request.canMakePayment())) continue; - assert_throws( - new TypeError(), + assert_throws_js( + TypeError, () => { const badMethod = Object.assign( {}, diff --git a/payment-request/payment-request-constructor.https.html b/payment-request/payment-request-constructor.https.html index 99c25d1723459b..43b9588397e5de 100644 --- a/payment-request/payment-request-constructor.https.html +++ b/payment-request/payment-request-constructor.https.html @@ -108,7 +108,7 @@ test(() => { smokeTest(); - assert_throws(new TypeError(), () => new PaymentRequest([], defaultDetails)); + assert_throws_js(TypeError, () => new PaymentRequest([], defaultDetails)); }, "If the length of the methodData sequence is zero, then throw a TypeError"); test(() => { @@ -137,7 +137,7 @@ smokeTest(); const recursiveDictionary = {}; recursiveDictionary.foo = recursiveDictionary; - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { const methods = [ { supportedMethods: "https://wpt.fyi/payment-request", @@ -146,7 +146,7 @@ ]; new PaymentRequest(methods, defaultDetails); }); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { const methods = [ { supportedMethods: "https://wpt.fyi/payment-request", @@ -155,8 +155,8 @@ ]; new PaymentRequest(methods, defaultDetails); }); - assert_throws( - new TypeError(), + assert_throws_js( + TypeError, () => { const methods = [ { @@ -215,8 +215,8 @@ }, }, }; - assert_throws( - new TypeError(), + assert_throws_js( + TypeError, () => { new PaymentRequest(defaultMethods, invalidDetails); }, @@ -238,7 +238,7 @@ test(() => { smokeTest(); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new PaymentRequest(defaultMethods, { total: { label: "", @@ -266,8 +266,8 @@ }, ], }; - assert_throws( - new TypeError(), + assert_throws_js( + TypeError, () => { new PaymentRequest(defaultMethods, invalidDetails); }, @@ -372,8 +372,8 @@ const details = Object.assign({}, defaultDetails, { shippingOptions: [invalidShippingOption], }); - assert_throws( - new TypeError(), + assert_throws_js( + TypeError, () => { new PaymentRequest(defaultMethods, details, { requestShipping: true }); }, @@ -490,8 +490,8 @@ null, "shippingOption must be null, because requestShipping is false" ); - assert_throws( - new TypeError(), + assert_throws_js( + TypeError, () => { new PaymentRequest(defaultMethods, details, { requestShipping: true }); }, @@ -519,8 +519,8 @@ null, "shippingOption must be null, because requestShipping is false" ); - assert_throws( - new TypeError(), + assert_throws_js( + TypeError, () => { new PaymentRequest(defaultMethods, details, { requestShipping: true }); }, @@ -542,8 +542,8 @@ }, }, }; - assert_throws( - new TypeError(), + assert_throws_js( + TypeError, () => { new PaymentRequest(defaultMethods, { modifiers: [invalidModifier], @@ -571,8 +571,8 @@ }, ], }; - assert_throws( - new TypeError(), + assert_throws_js( + TypeError, () => { new PaymentRequest(defaultMethods, { modifiers: [invalidModifier], @@ -636,7 +636,7 @@ }, ], }); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new PaymentRequest(defaultMethods, modifiedDetails); }); }, "Rethrow any exceptions of JSON-serializing modifier.data"); @@ -644,7 +644,7 @@ //Setting ShippingType attribute during construction test(() => { smokeTest(); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new PaymentRequest(defaultMethods, defaultDetails, { shippingType: "invalid", }); diff --git a/payment-request/payment-request-ctor-pmi-handling.https.html b/payment-request/payment-request-ctor-pmi-handling.https.html index 5f888f0389f6c7..4ef083ebb4f224 100644 --- a/payment-request/payment-request-ctor-pmi-handling.https.html +++ b/payment-request/payment-request-ctor-pmi-handling.https.html @@ -111,8 +111,8 @@ ["visa","mastercard"], // stringifies to "visa,mastercard" ]; for (const invalidMethod of invalidMethods) { - assert_throws( - new RangeError(), + assert_throws_js( + RangeError, () => { const methods = [{ supportedMethods: invalidMethod }]; new PaymentRequest(methods, defaultDetails); @@ -135,8 +135,8 @@ "https://", ]; for (const invalidMethod of invalidMethods) { - assert_throws( - new RangeError(), + assert_throws_js( + RangeError, () => { const methods = [{ supportedMethods: invalidMethod }]; new PaymentRequest(methods, defaultDetails); diff --git a/performance-timeline/po-observe-type.any.js b/performance-timeline/po-observe-type.any.js index 5cdac973becb72..06e1b3b526fcad 100644 --- a/performance-timeline/po-observe-type.any.js +++ b/performance-timeline/po-observe-type.any.js @@ -18,7 +18,7 @@ test(() => { test(() => { const obs = new PerformanceObserver(() =>{}); - assert_throws(new SyntaxError(), function () { + assert_throws_dom("SyntaxError", function () { obs.observe({type: "mark", entryTypes: ["measure"]}); }); }, "Calling observe() with type and entryTypes should throw a SyntaxError"); diff --git a/performance-timeline/po-observe.any.js b/performance-timeline/po-observe.any.js index 6a673dbe784ed5..7d7de376b25ceb 100644 --- a/performance-timeline/po-observe.any.js +++ b/performance-timeline/po-observe.any.js @@ -2,16 +2,16 @@ test(function () { var obs = new PerformanceObserver(function () { return true; }); - assert_throws(new SyntaxError(), function () { + assert_throws_dom("SyntaxError", function () { obs.observe({}); }); - assert_throws(new SyntaxError(), function () { + assert_throws_dom("SyntaxError", function () { obs.observe({entryType: []}); }); }, "no 'type' or 'entryTypes' throws a SyntaxError"); test(function () { var obs = new PerformanceObserver(function () { return true; }); - assert_throws(new TypeError(), function () { + assert_throws_js(TypeError, function () { obs.observe({entryTypes: "mark"}); }); }, "entryTypes must be a sequence or throw a TypeError"); diff --git a/presentation-api/controlling-ua/PresentationRequest_error.https.html b/presentation-api/controlling-ua/PresentationRequest_error.https.html index cb22b4368ab05e..da252b9ef2f68b 100644 --- a/presentation-api/controlling-ua/PresentationRequest_error.https.html +++ b/presentation-api/controlling-ua/PresentationRequest_error.https.html @@ -9,7 +9,7 @@ <script> test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new PresentationRequest(); }, 'Call PresentationRequest() constructor without presentation URL. TypeError Exception expected.'); diff --git a/presentation-api/controlling-ua/defaultRequest.https.html b/presentation-api/controlling-ua/defaultRequest.https.html index bc07e02748c73c..713cea7f9aebbd 100644 --- a/presentation-api/controlling-ua/defaultRequest.https.html +++ b/presentation-api/controlling-ua/defaultRequest.https.html @@ -14,7 +14,7 @@ navigator.presentation.defaultRequest = request; assert_equals(navigator.presentation.defaultRequest, request, 'The default presentation request is set to an instance of PresentationRequest.'); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { navigator.presentation.defaultRequest = {}; }, 'The default presentation request cannot be set to any value but an instance of PresentationRequest or null.'); diff --git a/priority-hints/fetch-api-request.tentative.any.js b/priority-hints/fetch-api-request.tentative.any.js index e492d87d4f2fc4..0c10a3e2f96ecc 100644 --- a/priority-hints/fetch-api-request.tentative.any.js +++ b/priority-hints/fetch-api-request.tentative.any.js @@ -1,5 +1,5 @@ test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new Request("", {importance: 'invalid'}); }, "a new Request() must throw a TypeError if RequestInit's importance is an invalid value"); }, "new Request() throws a TypeError if any of RequestInit's members' values are invalid"); diff --git a/resources/test/tests/unit/IdlArray/is_json_type.html b/resources/test/tests/unit/IdlArray/is_json_type.html index 463d2b45309652..ab068b29cac0d7 100644 --- a/resources/test/tests/unit/IdlArray/is_json_type.html +++ b/resources/test/tests/unit/IdlArray/is_json_type.html @@ -171,13 +171,13 @@ test(function() { var idl = new IdlArray(); - assert_throws(new Error(), _ => idl.is_json_type(typeFrom("Foo"))); + assert_throws_js(Error, _ => idl.is_json_type(typeFrom("Foo"))); }, "should throw if it references a dictionary, enum or interface which wasn't added to the IdlArray"); test(function() { var idl = new IdlArray(); idl.add_untested_idls('interface Foo : Bar { };'); - assert_throws(new Error(), _ => idl.is_json_type(typeFrom("Foo"))); + assert_throws_js(Error, _ => idl.is_json_type(typeFrom("Foo"))); }, "should throw for interfaces which inherit from another interface which wasn't added to the IdlArray"); test(function() { diff --git a/resources/test/tests/unit/IdlDictionary/get_inheritance_stack.html b/resources/test/tests/unit/IdlDictionary/get_inheritance_stack.html index 1ac9e8da06fe59..052592dd4607db 100644 --- a/resources/test/tests/unit/IdlDictionary/get_inheritance_stack.html +++ b/resources/test/tests/unit/IdlDictionary/get_inheritance_stack.html @@ -19,7 +19,7 @@ test(function() { var d = dictionaryFrom('dictionary A : B { };'); - assert_throws(new Error(), _ => d.get_inheritance_stack()); + assert_throws_js(Error, _ => d.get_inheritance_stack()); }, "should throw for dictionaries which inherit from another dictionary which wasn't added to the IdlArray"); test(function() { diff --git a/resources/test/tests/unit/IdlInterface/get_inheritance_stack.html b/resources/test/tests/unit/IdlInterface/get_inheritance_stack.html index 66b79afc12f2fd..7e9188c7318920 100644 --- a/resources/test/tests/unit/IdlInterface/get_inheritance_stack.html +++ b/resources/test/tests/unit/IdlInterface/get_inheritance_stack.html @@ -19,7 +19,7 @@ test(function() { var i = interfaceFrom('interface A : B { };'); - assert_throws(new Error(), _ => i.get_inheritance_stack()); + assert_throws_js(Error, _ => i.get_inheritance_stack()); }, "should throw for interfaces which inherit from another interface which wasn't added to the IdlArray"); test(function() { diff --git a/resources/test/tests/unit/IdlInterface/traverse_inherited_and_consequential_interfaces.html b/resources/test/tests/unit/IdlInterface/traverse_inherited_and_consequential_interfaces.html index 400bc35d9fc7b0..94b956db6eed1e 100644 --- a/resources/test/tests/unit/IdlInterface/traverse_inherited_and_consequential_interfaces.html +++ b/resources/test/tests/unit/IdlInterface/traverse_inherited_and_consequential_interfaces.html @@ -35,13 +35,13 @@ test(function() { var context = new IdlArray(); context.add_idls("interface A { }; A includes B;"); - assert_throws(new Error(), _ => context.members["A"].traverse_inherited_and_consequential_interfaces(function() {})); + assert_throws_js(Error, _ => context.members["A"].traverse_inherited_and_consequential_interfaces(function() {})); }, "should throw for interfaces which are extended by another interface which wasn't added to the IdlArray."); test(function() { var context = new IdlArray(); context.add_idls("interface A { };"); - assert_throws(new TypeError(), _ => context.members["A"].traverse_inherited_and_consequential_interfaces()); + assert_throws_js(TypeError, _ => context.members["A"].traverse_inherited_and_consequential_interfaces()); }, "should throw if not passed a callback"); test(function() { diff --git a/scroll-animations/constructor.html b/scroll-animations/constructor.html index a449b32d2be4bf..d2c39e55bde109 100644 --- a/scroll-animations/constructor.html +++ b/scroll-animations/constructor.html @@ -182,7 +182,7 @@ new ScrollTimeline( {timeRange: 100, startScrollOffset: offset, endScrollOffset: offset}) }; - assert_throws(new TypeError(), constructorFunc); + assert_throws_js(TypeError, constructorFunc); }, '\'' + offset + '\' is an invalid scroll offset value'); } @@ -193,7 +193,7 @@ new ScrollTimeline( {timeRange: 100, startScrollOffset: offset, endScrollOffset: offset}); }; - assert_throws(new TypeError(), constructorFunc); + assert_throws_js(TypeError, constructorFunc); }, '\'' + suffix + '\' is an invalid scroll offset unit'); } @@ -230,7 +230,7 @@ const constructorFunc = function() { new ScrollTimeline({timeRange: timeRange}); }; - assert_throws(new TypeError(), constructorFunc); + assert_throws_js(TypeError, constructorFunc); }, '\'' + timeRange + '\' is an invalid timeRange value'); } diff --git a/scroll-animations/setting-current-time.html b/scroll-animations/setting-current-time.html index 7a77f17509c6ff..dd2abb47d39844 100644 --- a/scroll-animations/setting-current-time.html +++ b/scroll-animations/setting-current-time.html @@ -53,7 +53,7 @@ await animation.ready; - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { animation.currentTime = null; }); }, 'Setting animation current time to null throws TypeError.'); diff --git a/selection/removeRange.html b/selection/removeRange.html index 6ddccc66f225d4..b22f1e39fe1662 100644 --- a/selection/removeRange.html +++ b/selection/removeRange.html @@ -40,8 +40,8 @@ test(function() { var selection = getSelection(); - assert_throws(new TypeError(), function() { selection.removeRange(null); }); - assert_throws(new TypeError(), function() { selection.removeRange(selection); }); + assert_throws_js(TypeError, function() { selection.removeRange(null); }); + assert_throws_js(TypeError, function() { selection.removeRange(selection); }); }, 'removeRange() argument is non-optional Range'); </script> </body> diff --git a/service-workers/cache-storage/script-tests/cache-put.js b/service-workers/cache-storage/script-tests/cache-put.js index 38d25647b34e71..6979d96d161618 100644 --- a/service-workers/cache-storage/script-tests/cache-put.js +++ b/service-workers/cache-storage/script-tests/cache-put.js @@ -293,7 +293,7 @@ cache_test(function(cache) { var response = new Response(test_body); return cache.put(new Request(test_url), response) .then(function() { - assert_throws(new TypeError(), () => response.body.getReader()); + assert_throws_js(TypeError, () => response.body.getReader()); }); }, 'getReader() after Cache.put'); diff --git a/speech-api/SpeechSynthesisErrorEvent-constructor.html b/speech-api/SpeechSynthesisErrorEvent-constructor.html index 61e179cca47b70..abefbf9a51cdae 100644 --- a/speech-api/SpeechSynthesisErrorEvent-constructor.html +++ b/speech-api/SpeechSynthesisErrorEvent-constructor.html @@ -11,33 +11,33 @@ }; */ test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new SpeechSynthesisErrorEvent(); }); }, "SpeechSynthesisErrorEvent with no arguments throws TypeError"); test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new SpeechSynthesisErrorEvent("type"); }); }, "SpeechSynthesisErrorEvent with no eventInitDict throws TypeError"); test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new SpeechSynthesisErrorEvent("type", {}); }); }, `SpeechSynthesisErrorEvent with empty eventInitDict throws TypeError (requires utterance and error)`); test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new SpeechSynthesisErrorEvent("type", {error:"not-allowed"}); }); }, `SpeechSynthesisErrorEvent with eventInitDict without utterance throws TypeError`); test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new SpeechSynthesisErrorEvent("type", {utterance: new SpeechSynthesisUtterance()}); }); }, `SpeechSynthesisErrorEvent with eventInitDict without error throws @@ -81,8 +81,8 @@ }); }; }; - assert_throws(new TypeError(), createEventFunc("")); - assert_throws(new TypeError(), createEventFunc("foo")); - assert_throws(new TypeError(), createEventFunc("bar")); + assert_throws_js(TypeError, createEventFunc("")); + assert_throws_js(TypeError, createEventFunc("foo")); + assert_throws_js(TypeError, createEventFunc("bar")); }, "SpeechSynthesisErrorEvent with wrong error enum"); </script> diff --git a/speech-api/SpeechSynthesisEvent-constructor.html b/speech-api/SpeechSynthesisEvent-constructor.html index 3ad6886b0aa9b4..e6b29683f79d83 100644 --- a/speech-api/SpeechSynthesisEvent-constructor.html +++ b/speech-api/SpeechSynthesisEvent-constructor.html @@ -14,26 +14,26 @@ }; */ test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new SpeechSynthesisEvent(); }); }, "SpeechSynthesisEvent with no arguments throws TypeError"); test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new SpeechSynthesisEvent("type"); }); }, "SpeechSynthesisEvent with no eventInitDict throws TypeError"); test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new SpeechSynthesisEvent("type", {}); }); }, `SpeechSynthesisEvent with empty eventInitDict throws TypeError (requires utterance)`); test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new SpeechSynthesisEvent("type", {charIndex: 10, elapsedTime: 50, name:"foo"}); }); }, `SpeechSynthesisEvent with eventInitDict not having utterance throws diff --git a/std-toast/actions.html b/std-toast/actions.html index d07e5fd3d62694..6a80def09985f2 100644 --- a/std-toast/actions.html +++ b/std-toast/actions.html @@ -122,14 +122,14 @@ testToastElement((toast) => { const text = document.createTextNode('some text'); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { toast.action = text; }); }, 'setting the action to an invalid type (Text node) throws an error'); testToastElement((toast) => { const text = 'some text'; - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { toast.action = text; }); }, 'setting the action to an invalid type (string) throws an error'); @@ -171,7 +171,7 @@ const fakeElement = {}; const toast = showToast('Message'); - assert_throws(new TypeError(), () => toast.action = fakeElement); + assert_throws_js(TypeError, () => toast.action = fakeElement); } finally { delete Element[Symbol.hasInstance]; } diff --git a/std-toast/options.html b/std-toast/options.html index 9f53bf88601ce9..0383d71f9ae9ff 100644 --- a/std-toast/options.html +++ b/std-toast/options.html @@ -116,13 +116,13 @@ }, 'passing Infinity as the duration leaves the toast open for at least 50ms'); test(() => { - assert_throws(new RangeError(), () => { + assert_throws_js(RangeError, () => { const toast = showToast('Message', {duration: 0}); }); }, 'setting the duration to 0 throws a RangeError'); test(() => { - assert_throws(new RangeError(), () => { + assert_throws_js(RangeError, () => { const toast = showToast('Message', {duration: -5}); }); }, 'setting the duration to a negative number throws a RangeError'); diff --git a/streams/piping/pipe-through.any.js b/streams/piping/pipe-through.any.js index 92d1394ca2f0ab..0c8be230213fde 100644 --- a/streams/piping/pipe-through.any.js +++ b/streams/piping/pipe-through.any.js @@ -99,7 +99,7 @@ test(t => { const badReadables = [null, undefined, 0, NaN, true, 'ReadableStream', Object.create(ReadableStream.prototype)]; for (const readable of badReadables) { test(() => { - assert_throws(new TypeError(), + assert_throws_js(TypeError, ReadableStream.prototype.pipeThrough.bind(readable, uninterestingReadableWritablePair()), 'pipeThrough should throw'); }, `pipeThrough should brand-check this and not allow '${readable}'`); @@ -108,7 +108,7 @@ for (const readable of badReadables) { const rs = new ReadableStream(); const writable = new WritableStream(); let writableGetterCalled = false; - assert_throws(new TypeError(), () => rs.pipeThrough({ + assert_throws_js(TypeError, () => rs.pipeThrough({ get writable() { writableGetterCalled = true; return new WritableStream(); @@ -129,7 +129,7 @@ for (const writable of badWritables) { } }); let readableGetterCalled = false; - assert_throws(new TypeError(), () => rs.pipeThrough({ + assert_throws_js(TypeError, () => rs.pipeThrough({ get readable() { readableGetterCalled = true; return new ReadableStream(); @@ -175,7 +175,7 @@ const badSignals = [null, 0, NaN, true, 'AbortSignal', Object.create(AbortSignal for (const signal of badSignals) { test(() => { const rs = new ReadableStream(); - assert_throws(new TypeError(), () => rs.pipeThrough(uninterestingReadableWritablePair(), { signal }), + assert_throws_js(TypeError, () => rs.pipeThrough(uninterestingReadableWritablePair(), { signal }), 'pipeThrough should throw'); }, `invalid values of signal should throw; specifically '${signal}'`); } @@ -190,7 +190,7 @@ test(() => { test(() => { const rs = new ReadableStream(); rs.getReader(); - assert_throws(new TypeError(), () => rs.pipeThrough(uninterestingReadableWritablePair()), + assert_throws_js(TypeError, () => rs.pipeThrough(uninterestingReadableWritablePair()), 'pipeThrough should throw'); }, 'pipeThrough should throw if this is locked'); @@ -199,7 +199,7 @@ test(() => { const writable = new WritableStream(); const readable = new ReadableStream(); writable.getWriter(); - assert_throws(new TypeError(), () => rs.pipeThrough({writable, readable}), + assert_throws_js(TypeError, () => rs.pipeThrough({writable, readable}), 'pipeThrough should throw'); }, 'pipeThrough should throw if writable is locked'); @@ -258,7 +258,7 @@ test(() => { const rs = new ReadableStream(); const readable = new ReadableStream(); const writable = new WritableStream(); - assert_throws(new TypeError(), () => rs.pipeThrough({readable, writable}, { + assert_throws_js(TypeError, () => rs.pipeThrough({readable, writable}, { get preventAbort() { writable.getWriter(); } diff --git a/streams/piping/throwing-options.any.js b/streams/piping/throwing-options.any.js index 6fab32cc6dcf4c..68fac571114beb 100644 --- a/streams/piping/throwing-options.any.js +++ b/streams/piping/throwing-options.any.js @@ -53,8 +53,8 @@ for (let i = 0; i < checkOrder.length; ++i) { test(() => { const options = new ThrowingOptions(whatShouldThrow); - assert_throws( - new Error(), + assert_throws_js( + Error, () => new ReadableStream().pipeThrough(new TransformStream(), options), 'pipeThrough should throw'); assert_array_equals( diff --git a/streams/readable-byte-streams/brand-checks.any.js b/streams/readable-byte-streams/brand-checks.any.js index e4d5e26e84385b..9bbe7111ea8ddf 100644 --- a/streams/readable-byte-streams/brand-checks.any.js +++ b/streams/readable-byte-streams/brand-checks.any.js @@ -72,7 +72,7 @@ function realRBSController() { test(() => { - assert_throws(new TypeError(), () => new ReadableStreamBYOBReader(fakeRS()), 'constructor should throw'); + assert_throws_js(TypeError, () => new ReadableStreamBYOBReader(fakeRS()), 'constructor should throw'); }, 'ReadableStreamBYOBReader enforces a brand check on its argument'); @@ -106,14 +106,14 @@ test(() => { test(() => { - assert_throws(new TypeError(), () => new ReadableByteStreamController(fakeRS()), + assert_throws_js(TypeError, () => new ReadableByteStreamController(fakeRS()), 'Constructing a ReadableByteStreamController should throw'); }, 'ReadableByteStreamController enforces a brand check on its arguments'); test(() => { - assert_throws(new TypeError(), () => new ReadableByteStreamController(realRS()), + assert_throws_js(TypeError, () => new ReadableByteStreamController(realRS()), 'Constructing a ReadableByteStreamController should throw'); }, 'ReadableByteStreamController can\'t be given a fully-constructed ReadableStream'); @@ -174,7 +174,7 @@ promise_test(t => { function brandChecks() { for (const badController of [fakeRBSController(), realRS(), realRSBYOBReader(), undefined, null]) { - assert_throws(new TypeError(), () => new ReadableStreamBYOBRequest(badController, new Uint8Array(1)), + assert_throws_js(TypeError, () => new ReadableStreamBYOBRequest(badController, new Uint8Array(1)), 'ReadableStreamBYOBRequest constructor must throw for an invalid controller argument'); } getterThrowsForAll(ReadableStreamBYOBRequest.prototype, 'view', diff --git a/streams/readable-byte-streams/construct-byob-request.any.js b/streams/readable-byte-streams/construct-byob-request.any.js index 428cdeb76aeab5..2e1c53fdea8779 100644 --- a/streams/readable-byte-streams/construct-byob-request.any.js +++ b/streams/readable-byte-streams/construct-byob-request.any.js @@ -48,7 +48,7 @@ function runTests(ReadableStreamBYOBRequest) { for (const viewType of dummyTypes) { const view = createDummyObject(Uint8Array.prototype, viewType, () => new Uint8Array(16)); test(() => { - assert_throws(new TypeError(), () => new ReadableStreamBYOBRequest(controller, view), + assert_throws_js(TypeError, () => new ReadableStreamBYOBRequest(controller, view), 'constructor should throw'); }, `ReadableStreamBYOBRequest constructor should throw when passed a ${controllerType} ` + `ReadableByteStreamController and a ${viewType} view`); diff --git a/streams/readable-byte-streams/detached-buffers.any.js b/streams/readable-byte-streams/detached-buffers.any.js index 7d87173f0a0035..e37db6a0d87d00 100644 --- a/streams/readable-byte-streams/detached-buffers.any.js +++ b/streams/readable-byte-streams/detached-buffers.any.js @@ -52,7 +52,7 @@ test(() => { start(c) { const view = new Uint8Array([1, 2, 3]); c.enqueue(view); - assert_throws(new TypeError(), () => c.enqueue(view), 'enqueuing an already-detached buffer must throw'); + assert_throws_js(TypeError, () => c.enqueue(view), 'enqueuing an already-detached buffer must throw'); }, type: 'bytes' }); @@ -81,7 +81,7 @@ async_test(t => { // Detach it by reading into it reader.read(c.byobRequest.view); - assert_throws(new TypeError(), () => c.byobRequest.respond(1), + assert_throws_js(TypeError, () => c.byobRequest.respond(1), 'respond() must throw if the corresponding view has become detached'); }), type: 'bytes' @@ -100,7 +100,7 @@ async_test(t => { c.close(); - assert_throws(new TypeError(), () => c.byobRequest.respond(0), + assert_throws_js(TypeError, () => c.byobRequest.respond(0), 'respond() must throw if the corresponding view has become detached'); }), type: 'bytes' @@ -118,7 +118,7 @@ async_test(t => { const view = new Uint8Array([1, 2, 3]); reader.read(view); - assert_throws(new TypeError(), () => c.byobRequest.respondWithNewView(view), + assert_throws_js(TypeError, () => c.byobRequest.respondWithNewView(view), 'respondWithNewView() must throw if passed a detached view'); }), type: 'bytes' @@ -139,7 +139,7 @@ async_test(t => { c.close(); const zeroLengthView = new Uint8Array(view.buffer, 0, 0); - assert_throws(new TypeError(), () => c.byobRequest.respondWithNewView(zeroLengthView), + assert_throws_js(TypeError, () => c.byobRequest.respondWithNewView(zeroLengthView), 'respondWithNewView() must throw if passed a (zero-length) view whose buffer has been detached'); }), type: 'bytes' diff --git a/streams/readable-byte-streams/general.any.js b/streams/readable-byte-streams/general.any.js index c8f1fb7864e4ad..1947ededb6652e 100644 --- a/streams/readable-byte-streams/general.any.js +++ b/streams/readable-byte-streams/general.any.js @@ -7,7 +7,7 @@ const error1 = new Error('error1'); error1.name = 'error1'; test(() => { - assert_throws(new TypeError(), () => new ReadableStream().getReader({ mode: 'byob' })); + assert_throws_js(TypeError, () => new ReadableStream().getReader({ mode: 'byob' })); }, 'getReader({mode: "byob"}) throws on non-bytes streams'); @@ -179,7 +179,7 @@ promise_test(t => { const reader = stream.getReader(); return reader.closed.then(() => { - assert_throws(new TypeError(), () => stream.getReader(), 'getReader() must throw'); + assert_throws_js(TypeError, () => stream.getReader(), 'getReader() must throw'); }); }, 'ReadableStream with byte source: Test that closing a stream does not release a reader automatically'); @@ -195,7 +195,7 @@ promise_test(t => { const reader = stream.getReader({ mode: 'byob' }); return reader.closed.then(() => { - assert_throws(new TypeError(), () => stream.getReader({ mode: 'byob' }), 'getReader() must throw'); + assert_throws_js(TypeError, () => stream.getReader({ mode: 'byob' }), 'getReader() must throw'); }); }, 'ReadableStream with byte source: Test that closing a stream does not release a BYOB reader automatically'); @@ -211,7 +211,7 @@ promise_test(t => { const reader = stream.getReader(); return promise_rejects(t, error1, reader.closed, 'closed must reject').then(() => { - assert_throws(new TypeError(), () => stream.getReader(), 'getReader() must throw'); + assert_throws_js(TypeError, () => stream.getReader(), 'getReader() must throw'); }); }, 'ReadableStream with byte source: Test that erroring a stream does not release a reader automatically'); @@ -227,7 +227,7 @@ promise_test(t => { const reader = stream.getReader({ mode: 'byob' }); return promise_rejects(t, error1, reader.closed, 'closed must reject').then(() => { - assert_throws(new TypeError(), () => stream.getReader({ mode: 'byob' }), 'getReader() must throw'); + assert_throws_js(TypeError, () => stream.getReader({ mode: 'byob' }), 'getReader() must throw'); }); }, 'ReadableStream with byte source: Test that erroring a stream does not release a BYOB reader automatically'); @@ -238,7 +238,7 @@ test(() => { const reader = stream.getReader(); reader.read(); - assert_throws(new TypeError(), () => reader.releaseLock(), 'reader.releaseLock() must throw'); + assert_throws_js(TypeError, () => reader.releaseLock(), 'reader.releaseLock() must throw'); }, 'ReadableStream with byte source: releaseLock() on ReadableStreamReader with pending read() must throw'); promise_test(() => { @@ -551,7 +551,7 @@ promise_test(() => { }, 'ReadableStream with byte source: Push source that doesn\'t understand pull signal'); test(() => { - assert_throws(new TypeError(), () => new ReadableStream({ + assert_throws_js(TypeError, () => new ReadableStream({ pull: 'foo', type: 'bytes' }), 'constructor should throw'); @@ -1446,7 +1446,7 @@ promise_test(t => { const readPromise = reader.read(new Uint16Array(1)); - assert_throws(new TypeError(), () => controller.close(), 'controller.close() must throw'); + assert_throws_js(TypeError, () => controller.close(), 'controller.close() must throw'); return promise_rejects(t, new TypeError(), readPromise, 'read(view) must fail') .then(() => promise_rejects(t, new TypeError(), reader.closed, 'reader.closed must reject')); @@ -1469,7 +1469,7 @@ test(() => { controller.enqueue(view); controller.close(); - assert_throws(new TypeError(), () => controller.close(), 'controller.close() must throw'); + assert_throws_js(TypeError, () => controller.close(), 'controller.close() must throw'); }, 'ReadableStream with byte source: Throw if close()-ed more than once'); test(() => { @@ -1488,7 +1488,7 @@ test(() => { controller.enqueue(view); controller.close(); - assert_throws(new TypeError(), () => controller.enqueue(view), 'controller.close() must throw'); + assert_throws_js(TypeError, () => controller.enqueue(view), 'controller.close() must throw'); }, 'ReadableStream with byte source: Throw on enqueue() after close()'); promise_test(() => { @@ -1973,7 +1973,7 @@ promise_test(() => { const reader = rs.getReader({ mode: 'byob' }); const view = new Uint8Array(16); return reader.read(view).then(() => { - assert_throws(new TypeError(), () => byobRequest.respond(4), 'respond() should throw a TypeError'); + assert_throws_js(TypeError, () => byobRequest.respond(4), 'respond() should throw a TypeError'); }); }, 'calling respond() twice on the same byobRequest should throw'); @@ -1989,7 +1989,7 @@ promise_test(() => { }); const reader = rs.getReader({ mode: 'byob' }); return reader.read(newView()).then(() => { - assert_throws(new TypeError(), () => byobRequest.respondWithNewView(newView()), + assert_throws_js(TypeError, () => byobRequest.respondWithNewView(newView()), 'respondWithNewView() should throw a TypeError'); }); }, 'calling respondWithNewView() twice on the same byobRequest should throw'); @@ -2018,7 +2018,7 @@ promise_test(() => { resolvePull(); byobRequest.respond(0); return Promise.all([readPromise, cancelPromise]).then(() => { - assert_throws(new TypeError(), () => byobRequest.respond(0), 'respond() should throw'); + assert_throws_js(TypeError, () => byobRequest.respond(0), 'respond() should throw'); }); }); }, 'calling respond(0) twice on the same byobRequest should throw even when closed'); @@ -2043,7 +2043,7 @@ promise_test(() => { return pullCalledPromise.then(() => { resolvePull(); return delay(0).then(() => { - assert_throws(new TypeError(), () => reader.releaseLock(), 'releaseLock() should throw'); + assert_throws_js(TypeError, () => reader.releaseLock(), 'releaseLock() should throw'); }); }); }, 'pull() resolving should not make releaseLock() possible'); @@ -2078,37 +2078,37 @@ test(() => { test(() => { const ReadableStreamBYOBReader = new ReadableStream({ type: 'bytes' }).getReader({ mode: 'byob' }).constructor; - assert_throws(new TypeError(), () => new ReadableStreamBYOBReader({}), 'constructor must throw'); + assert_throws_js(TypeError, () => new ReadableStreamBYOBReader({}), 'constructor must throw'); }, 'ReadableStreamBYOBReader constructor requires a ReadableStream argument'); test(() => { const ReadableStreamBYOBReader = new ReadableStream({ type: 'bytes' }).getReader({ mode: 'byob' }).constructor; const stream = new ReadableStream({ type: 'bytes' }); stream.getReader(); - assert_throws(new TypeError(), () => new ReadableStreamBYOBReader(stream), 'constructor must throw'); + assert_throws_js(TypeError, () => new ReadableStreamBYOBReader(stream), 'constructor must throw'); }, 'ReadableStreamBYOBReader constructor requires an unlocked ReadableStream'); test(() => { const ReadableStreamBYOBReader = new ReadableStream({ type: 'bytes' }).getReader({ mode: 'byob' }).constructor; const stream = new ReadableStream(); - assert_throws(new TypeError(), () => new ReadableStreamBYOBReader(stream), 'constructor must throw'); + assert_throws_js(TypeError, () => new ReadableStreamBYOBReader(stream), 'constructor must throw'); }, 'ReadableStreamBYOBReader constructor requires a ReadableStream with type "bytes"'); test(() => { - assert_throws(new RangeError(), () => new ReadableStream({ type: 'bytes' }, { + assert_throws_js(RangeError, () => new ReadableStream({ type: 'bytes' }, { size() { return 1; } }), 'constructor should throw for size function'); - assert_throws(new RangeError(), () => new ReadableStream({ type: 'bytes' }, { size: null }), + assert_throws_js(RangeError, () => new ReadableStream({ type: 'bytes' }, { size: null }), 'constructor should throw for size defined'); - assert_throws(new RangeError(), + assert_throws_js(RangeError, () => new ReadableStream({ type: 'bytes' }, new CountQueuingStrategy({ highWaterMark: 1 })), 'constructor should throw when strategy is CountQueuingStrategy'); - assert_throws(new RangeError(), + assert_throws_js(RangeError, () => new ReadableStream({ type: 'bytes' }, new ByteLengthQueuingStrategy({ highWaterMark: 512 })), 'constructor should throw when strategy is ByteLengthQueuingStrategy'); @@ -2116,6 +2116,6 @@ test(() => { size() {} } - assert_throws(new RangeError(), () => new ReadableStream({ type: 'bytes' }, new HasSizeMethod()), + assert_throws_js(RangeError, () => new ReadableStream({ type: 'bytes' }, new HasSizeMethod()), 'constructor should throw when size on the prototype chain'); }, 'ReadableStream constructor should not accept a strategy with a size defined if type is "bytes"'); diff --git a/streams/readable-byte-streams/properties.any.js b/streams/readable-byte-streams/properties.any.js index 2d52fd678ab1f6..b201caf78a7d74 100644 --- a/streams/readable-byte-streams/properties.any.js +++ b/streams/readable-byte-streams/properties.any.js @@ -14,9 +14,9 @@ test(() => { test(() => { - assert_throws(new TypeError(), () => new ReadableStreamBYOBReader('potato')); - assert_throws(new TypeError(), () => new ReadableStreamBYOBReader({})); - assert_throws(new TypeError(), () => new ReadableStreamBYOBReader()); + assert_throws_js(TypeError, () => new ReadableStreamBYOBReader('potato')); + assert_throws_js(TypeError, () => new ReadableStreamBYOBReader({})); + assert_throws_js(TypeError, () => new ReadableStreamBYOBReader()); }, 'ReadableStreamBYOBReader constructor should get a ReadableStream object as argument'); diff --git a/streams/readable-streams/async-iterator.any.js b/streams/readable-streams/async-iterator.any.js index 865b8475427b47..ffbcdbb28bced9 100644 --- a/streams/readable-streams/async-iterator.any.js +++ b/streams/readable-streams/async-iterator.any.js @@ -262,7 +262,7 @@ test(() => { }, }); const it = s.getIterator(); - assert_throws(new TypeError(), () => s.getIterator(), 'getIterator() should throw'); + assert_throws_js(TypeError, () => s.getIterator(), 'getIterator() should throw'); }, 'getIterator() throws if there\'s already a lock'); promise_test(async () => { diff --git a/streams/readable-streams/bad-strategies.any.js b/streams/readable-streams/bad-strategies.any.js index 5dab51ef771ee4..feb1399170fcd0 100644 --- a/streams/readable-streams/bad-strategies.any.js +++ b/streams/readable-streams/bad-strategies.any.js @@ -63,7 +63,7 @@ promise_test(t => { } ); - assert_throws(new RangeError(), () => controller.enqueue('a'), 'enqueue should throw a RangeError'); + assert_throws_js(RangeError, () => controller.enqueue('a'), 'enqueue should throw a RangeError'); return promise_rejects(t, theError, rs.getReader().closed, 'closed should reject with the error'); @@ -112,7 +112,7 @@ test(() => { test(() => { for (const highWaterMark of [-1, -Infinity, NaN, 'foo', {}]) { - assert_throws(new RangeError(), () => { + assert_throws_js(RangeError, () => { new ReadableStream({}, { size() { return 1; diff --git a/streams/readable-streams/bad-underlying-sources.any.js b/streams/readable-streams/bad-underlying-sources.any.js index cde5603f240345..237a87cd364363 100644 --- a/streams/readable-streams/bad-underlying-sources.any.js +++ b/streams/readable-streams/bad-underlying-sources.any.js @@ -148,7 +148,7 @@ promise_test(() => { }); rs.cancel(); - assert_throws(new TypeError(), () => controller.enqueue('a'), 'Calling enqueue after canceling should throw'); + assert_throws_js(TypeError, () => controller.enqueue('a'), 'Calling enqueue after canceling should throw'); return rs.getReader().closed; @@ -166,7 +166,7 @@ promise_test(() => { }); rs.cancel(); - assert_throws(new TypeError(), () => controller.enqueue('c'), 'Calling enqueue after canceling should throw'); + assert_throws_js(TypeError, () => controller.enqueue('c'), 'Calling enqueue after canceling should throw'); return rs.getReader().closed; @@ -177,7 +177,7 @@ promise_test(() => { return new ReadableStream({ start(c) { c.close(); - assert_throws(new TypeError(), () => c.enqueue('a'), 'call to enqueue should throw a TypeError'); + assert_throws_js(TypeError, () => c.enqueue('a'), 'call to enqueue should throw a TypeError'); } }).getReader().closed; @@ -189,7 +189,7 @@ promise_test(t => { const closed = new ReadableStream({ start(c) { c.error(theError); - assert_throws(new TypeError(), () => c.enqueue('a'), 'call to enqueue should throw the error'); + assert_throws_js(TypeError, () => c.enqueue('a'), 'call to enqueue should throw the error'); } }).getReader().closed; @@ -202,7 +202,7 @@ promise_test(() => { return new ReadableStream({ start(c) { c.close(); - assert_throws(new TypeError(), () => c.close(), 'second call to close should throw a TypeError'); + assert_throws_js(TypeError, () => c.close(), 'second call to close should throw a TypeError'); } }).getReader().closed; @@ -216,7 +216,7 @@ promise_test(() => { start(c) { c.enqueue('a'); c.close(); - assert_throws(new TypeError(), () => c.close(), 'second call to close should throw a TypeError'); + assert_throws_js(TypeError, () => c.close(), 'second call to close should throw a TypeError'); startCalled = true; } }).getReader(); @@ -246,7 +246,7 @@ promise_test(() => { }); rs.cancel(); - assert_throws(new TypeError(), () => controller.close(), 'Calling close after canceling should throw'); + assert_throws_js(TypeError, () => controller.close(), 'Calling close after canceling should throw'); return rs.getReader().closed.then(() => { assert_true(startCalled); @@ -267,7 +267,7 @@ promise_test(() => { }); rs.cancel(); - assert_throws(new TypeError(), () => controller.close(), 'Calling close after canceling should throw'); + assert_throws_js(TypeError, () => controller.close(), 'Calling close after canceling should throw'); return rs.getReader().closed.then(() => { assert_true(startCalled); @@ -283,7 +283,7 @@ promise_test(() => { const closed = new ReadableStream({ start(c) { c.error(theError); - assert_throws(new TypeError(), () => c.close(), 'call to close should throw a TypeError'); + assert_throws_js(TypeError, () => c.close(), 'call to close should throw a TypeError'); startCalled = true; } }).getReader().closed; diff --git a/streams/readable-streams/brand-checks.any.js b/streams/readable-streams/brand-checks.any.js index 7bd41b4455e330..c82f513df01a86 100644 --- a/streams/readable-streams/brand-checks.any.js +++ b/streams/readable-streams/brand-checks.any.js @@ -119,7 +119,7 @@ test(() => { test(() => { - assert_throws(new TypeError(), () => new ReadableStreamDefaultReader(fakeRS()), + assert_throws_js(TypeError, () => new ReadableStreamDefaultReader(fakeRS()), 'Constructing a ReadableStreamDefaultReader should throw'); }, 'ReadableStreamDefaultReader enforces a brand check on its argument'); @@ -154,14 +154,14 @@ test(() => { test(() => { - assert_throws(new TypeError(), () => new ReadableStreamDefaultController(fakeRS()), + assert_throws_js(TypeError, () => new ReadableStreamDefaultController(fakeRS()), 'Constructing a ReadableStreamDefaultController should throw'); }, 'ReadableStreamDefaultController enforces a brand check on its argument'); test(() => { - assert_throws(new TypeError(), () => new ReadableStreamDefaultController(realRS()), + assert_throws_js(TypeError, () => new ReadableStreamDefaultController(realRS()), 'Constructing a ReadableStreamDefaultController should throw'); }, 'ReadableStreamDefaultController can\'t be given a fully-constructed ReadableStream'); diff --git a/streams/readable-streams/default-reader.any.js b/streams/readable-streams/default-reader.any.js index 224cd834b31f86..1e67b272b544ed 100644 --- a/streams/readable-streams/default-reader.any.js +++ b/streams/readable-streams/default-reader.any.js @@ -13,9 +13,9 @@ test(() => { test(() => { - assert_throws(new TypeError(), () => new ReadableStreamDefaultReader('potato')); - assert_throws(new TypeError(), () => new ReadableStreamDefaultReader({})); - assert_throws(new TypeError(), () => new ReadableStreamDefaultReader()); + assert_throws_js(TypeError, () => new ReadableStreamDefaultReader('potato')); + assert_throws_js(TypeError, () => new ReadableStreamDefaultReader({})); + assert_throws_js(TypeError, () => new ReadableStreamDefaultReader()); }, 'ReadableStreamDefaultReader constructor should get a ReadableStream object as argument'); @@ -68,7 +68,7 @@ test(() => { const rs = new ReadableStream(); new ReadableStreamDefaultReader(rs); // Constructing directly the first time should be fine. - assert_throws(new TypeError(), () => new ReadableStreamDefaultReader(rs), + assert_throws_js(TypeError, () => new ReadableStreamDefaultReader(rs), 'constructing directly the second time should fail'); }, 'Constructing a ReadableStreamDefaultReader directly should fail if the stream is already locked (via direct ' + @@ -78,7 +78,7 @@ test(() => { const rs = new ReadableStream(); new ReadableStreamDefaultReader(rs); // Constructing directly should be fine. - assert_throws(new TypeError(), () => rs.getReader(), 'getReader() should fail'); + assert_throws_js(TypeError, () => rs.getReader(), 'getReader() should fail'); }, 'Getting a ReadableStreamDefaultReader via getReader should fail if the stream is already locked (via direct ' + 'construction)'); @@ -87,7 +87,7 @@ test(() => { const rs = new ReadableStream(); rs.getReader(); // getReader() should be fine. - assert_throws(new TypeError(), () => new ReadableStreamDefaultReader(rs), 'constructing directly should fail'); + assert_throws_js(TypeError, () => new ReadableStreamDefaultReader(rs), 'constructing directly should fail'); }, 'Constructing a ReadableStreamDefaultReader directly should fail if the stream is already locked (via getReader)'); @@ -95,7 +95,7 @@ test(() => { const rs = new ReadableStream(); rs.getReader(); // getReader() should be fine. - assert_throws(new TypeError(), () => rs.getReader(), 'getReader() should fail'); + assert_throws_js(TypeError, () => rs.getReader(), 'getReader() should fail'); }, 'Getting a ReadableStreamDefaultReader via getReader should fail if the stream is already locked (via getReader)'); @@ -150,7 +150,7 @@ promise_test(() => { const rs = new ReadableStream({ cancel(reason) { assert_true(rs.locked, 'the stream should still be locked'); - assert_throws(new TypeError(), () => rs.getReader(), 'should not be able to get another reader'); + assert_throws_js(TypeError, () => rs.getReader(), 'should not be able to get another reader'); assert_equals(reason, passedReason, 'the cancellation reason is passed through to the underlying source'); cancelCalled = true; } @@ -295,7 +295,7 @@ promise_test(t => { promise_rejects(t, theError, reader1.read()) ); - assert_throws(new TypeError(), () => rs.getReader(), 'trying to get another reader before erroring should throw'); + assert_throws_js(TypeError, () => rs.getReader(), 'trying to get another reader before erroring should throw'); controller.error(theError); @@ -491,7 +491,7 @@ test(() => { return ''; } }; - assert_throws(new RangeError(), () => rs.getReader({ mode }), 'getReader() should throw'); + assert_throws_js(RangeError, () => rs.getReader({ mode }), 'getReader() should throw'); assert_true(toStringCalled, 'toString() should be called'); }, 'getReader() should call ToString() on mode'); diff --git a/streams/readable-streams/garbage-collection.any.js b/streams/readable-streams/garbage-collection.any.js index b6f2a7f1d94594..76a69572073c09 100644 --- a/streams/readable-streams/garbage-collection.any.js +++ b/streams/readable-streams/garbage-collection.any.js @@ -15,7 +15,7 @@ promise_test(() => { return delay(50).then(() => { controller.close(); - assert_throws(new TypeError(), () => controller.close(), 'close should throw a TypeError the second time'); + assert_throws_js(TypeError, () => controller.close(), 'close should throw a TypeError the second time'); controller.error(); }); @@ -64,7 +64,7 @@ promise_test(() => { garbageCollect(); - return delay(50).then(() => assert_throws(new TypeError(), () => rs.getReader(), + return delay(50).then(() => assert_throws_js(TypeError, () => rs.getReader(), 'old reader should still be locking the stream even after garbage collection')); }, 'Garbage-collecting a ReadableStreamDefaultReader should not unlock its stream'); diff --git a/streams/readable-streams/general.any.js b/streams/readable-streams/general.any.js index e9a107db1a3696..deb4a03031d573 100644 --- a/streams/readable-streams/general.any.js +++ b/streams/readable-streams/general.any.js @@ -20,17 +20,17 @@ test(() => { test(() => { - assert_throws(new TypeError(), () => new ReadableStream(null), 'constructor should throw when the source is null'); + assert_throws_js(TypeError, () => new ReadableStream(null), 'constructor should throw when the source is null'); }, 'ReadableStream can\'t be constructed with garbage'); test(() => { - assert_throws(new RangeError(), () => new ReadableStream({ type: null }), + assert_throws_js(RangeError, () => new ReadableStream({ type: null }), 'constructor should throw when the type is null'); - assert_throws(new RangeError(), () => new ReadableStream({ type: '' }), + assert_throws_js(RangeError, () => new ReadableStream({ type: '' }), 'constructor should throw when the type is empty string'); - assert_throws(new RangeError(), () => new ReadableStream({ type: 'asdf' }), + assert_throws_js(RangeError, () => new ReadableStream({ type: 'asdf' }), 'constructor should throw when the type is asdf'); assert_throws(error1, () => new ReadableStream({ type: { get toString() {throw error1;} } }), 'constructor should throw when ToString() throws'); assert_throws(error1, () => new ReadableStream({ type: { toString() {throw error1;} } }), 'constructor should throw when ToString() throws'); @@ -86,7 +86,7 @@ test(() => { test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new ReadableStream({ start: 'potato' }); }, 'constructor should throw when start is not a function'); @@ -94,13 +94,13 @@ test(() => { test(() => { - assert_throws(new TypeError(), () => new ReadableStream({ cancel: '2' }), 'constructor should throw'); + assert_throws_js(TypeError, () => new ReadableStream({ cancel: '2' }), 'constructor should throw'); }, 'ReadableStream constructor will not tolerate initial garbage as cancel argument'); test(() => { - assert_throws(new TypeError(), () => new ReadableStream({ pull: { } }), 'constructor should throw'); + assert_throws_js(TypeError, () => new ReadableStream({ pull: { } }), 'constructor should throw'); }, 'ReadableStream constructor will not tolerate initial garbage as pull argument'); @@ -178,7 +178,7 @@ test(() => { (new ReadableStream()).getReader(undefined); (new ReadableStream()).getReader({}); (new ReadableStream()).getReader({ mode: undefined, notmode: 'ignored' }); - assert_throws(new RangeError(), () => (new ReadableStream()).getReader({ mode: 'potato' })); + assert_throws_js(RangeError, () => (new ReadableStream()).getReader({ mode: 'potato' })); }, 'default ReadableStream getReader() should only accept mode:undefined'); promise_test(() => { @@ -689,7 +689,7 @@ test(() => { assert_equals(c.enqueue('a'), undefined, 'the first enqueue should return undefined'); c.close(); - assert_throws(new TypeError(), () => c.enqueue('b'), 'enqueue after close should throw a TypeError'); + assert_throws_js(TypeError, () => c.enqueue('b'), 'enqueue after close should throw a TypeError'); startCalled = true; } }); @@ -706,7 +706,7 @@ test(() => { start(c) { c.close(); - assert_throws(new TypeError(), () => c.enqueue('a'), 'enqueue after close should throw a TypeError'); + assert_throws_js(TypeError, () => c.enqueue('a'), 'enqueue after close should throw a TypeError'); startCalled = true; } }); diff --git a/streams/readable-streams/reentrant-strategies.any.js b/streams/readable-streams/reentrant-strategies.any.js index 7724ea63d3747e..ca77a1b357f4b4 100644 --- a/streams/readable-streams/reentrant-strategies.any.js +++ b/streams/readable-streams/reentrant-strategies.any.js @@ -123,7 +123,7 @@ promise_test(t => { }, cancel: t.step_func(reason => { assert_equals(reason, error1, 'reason should be error1'); - assert_throws(new TypeError(), () => controller.enqueue(), 'enqueue() should throw'); + assert_throws_js(TypeError, () => controller.enqueue(), 'enqueue() should throw'); }) }, { size() { diff --git a/streams/resources/rs-test-templates.js b/streams/resources/rs-test-templates.js index ef68e0ade647ba..8e3814d322fd11 100644 --- a/streams/resources/rs-test-templates.js +++ b/streams/resources/rs-test-templates.js @@ -23,10 +23,10 @@ self.templatedRSEmpty = (label, factory) => { test(() => { const rs = factory(); - assert_throws(new RangeError(), () => rs.getReader({ mode: '' }), 'empty string mode should throw'); - assert_throws(new RangeError(), () => rs.getReader({ mode: null }), 'null mode should throw'); - assert_throws(new RangeError(), () => rs.getReader({ mode: 'asdf' }), 'asdf mode should throw'); - assert_throws(new TypeError(), () => rs.getReader(null), 'null should throw'); + assert_throws_js(RangeError, () => rs.getReader({ mode: '' }), 'empty string mode should throw'); + assert_throws_js(RangeError, () => rs.getReader({ mode: null }), 'null mode should throw'); + assert_throws_js(RangeError, () => rs.getReader({ mode: 'asdf' }), 'asdf mode should throw'); + assert_throws_js(TypeError, () => rs.getReader(null), 'null should throw'); }, label + ': calling getReader with invalid arguments should throw appropriate errors'); }; @@ -83,8 +83,8 @@ self.templatedRSClosed = (label, factory) => { rs.getReader(); - assert_throws(new TypeError(), () => rs.getReader(), 'getting a second reader should throw'); - assert_throws(new TypeError(), () => rs.getReader(), 'getting a third reader should throw'); + assert_throws_js(TypeError, () => rs.getReader(), 'getting a second reader should throw'); + assert_throws_js(TypeError, () => rs.getReader(), 'getting a third reader should throw'); }, label + ': should not be able to acquire a second reader if we don\'t release the first one'); }; @@ -142,8 +142,8 @@ self.templatedRSErroredSyncOnly = (label, factory, error) => { const rs = factory(); rs.getReader(); - assert_throws(new TypeError(), () => rs.getReader(), 'getting a second reader should throw a TypeError'); - assert_throws(new TypeError(), () => rs.getReader(), 'getting a third reader should throw a TypeError'); + assert_throws_js(TypeError, () => rs.getReader(), 'getting a second reader should throw a TypeError'); + assert_throws_js(TypeError, () => rs.getReader(), 'getting a third reader should throw a TypeError'); }, label + ': should not be able to obtain additional readers if we don\'t release the first lock'); @@ -244,7 +244,7 @@ self.templatedRSEmptyReader = (label, factory) => { test(() => { const stream = factory().stream; - assert_throws(new TypeError(), () => stream.getReader(), 'stream.getReader() should throw a TypeError'); + assert_throws_js(TypeError, () => stream.getReader(), 'stream.getReader() should throw a TypeError'); }, label + ': getReader() again on the stream should fail'); @@ -269,7 +269,7 @@ self.templatedRSEmptyReader = (label, factory) => { t.unreached_func('closed should not reject') ); - assert_throws(new TypeError(), () => reader.releaseLock(), 'releaseLock should throw a TypeError'); + assert_throws_js(TypeError, () => reader.releaseLock(), 'releaseLock should throw a TypeError'); assert_true(stream.locked, 'the stream should still be locked'); diff --git a/streams/resources/test-utils.js b/streams/resources/test-utils.js index 5a9e2479faadf6..614fcca18e96de 100644 --- a/streams/resources/test-utils.js +++ b/streams/resources/test-utils.js @@ -24,7 +24,7 @@ self.methodRejectsForAll = (t, obj, methodName, targets, args) => { self.getterThrows = (obj, getterName, target) => { const getter = Object.getOwnPropertyDescriptor(obj, getterName).get; - assert_throws(new TypeError(), () => getter.call(target), getterName + ' should throw a TypeError'); + assert_throws_js(TypeError, () => getter.call(target), getterName + ' should throw a TypeError'); }; self.getterThrowsForAll = (obj, getterName, targets) => { @@ -35,7 +35,7 @@ self.methodThrows = (obj, methodName, target, args) => { const method = obj[methodName]; assert_equals(typeof method, 'function', methodName + ' should exist'); - assert_throws(new TypeError(), () => method.apply(target, args), methodName + ' should throw a TypeError'); + assert_throws_js(TypeError, () => method.apply(target, args), methodName + ' should throw a TypeError'); }; self.methodThrowsForAll = (obj, methodName, targets, args) => { @@ -43,7 +43,7 @@ self.methodThrowsForAll = (obj, methodName, targets, args) => { }; self.constructorThrowsForAll = (constructor, firstArgs) => { - firstArgs.forEach(firstArg => assert_throws(new TypeError(), () => new constructor(firstArg), + firstArgs.forEach(firstArg => assert_throws_js(TypeError, () => new constructor(firstArg), 'constructor should throw a TypeError')); }; diff --git a/streams/transform-streams/errors.any.js b/streams/transform-streams/errors.any.js index 53a4a49984b700..a6a35839e23b31 100644 --- a/streams/transform-streams/errors.any.js +++ b/streams/transform-streams/errors.any.js @@ -59,7 +59,7 @@ test(() => { start(c) { c.enqueue('a'); c.error(new Error('generic error')); - assert_throws(new TypeError(), () => c.enqueue('b'), 'enqueue() should throw'); + assert_throws_js(TypeError, () => c.enqueue('b'), 'enqueue() should throw'); } }); }, 'errored TransformStream should not enqueue new chunks'); @@ -109,7 +109,7 @@ promise_test(t => { }, 'when controller.error is followed by a rejection, the error reason should come from controller.error'); test(() => { - assert_throws(new URIError(), () => new TransformStream({ + assert_throws_js(URIError, () => new TransformStream({ start() { throw new URIError('start thrown error'); }, transform() {} }), 'constructor should throw'); @@ -120,7 +120,7 @@ test(() => { size() { throw new URIError('size thrown error'); } }; - assert_throws(new URIError(), () => new TransformStream({ + assert_throws_js(URIError, () => new TransformStream({ start(c) { c.enqueue('a'); }, @@ -139,7 +139,7 @@ test(() => { } }; - assert_throws(new URIError(), () => new TransformStream({ + assert_throws_js(URIError, () => new TransformStream({ start(c) { controller = c; c.enqueue('a'); diff --git a/streams/transform-streams/general.any.js b/streams/transform-streams/general.any.js index 537001edae99e0..c9323155e6a00d 100644 --- a/streams/transform-streams/general.any.js +++ b/streams/transform-streams/general.any.js @@ -376,7 +376,7 @@ test(() => { new TransformStream({ start(controller) { controller.terminate(); - assert_throws(new TypeError(), () => controller.enqueue(), 'enqueue should throw'); + assert_throws_js(TypeError, () => controller.enqueue(), 'enqueue should throw'); } }); }, 'enqueue() should throw after controller.terminate()'); @@ -389,7 +389,7 @@ promise_test(() => { } }); const cancelPromise = ts.readable.cancel(); - assert_throws(new TypeError(), () => controller.enqueue(), 'enqueue should throw'); + assert_throws_js(TypeError, () => controller.enqueue(), 'enqueue should throw'); return cancelPromise; }, 'enqueue() should throw after readable.cancel()'); @@ -431,11 +431,11 @@ promise_test(() => { }, 'start() should not be called twice'); test(() => { - assert_throws(new RangeError(), () => new TransformStream({ readableType: 'bytes' }), 'constructor should throw'); + assert_throws_js(RangeError, () => new TransformStream({ readableType: 'bytes' }), 'constructor should throw'); }, 'specifying a defined readableType should throw'); test(() => { - assert_throws(new RangeError(), () => new TransformStream({ writableType: 'bytes' }), 'constructor should throw'); + assert_throws_js(RangeError, () => new TransformStream({ writableType: 'bytes' }), 'constructor should throw'); }, 'specifying a defined writableType should throw'); test(() => { diff --git a/streams/transform-streams/strategies.any.js b/streams/transform-streams/strategies.any.js index 9ebfec7358e53e..c7645e7e651c0b 100644 --- a/streams/transform-streams/strategies.any.js +++ b/streams/transform-streams/strategies.any.js @@ -86,13 +86,13 @@ promise_test(t => { }, 'default readable strategy should be equivalent to { highWaterMark: 0 }'); test(() => { - assert_throws(new RangeError(), () => new TransformStream(undefined, { highWaterMark: -1 }), + assert_throws_js(RangeError, () => new TransformStream(undefined, { highWaterMark: -1 }), 'should throw RangeError for negative writableHighWaterMark'); - assert_throws(new RangeError(), () => new TransformStream(undefined, undefined, { highWaterMark: -1 }), + assert_throws_js(RangeError, () => new TransformStream(undefined, undefined, { highWaterMark: -1 }), 'should throw RangeError for negative readableHighWaterMark'); - assert_throws(new RangeError(), () => new TransformStream(undefined, { highWaterMark: NaN }), + assert_throws_js(RangeError, () => new TransformStream(undefined, { highWaterMark: NaN }), 'should throw RangeError for NaN writableHighWaterMark'); - assert_throws(new RangeError(), () => new TransformStream(undefined, undefined, { highWaterMark: NaN }), + assert_throws_js(RangeError, () => new TransformStream(undefined, undefined, { highWaterMark: NaN }), 'should throw RangeError for NaN readableHighWaterMark'); }, 'a RangeError should be thrown for an invalid highWaterMark'); @@ -129,7 +129,7 @@ promise_test(t => { const ts = new TransformStream({ transform(chunk, controller) { // This assert has the important side-effect of catching the error, so transform() does not throw. - assert_throws(new RangeError(), () => controller.enqueue(chunk), 'enqueue should throw'); + assert_throws_js(RangeError, () => controller.enqueue(chunk), 'enqueue should throw'); } }, undefined, { size() { diff --git a/streams/transform-streams/terminate.any.js b/streams/transform-streams/terminate.any.js index 2bf9eabed8410c..0018b4b47d242b 100644 --- a/streams/transform-streams/terminate.any.js +++ b/streams/transform-streams/terminate.any.js @@ -48,7 +48,7 @@ test(() => { start(controller) { controller.enqueue(0); controller.terminate(); - assert_throws(new TypeError(), () => controller.enqueue(1), 'enqueue should throw'); + assert_throws_js(TypeError, () => controller.enqueue(1), 'enqueue should throw'); } }); }, 'controller.enqueue() should throw after controller.terminate()'); diff --git a/streams/writable-streams/bad-strategies.any.js b/streams/writable-streams/bad-strategies.any.js index d67ee6b5039dc9..711fba123a95ab 100644 --- a/streams/writable-streams/bad-strategies.any.js +++ b/streams/writable-streams/bad-strategies.any.js @@ -16,7 +16,7 @@ test(() => { }, 'Writable stream: throwing strategy.size getter'); test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new WritableStream({}, { size: 'a string' }); }); }, 'reject any non-function value for strategy.size'); @@ -37,7 +37,7 @@ test(() => { test(() => { for (const highWaterMark of [-1, -Infinity, NaN, 'foo', {}]) { - assert_throws(new RangeError(), () => { + assert_throws_js(RangeError, () => { new WritableStream({}, { size() { return 1; @@ -88,7 +88,7 @@ promise_test(() => { }, 'Writable stream: invalid strategy.size return value'); test(() => { - assert_throws(new TypeError(), () => new WritableStream(undefined, { + assert_throws_js(TypeError, () => new WritableStream(undefined, { size: 'not a function', highWaterMark: NaN }), 'WritableStream constructor should throw a TypeError'); diff --git a/streams/writable-streams/bad-underlying-sinks.any.js b/streams/writable-streams/bad-underlying-sinks.any.js index ed04b3c0a17fcd..9619e663cb4d0d 100644 --- a/streams/writable-streams/bad-underlying-sinks.any.js +++ b/streams/writable-streams/bad-underlying-sinks.any.js @@ -23,13 +23,13 @@ test(() => { }); }, 'constructor should throw same error as throwing start method'); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new WritableStream({ start: 'not a function or undefined' }); }, 'constructor should throw TypeError when passed a non-function start property'); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new WritableStream({ start: { apply() {} } }); @@ -162,7 +162,7 @@ promise_test(t => { }, 'write: returning a rejected promise (second write) should cause writer write() and ready to reject'); test(() => { - assert_throws(new TypeError(), () => new WritableStream({ + assert_throws_js(TypeError, () => new WritableStream({ abort: { apply() {} } }), 'constructor should throw'); }, 'abort: non-function abort method with .apply'); diff --git a/streams/writable-streams/brand-checks.any.js b/streams/writable-streams/brand-checks.any.js index 17179e7936eda2..a28fec3bd6baa0 100644 --- a/streams/writable-streams/brand-checks.any.js +++ b/streams/writable-streams/brand-checks.any.js @@ -76,7 +76,7 @@ test(() => { }, 'WritableStream.prototype.getWriter enforces a brand check'); test(() => { - assert_throws(new TypeError(), () => new WritableStreamDefaultWriter(fakeWS()), 'constructor should throw'); + assert_throws_js(TypeError, () => new WritableStreamDefaultWriter(fakeWS()), 'constructor should throw'); }, 'WritableStreamDefaultWriter constructor enforces a brand check'); test(() => { diff --git a/streams/writable-streams/constructor.any.js b/streams/writable-streams/constructor.any.js index 97cda9cedac9aa..c792e1f1fafe35 100644 --- a/streams/writable-streams/constructor.any.js +++ b/streams/writable-streams/constructor.any.js @@ -115,7 +115,7 @@ test(() => { } }); - assert_throws(new TypeError(), () => new WritableStreamDefaultController({}), + assert_throws_js(TypeError, () => new WritableStreamDefaultController({}), 'constructor should throw a TypeError exception'); }, 'WritableStreamDefaultController constructor should throw'); @@ -127,7 +127,7 @@ test(() => { } }); - assert_throws(new TypeError(), () => new WritableStreamDefaultController(stream), + assert_throws_js(TypeError, () => new WritableStreamDefaultController(stream), 'constructor should throw a TypeError exception'); }, 'WritableStreamDefaultController constructor should throw when passed an initialised WritableStream'); @@ -136,7 +136,7 @@ test(() => { const writer = stream.getWriter(); const WritableStreamDefaultWriter = writer.constructor; writer.releaseLock(); - assert_throws(new TypeError(), () => new WritableStreamDefaultWriter({}), + assert_throws_js(TypeError, () => new WritableStreamDefaultWriter({}), 'constructor should throw a TypeError exception'); }, 'WritableStreamDefaultWriter should throw unless passed a WritableStream'); @@ -144,7 +144,7 @@ test(() => { const stream = new WritableStream(); const writer = stream.getWriter(); const WritableStreamDefaultWriter = writer.constructor; - assert_throws(new TypeError(), () => new WritableStreamDefaultWriter(stream), + assert_throws_js(TypeError, () => new WritableStreamDefaultWriter(stream), 'constructor should throw a TypeError exception'); }, 'WritableStreamDefaultWriter constructor should throw when stream argument is locked'); diff --git a/streams/writable-streams/general.any.js b/streams/writable-streams/general.any.js index 96670448a9da68..b168ee0a5b9ea3 100644 --- a/streams/writable-streams/general.any.js +++ b/streams/writable-streams/general.any.js @@ -6,7 +6,7 @@ test(() => { const writer = ws.getWriter(); writer.releaseLock(); - assert_throws(new TypeError(), () => writer.desiredSize, 'desiredSize should throw a TypeError'); + assert_throws_js(TypeError, () => writer.desiredSize, 'desiredSize should throw a TypeError'); }, 'desiredSize on a released writer'); test(() => { diff --git a/streams/writable-streams/write.any.js b/streams/writable-streams/write.any.js index c936ef55af99d4..68da7939855566 100644 --- a/streams/writable-streams/write.any.js +++ b/streams/writable-streams/write.any.js @@ -256,7 +256,7 @@ promise_test(() => { const stream = new WritableStream(); const writer = stream.getWriter(); const WritableStreamDefaultWriter = writer.constructor; - assert_throws(new TypeError(), () => new WritableStreamDefaultWriter(stream), + assert_throws_js(TypeError, () => new WritableStreamDefaultWriter(stream), 'should not be able to construct on locked stream'); // If stream.[[writer]] no longer points to |writer| then the closed Promise // won't work properly. diff --git a/svg/types/scripted/SVGAnimatedNumber.html b/svg/types/scripted/SVGAnimatedNumber.html index a1697cbf926774..c72cabca1a84b8 100644 --- a/svg/types/scripted/SVGAnimatedNumber.html +++ b/svg/types/scripted/SVGAnimatedNumber.html @@ -26,15 +26,15 @@ assert_equals(feSpecularLightingElement.surfaceScale.baseVal, 300); // ECMA-262, 9.3, "ToNumber" - assert_throws(new TypeError(), function() { feSpecularLightingElement.surfaceScale.baseVal = 'aString'; }); + assert_throws_js(TypeError, function() { feSpecularLightingElement.surfaceScale.baseVal = 'aString'; }); assert_equals(feSpecularLightingElement.surfaceScale.baseVal, 300); feSpecularLightingElement.surfaceScale.baseVal = 0; assert_equals(feSpecularLightingElement.surfaceScale.baseVal, 0); - assert_throws(new TypeError(), function() { feSpecularLightingElement.surfaceScale.baseVal = NaN; }); + assert_throws_js(TypeError, function() { feSpecularLightingElement.surfaceScale.baseVal = NaN; }); assert_equals(feSpecularLightingElement.surfaceScale.baseVal, 0); - assert_throws(new TypeError(), function() { feSpecularLightingElement.surfaceScale.baseVal = Infinity; }); + assert_throws_js(TypeError, function() { feSpecularLightingElement.surfaceScale.baseVal = Infinity; }); assert_equals(feSpecularLightingElement.surfaceScale.baseVal, 0); - assert_throws(new TypeError(), function() { feSpecularLightingElement.surfaceScale.baseVal = feSpecularLightingElement; }); + assert_throws_js(TypeError, function() { feSpecularLightingElement.surfaceScale.baseVal = feSpecularLightingElement; }); assert_equals(feSpecularLightingElement.surfaceScale.baseVal, 0); feSpecularLightingElement.surfaceScale.baseVal = 300; assert_equals(feSpecularLightingElement.surfaceScale.baseVal, 300); diff --git a/svg/types/scripted/SVGLength.html b/svg/types/scripted/SVGLength.html index 2b043b99a629b2..34e383ff702d42 100644 --- a/svg/types/scripted/SVGLength.html +++ b/svg/types/scripted/SVGLength.html @@ -27,7 +27,7 @@ assert_throws("NotSupportedError", function() { length.convertToSpecifiedUnits('aString'); }); assert_throws("NotSupportedError", function() { length.convertToSpecifiedUnits(length); }); assert_throws("NotSupportedError", function() { length.convertToSpecifiedUnits(svgElement); }); - assert_throws(new TypeError(), function() { length.convertToSpecifiedUnits(); }); + assert_throws_js(TypeError, function() { length.convertToSpecifiedUnits(); }); assert_equals(length.unitType, SVGLength.SVG_LENGTHTYPE_PX); assert_equals(length.value, 2); assert_equals(length.valueInSpecifiedUnits, 2); @@ -39,25 +39,25 @@ assert_throws("NotSupportedError", function() { length.newValueSpecifiedUnits(11, 4); }); // ECMA-262, 9.3, "ToNumber". length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 0); - assert_throws(new TypeError(), function() { length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 'aString'); }); + assert_throws_js(TypeError, function() { length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 'aString'); }); assert_equals(length.value, 0); - assert_throws(new TypeError(), function() { length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, length); }); + assert_throws_js(TypeError, function() { length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, length); }); assert_equals(length.value, 0); - assert_throws(new TypeError(), function() { length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, svgElement); }); + assert_throws_js(TypeError, function() { length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, svgElement); }); assert_equals(length.value, 0); - assert_throws(new TypeError(), function() { length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, NaN); }); + assert_throws_js(TypeError, function() { length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, NaN); }); assert_equals(length.value, 0); - assert_throws(new TypeError(), function() { length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, Infinity); }); + assert_throws_js(TypeError, function() { length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, Infinity); }); assert_equals(length.value, 0); - assert_throws(new TypeError(), function() { length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX); }); + assert_throws_js(TypeError, function() { length.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX); }); // Reset to original value above. length.valueAsString = "2px"; assert_throws("NotSupportedError", function() { length.newValueSpecifiedUnits('aString', 4); }); assert_throws("NotSupportedError", function() { length.newValueSpecifiedUnits(length, 4); }); assert_throws("NotSupportedError", function() { length.newValueSpecifiedUnits(svgElement, 4); }); - assert_throws(new TypeError(), function() { length.newValueSpecifiedUnits('aString', 'aString'); }); - assert_throws(new TypeError(), function() { length.newValueSpecifiedUnits(length, length); }); - assert_throws(new TypeError(), function() { length.newValueSpecifiedUnits(svgElement, svgElement); }); + assert_throws_js(TypeError, function() { length.newValueSpecifiedUnits('aString', 'aString'); }); + assert_throws_js(TypeError, function() { length.newValueSpecifiedUnits(length, length); }); + assert_throws_js(TypeError, function() { length.newValueSpecifiedUnits(svgElement, svgElement); }); assert_equals(length.unitType, SVGLength.SVG_LENGTHTYPE_PX); assert_equals(length.value, 2); assert_equals(length.valueInSpecifiedUnits, 2); @@ -97,15 +97,15 @@ assert_equals(length.unitType, SVGLength.SVG_LENGTHTYPE_PX); // Check setting invalid 'value' arguments. - assert_throws(new TypeError(), function() { length.value = NaN; }); - assert_throws(new TypeError(), function() { length.value = Infinity; }); + assert_throws_js(TypeError, function() { length.value = NaN; }); + assert_throws_js(TypeError, function() { length.value = Infinity; }); assert_equals(length.value, 2); assert_equals(length.valueInSpecifiedUnits, 2); assert_equals(length.unitType, SVGLength.SVG_LENGTHTYPE_PX); // Check setting invalid 'valueInSpecifiedUnits' arguments. - assert_throws(new TypeError(), function() { length.valueInSpecifiedUnits = NaN; }); - assert_throws(new TypeError(), function() { length.valueInSpecifiedUnits = Infinity; }); + assert_throws_js(TypeError, function() { length.valueInSpecifiedUnits = NaN; }); + assert_throws_js(TypeError, function() { length.valueInSpecifiedUnits = Infinity; }); assert_equals(length.value, 2); assert_equals(length.valueInSpecifiedUnits, 2); assert_equals(length.unitType, SVGLength.SVG_LENGTHTYPE_PX); diff --git a/svg/types/scripted/SVGLengthList-basics.html b/svg/types/scripted/SVGLengthList-basics.html index 58d0e937bedeb2..8f5e66960b2553 100644 --- a/svg/types/scripted/SVGLengthList-basics.html +++ b/svg/types/scripted/SVGLengthList-basics.html @@ -21,10 +21,10 @@ assert_equals(xBaseValList.getItem(2).value, 1500); // Test uncommon arguments for initialize(). - assert_throws(new TypeError(), function() { xBaseValList.initialize(30); }); - assert_throws(new TypeError(), function() { xBaseValList.initialize('aString'); }); - assert_throws(new TypeError(), function() { xBaseValList.initialize(text1); }); - assert_throws(new TypeError(), function() { xBaseValList.initialize(null); }); + assert_throws_js(TypeError, function() { xBaseValList.initialize(30); }); + assert_throws_js(TypeError, function() { xBaseValList.initialize('aString'); }); + assert_throws_js(TypeError, function() { xBaseValList.initialize(text1); }); + assert_throws_js(TypeError, function() { xBaseValList.initialize(null); }); // Test uncommon arguments for getItem(). assert_throws("IndexSizeError", function() { xBaseValList.getItem(30); }); @@ -33,10 +33,10 @@ assert_equals(xBaseValList.getItem(null).value, xBaseValList.getItem(0).value); // Test uncommon arguments for insertItemBefore(). - assert_throws(new TypeError(), function() { xBaseValList.insertItemBefore(30); }); - assert_throws(new TypeError(), function() { xBaseValList.insertItemBefore('aString'); }); - assert_throws(new TypeError(), function() { xBaseValList.insertItemBefore(text1); }); - assert_throws(new TypeError(), function() { xBaseValList.insertItemBefore(null); }); + assert_throws_js(TypeError, function() { xBaseValList.insertItemBefore(30); }); + assert_throws_js(TypeError, function() { xBaseValList.insertItemBefore('aString'); }); + assert_throws_js(TypeError, function() { xBaseValList.insertItemBefore(text1); }); + assert_throws_js(TypeError, function() { xBaseValList.insertItemBefore(null); }); assert_equals(xBaseValList.insertItemBefore(xBaseValList.getItem(1), 'aString').value, xBaseValList.getItem(0).value); assert_equals(xBaseValList.numberOfItems, 4); @@ -77,10 +77,10 @@ assert_equals(xBaseValList.getItem(6).value, 1500); assert_equals(text1.getAttribute('x'), "500 1000 500 1000 500 1000 1500"); - assert_throws(new TypeError(), function() { xBaseValList.insertItemBefore(30, 0); }); - assert_throws(new TypeError(), function() { xBaseValList.insertItemBefore('aString', 0); }); - assert_throws(new TypeError(), function() { xBaseValList.insertItemBefore(text1, 0); }); - assert_throws(new TypeError(), function() { xBaseValList.insertItemBefore(null, 0); }); + assert_throws_js(TypeError, function() { xBaseValList.insertItemBefore(30, 0); }); + assert_throws_js(TypeError, function() { xBaseValList.insertItemBefore('aString', 0); }); + assert_throws_js(TypeError, function() { xBaseValList.insertItemBefore(text1, 0); }); + assert_throws_js(TypeError, function() { xBaseValList.insertItemBefore(null, 0); }); // Set x='1 2 3 4' for text1. text1.setAttribute('x', '1 2 3 4'); @@ -103,20 +103,20 @@ assert_equals(text1.getAttribute('x'), "1 2 3 4"); // Test uncommon arguments for replaceItem(). - assert_throws(new TypeError(), function() { xBaseValList.replaceItem(30); }); - assert_throws(new TypeError(), function() { xBaseValList.replaceItem('aString'); }); - assert_throws(new TypeError(), function() { xBaseValList.replaceItem(text1); }); - assert_throws(new TypeError(), function() { xBaseValList.replaceItem(null); }); - assert_throws(new TypeError(), function() { xBaseValList.replaceItem(30, 0); }); - assert_throws(new TypeError(), function() { xBaseValList.replaceItem('aString', 0); }); - assert_throws(new TypeError(), function() { xBaseValList.replaceItem(text1, 0); }); - assert_throws(new TypeError(), function() { xBaseValList.replaceItem(null, 0); }); + assert_throws_js(TypeError, function() { xBaseValList.replaceItem(30); }); + assert_throws_js(TypeError, function() { xBaseValList.replaceItem('aString'); }); + assert_throws_js(TypeError, function() { xBaseValList.replaceItem(text1); }); + assert_throws_js(TypeError, function() { xBaseValList.replaceItem(null); }); + assert_throws_js(TypeError, function() { xBaseValList.replaceItem(30, 0); }); + assert_throws_js(TypeError, function() { xBaseValList.replaceItem('aString', 0); }); + assert_throws_js(TypeError, function() { xBaseValList.replaceItem(text1, 0); }); + assert_throws_js(TypeError, function() { xBaseValList.replaceItem(null, 0); }); // Test uncommon values for indexed setter. - assert_throws(new TypeError(), function() { xBaseValList[0] = 30; }); - assert_throws(new TypeError(), function() { xBaseValList[0] = 'aString'; }); - assert_throws(new TypeError(), function() { xBaseValList[0] = text1; }); - assert_throws(new TypeError(), function() { xBaseValList[0] = null; }); + assert_throws_js(TypeError, function() { xBaseValList[0] = 30; }); + assert_throws_js(TypeError, function() { xBaseValList[0] = 'aString'; }); + assert_throws_js(TypeError, function() { xBaseValList[0] = text1; }); + assert_throws_js(TypeError, function() { xBaseValList[0] = null; }); assert_equals(xBaseValList.replaceItem(xBaseValList.getItem(0), 0).value, xBaseValList.getItem(0).value); assert_equals(xBaseValList.numberOfItems, 4); @@ -170,10 +170,10 @@ assert_equals(text1.getAttribute('x'), "3 4"); // Test uncommon arguments for appendItem(). - assert_throws(new TypeError(), function() { xBaseValList.appendItem(30); }); - assert_throws(new TypeError(), function() { xBaseValList.appendItem('aString'); }); - assert_throws(new TypeError(), function() { xBaseValList.appendItem(text1); }); - assert_throws(new TypeError(), function() { xBaseValList.appendItem(null); }); + assert_throws_js(TypeError, function() { xBaseValList.appendItem(30); }); + assert_throws_js(TypeError, function() { xBaseValList.appendItem('aString'); }); + assert_throws_js(TypeError, function() { xBaseValList.appendItem(text1); }); + assert_throws_js(TypeError, function() { xBaseValList.appendItem(null); }); // Testing animVal clear throws. assert_throws("NoModificationAllowedError", function() { xAnimValList.clear(); }); diff --git a/touch-events/touch-touchevent-constructor.html b/touch-events/touch-touchevent-constructor.html index 1b723b7bb3c5ce..e2d0950d5e27aa 100644 --- a/touch-events/touch-touchevent-constructor.html +++ b/touch-events/touch-touchevent-constructor.html @@ -13,14 +13,14 @@ var testIdentifier = 0; var testTarget = document.getElementById('target0'); - assert_throws(new TypeError(), function() {new Touch();}, "Touch constructor with no argument"); - assert_throws(new TypeError(), function() {new Touch(null);}, "Touch constructor with null argument"); - assert_throws(new TypeError(), function() {new Touch(undefined);}, "Touch constructor with undefined argument"); - assert_throws(new TypeError(), function() {new Touch({});}, "Touch constructor with empty object"); - assert_throws(new TypeError(), function() {new Touch({ + assert_throws_js(TypeError, function() {new Touch();}, "Touch constructor with no argument"); + assert_throws_js(TypeError, function() {new Touch(null);}, "Touch constructor with null argument"); + assert_throws_js(TypeError, function() {new Touch(undefined);}, "Touch constructor with undefined argument"); + assert_throws_js(TypeError, function() {new Touch({});}, "Touch constructor with empty object"); + assert_throws_js(TypeError, function() {new Touch({ identifier: testIdentifier });}, "Touch constructor with only identifier"); - assert_throws(new TypeError(), function() {new Touch({ + assert_throws_js(TypeError, function() {new Touch({ target: testTarget });}, "Touch constructor with only target"); }, "Touch constructor with insufficient properties"); @@ -29,15 +29,15 @@ var testIdentifier = 0; var testTarget = document.getElementById('target0'); - assert_throws(new TypeError(), function() {new Touch({ + assert_throws_js(TypeError, function() {new Touch({ identifier: testIdentifier, target: null });}, "Touch constructor with null target"); - assert_throws(new TypeError(), function() {new Touch({ + assert_throws_js(TypeError, function() {new Touch({ identifier: testIdentifier, target: undefined });}, "Touch constructor with undefined target"); - assert_throws(new TypeError(), function() {new Touch({ + assert_throws_js(TypeError, function() {new Touch({ identifier: testIdentifier, target: location });}, "Touch constructor with Location target"); diff --git a/trusted-types/DOMParser-parseFromString-regression.tentative.https.html b/trusted-types/DOMParser-parseFromString-regression.tentative.https.html index 30986e45d2671c..cc57ee7f8ea4cf 100644 --- a/trusted-types/DOMParser-parseFromString-regression.tentative.https.html +++ b/trusted-types/DOMParser-parseFromString-regression.tentative.https.html @@ -27,7 +27,7 @@ target.appendChild(frame); const frame_probe = document.getElementById("frame").contentDocument.getElementById("probe"); probe.innerHTML = "probe"; - assert_throws(new TypeError(), _ => { frame_probe.innnerHTML = "probe" }); + assert_throws_js(TypeError, _ => { frame_probe.innnerHTML = "probe" }); }, "Regression test for TT changes to parseFromString."); </script> </body> diff --git a/trusted-types/TrustedTypePolicy-CSP-no-name.tentative.html b/trusted-types/TrustedTypePolicy-CSP-no-name.tentative.html index 18819b20894644..b1c7f51ddb3a14 100644 --- a/trusted-types/TrustedTypePolicy-CSP-no-name.tentative.html +++ b/trusted-types/TrustedTypePolicy-CSP-no-name.tentative.html @@ -8,7 +8,7 @@ <script> // No name given test test(t => { - assert_throws(new TypeError(), + assert_throws_js(TypeError, () => window.trustedTypes.createPolicy('SomeName', { createHTML: s => s } ), "createPolicy with an empty trusted-types CSP directive"); }, "No name list given - policy creation fails."); diff --git a/trusted-types/TrustedTypePolicy-CSP.tentative.html b/trusted-types/TrustedTypePolicy-CSP.tentative.html index 8ae162558f41fe..3a56546151e4e8 100644 --- a/trusted-types/TrustedTypePolicy-CSP.tentative.html +++ b/trusted-types/TrustedTypePolicy-CSP.tentative.html @@ -20,7 +20,7 @@ // Non-allowed names test test(t => { - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { window.trustedTypes.createPolicy('SomeOtherName', { createURL: s => s } ); }); }, "Non-allowed name policy creation throws."); diff --git a/trusted-types/TrustedTypePolicy-createXXX.tentative.html b/trusted-types/TrustedTypePolicy-createXXX.tentative.html index 34fbf5587daf72..08b24a961523d6 100644 --- a/trusted-types/TrustedTypePolicy-createXXX.tentative.html +++ b/trusted-types/TrustedTypePolicy-createXXX.tentative.html @@ -11,13 +11,13 @@ createHTML: s => s, createScript: s => s }); - assert_throws(new TypeError(), _ => { p1.createScriptURL("foo"); }); + assert_throws_js(TypeError, _ => { p1.createScriptURL("foo"); }); const p2 = trustedTypes.createPolicy("policyURLAndScriptURL", { createScriptURL: s => s }); - assert_throws(new TypeError(), _ => { p2.createHTML("foo"); }); - assert_throws(new TypeError(), _ => { p2.createScript("foo"); }); + assert_throws_js(TypeError, _ => { p2.createHTML("foo"); }); + assert_throws_js(TypeError, _ => { p2.createScript("foo"); }); }, "calling undefined callbacks throws"); test(t => { @@ -35,9 +35,9 @@ test(t => { const policy = trustedTypes.createPolicy("nullpolicy", null); - assert_throws(new TypeError(), _ => { policy.createScriptURL("foo"); }); - assert_throws(new TypeError(), _ => { policy.createHTML("foo"); }); - assert_throws(new TypeError(), _ => { policy.createScript("foo"); }); + assert_throws_js(TypeError, _ => { policy.createScriptURL("foo"); }); + assert_throws_js(TypeError, _ => { policy.createHTML("foo"); }); + assert_throws_js(TypeError, _ => { policy.createScript("foo"); }); }, "trustedTypes.createPolicy(.., null) creates empty policy."); diff --git a/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html b/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html index a78b3dbf0fd7a9..746d89fa3f8c3f 100644 --- a/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html +++ b/trusted-types/TrustedTypePolicyFactory-createPolicy-createXYZTests.tentative.html @@ -34,7 +34,7 @@ test(t => { let p = window.trustedTypes.createPolicy('TestPolicyHTML5', { createHTML: s => { throw new Error(); }}); - assert_throws(new Error(), _ => { + assert_throws_js(Error, _ => { p.createHTML('whatever'); }); }, "html = callback that throws"); @@ -58,20 +58,20 @@ test(t => { let p = window.trustedTypes.createPolicy('TestPolicyHTML8', null); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { p.createHTML('whatever'); }); }, "html - calling undefined callback throws"); test(t => { let p = window.trustedTypes.createPolicy('TestPolicyHTML9', { createHTML: createHTMLJS }); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { p.createScript(INPUTS.SCRIPT); }); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { p.createScriptURL(INPUTS.SCRIPTURL); }); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { p.createURL(INPUTS.URL); }); }, "createHTML defined - calling undefined callbacks throws"); @@ -108,7 +108,7 @@ let p = window.trustedTypes.createPolicy('TestPolicyScript5', { createScript: s => { throw new Error(); } }); - assert_throws(new Error(), _ => { + assert_throws_js(Error, _ => { p.createScript('whatever'); }); }, "script = callback that throws"); @@ -132,20 +132,20 @@ test(t => { let p = window.trustedTypes.createPolicy('TestPolicyScript8', null); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { p.createScript('whatever'); }); }, "script - calling undefined callback throws"); test(t => { let p = window.trustedTypes.createPolicy('TestPolicyScript9', { createScript: createScriptJS }); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { p.createHTML(INPUTS.HTML); }); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { p.createScriptURL(INPUTS.SCRIPTURL); }); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { p.createURL(INPUTS.URL); }); }, "createScript defined - calling undefined callbacks throws"); @@ -183,7 +183,7 @@ let p = window.trustedTypes.createPolicy('TestPolicyScriptURL5', { createScriptURL: s => { throw new Error(); } }); - assert_throws(new Error(), _ => { + assert_throws_js(Error, _ => { p.createScriptURL(INPUTS.SCRIPTURL); }); }, "script_url = callback that throws"); @@ -207,20 +207,20 @@ test(t => { let p = window.trustedTypes.createPolicy('TestPolicyScriptURL8', null); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { p.createScriptURL(INPUTS.SCRIPTURL); }); }, "script_url - calling undefined callback throws"); test(t => { let p = window.trustedTypes.createPolicy('TestPolicyScriptURL9', { createScriptURL: createScriptURLJS }); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { p.createHTML(INPUTS.HTML); }); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { p.createScript(INPUTS.SCRIPT); }); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { p.createURL(INPUTS.URL); }); }, "createScriptURL defined - calling undefined callbacks throws"); diff --git a/trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-noNamesGiven.tentative.html b/trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-noNamesGiven.tentative.html index cec1bfb6041e52..15728b9888f3cb 100644 --- a/trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-noNamesGiven.tentative.html +++ b/trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-noNamesGiven.tentative.html @@ -7,7 +7,7 @@ <script> //No name given test test(t => { - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { window.trustedTypes.createPolicy('SomeName', { createHTML: s => s } ); }); }, "No name list given - policy creation throws"); diff --git a/trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests.tentative.html b/trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests.tentative.html index 8ae162558f41fe..3a56546151e4e8 100644 --- a/trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests.tentative.html +++ b/trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests.tentative.html @@ -20,7 +20,7 @@ // Non-allowed names test test(t => { - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { window.trustedTypes.createPolicy('SomeOtherName', { createURL: s => s } ); }); }, "Non-allowed name policy creation throws."); diff --git a/trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html b/trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html index 0b1872abe5036d..f049484f1199a0 100644 --- a/trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html +++ b/trusted-types/TrustedTypePolicyFactory-createPolicy-nameTests.tentative.html @@ -15,7 +15,7 @@ // Duplicate names test test(t => { - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { trustedTypes.createPolicy('SomeName', {} ); }); }, "duplicate policy name attempt throws"); diff --git a/trusted-types/TrustedTypePolicyFactory-metadata.tentative.html b/trusted-types/TrustedTypePolicyFactory-metadata.tentative.html index 67c734b5a42855..73122deedd5db5 100644 --- a/trusted-types/TrustedTypePolicyFactory-metadata.tentative.html +++ b/trusted-types/TrustedTypePolicyFactory-metadata.tentative.html @@ -122,7 +122,7 @@ } assert_equals("" + result_value, "" + value); } else { - assert_throws(new TypeError(), test_fn, "throws"); + assert_throws_js(TypeError, test_fn, "throws"); } }, `Test assignment of ${type ? type : "string"} on ${elem}.${property}`); @@ -137,7 +137,7 @@ test_fn(); assert_equals("" + element.getAttribute(property), "" + value); } else { - assert_throws(new TypeError(), test_fn, "throws"); + assert_throws_js(TypeError, test_fn, "throws"); } }, `Test assignment of ${type ? type : "string"} on ${elem}.setAttribute(${property},..)`); } diff --git a/trusted-types/Window-TrustedTypes.tentative.html b/trusted-types/Window-TrustedTypes.tentative.html index c61d9207b65f43..718c763afafd12 100644 --- a/trusted-types/Window-TrustedTypes.tentative.html +++ b/trusted-types/Window-TrustedTypes.tentative.html @@ -10,7 +10,7 @@ }, "factory = window.trustedTypes"); test(t => { - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { let factory = new TrustedTypePolicyFactory(); }); }, "factory construction fails"); diff --git a/trusted-types/block-Node-multiple-arguments.tentative.html b/trusted-types/block-Node-multiple-arguments.tentative.html index 879d34f9612694..d66b8c8f25b64e 100644 --- a/trusted-types/block-Node-multiple-arguments.tentative.html +++ b/trusted-types/block-Node-multiple-arguments.tentative.html @@ -57,7 +57,7 @@ var test_fn = _ => { setter.apply(inner, args); }; var expected; if (should_fail) { - assert_throws(new TypeError(), test_fn, "This should throw."); + assert_throws_js(TypeError, test_fn, "This should throw."); expected = ""; } else { test_fn(); @@ -74,7 +74,7 @@ var test_fn = _ => { setter.apply(outer, args); }; var expected; if (should_fail) { - assert_throws(new TypeError(), test_fn, "This should throw."); + assert_throws_js(TypeError, test_fn, "This should throw."); expected = ""; } else { test_fn(); diff --git a/trusted-types/block-string-assignment-to-DOMParser-parseFromString.tentative.html b/trusted-types/block-string-assignment-to-DOMParser-parseFromString.tentative.html index 12cef6af661a5f..bd038635df7356 100644 --- a/trusted-types/block-string-assignment-to-DOMParser-parseFromString.tentative.html +++ b/trusted-types/block-string-assignment-to-DOMParser-parseFromString.tentative.html @@ -18,7 +18,7 @@ // String assignments throw. test(t => { var parser = new DOMParser(); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { var doc = parser.parseFromString("Fail", "text/html"); }); }, "`document.innerText = string` throws."); @@ -26,7 +26,7 @@ // Null assignment throws. test(t => { var parser = new DOMParser(); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { var doc = parser.parseFromString(null, "text/html"); }); }, "'document.innerText = null' throws"); diff --git a/trusted-types/block-string-assignment-to-DOMWindowTimers-setTimeout-setInterval.tentative.html b/trusted-types/block-string-assignment-to-DOMWindowTimers-setTimeout-setInterval.tentative.html index 6d723ba23b6b19..d2764936675168 100644 --- a/trusted-types/block-string-assignment-to-DOMWindowTimers-setTimeout-setInterval.tentative.html +++ b/trusted-types/block-string-assignment-to-DOMWindowTimers-setTimeout-setInterval.tentative.html @@ -18,14 +18,14 @@ // String assignments throw. test(t => { window.timeoutTestString = t.unreached_func(); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { setTimeout("window.timeoutTestString();"); }); }, "`window.setTimeout(string)` throws."); // Null assignment throws. test(t => { - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { setTimeout(null); }); }, "`window.setTimeout(null)` throws."); @@ -42,14 +42,14 @@ // String assignments throw. test(t => { window.intervalTestString = t.unreached_func(); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { setInterval("window.intervalTestString()"); }); }, "`window.setInterval(string)` throws."); // Null assignment throws. test(t => { - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { setInterval(null); }); }, "`window.setInterval(null)` throws."); diff --git a/trusted-types/block-string-assignment-to-Document-write.tentative.html b/trusted-types/block-string-assignment-to-Document-write.tentative.html index 1049b46563d4b9..fa87d119f79f69 100644 --- a/trusted-types/block-string-assignment-to-Document-write.tentative.html +++ b/trusted-types/block-string-assignment-to-Document-write.tentative.html @@ -29,7 +29,7 @@ // String assignments throw. test(t => { const old = document.body.innerText; - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { document.write('A string'); }); assert_equals(document.body.innerText, old); @@ -38,7 +38,7 @@ // String assignments throw. (Now for writeln.) test(t => { const old = document.body.innerText; - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { document.writeln('A string'); }); assert_equals(document.body.innerText, old); @@ -47,7 +47,7 @@ // Null assignment throws. test(t => { const old = document.body.innerText; - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { document.write(null); }); assert_equals(document.body.innerText, old); @@ -56,7 +56,7 @@ // Null assignment throws. (Now for writeln.) test(t => { const old = document.body.innerText; - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { document.writeln(null); }); assert_equals(document.body.innerText, old); diff --git a/trusted-types/block-string-assignment-to-Element-insertAdjacentHTML.tentative.html b/trusted-types/block-string-assignment-to-Element-insertAdjacentHTML.tentative.html index 1e8c091d87e70b..c91e4e56acd483 100644 --- a/trusted-types/block-string-assignment-to-Element-insertAdjacentHTML.tentative.html +++ b/trusted-types/block-string-assignment-to-Element-insertAdjacentHTML.tentative.html @@ -45,16 +45,16 @@ var d = document.createElement('div'); container.appendChild(d); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { d.insertAdjacentHTML('beforebegin', "<p>Fail</p>"); }); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { d.insertAdjacentHTML('afterbegin', "<p>Fail</p>"); }); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { d.insertAdjacentHTML('beforeend', "<p>Fail</p>"); }); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { d.insertAdjacentHTML('afterend', "<p>Fail</p>"); }); @@ -72,16 +72,16 @@ var d = document.createElement('div'); container.appendChild(d); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { d.insertAdjacentHTML('beforebegin', null); }); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { d.insertAdjacentHTML('afterbegin', null); }); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { d.insertAdjacentHTML('beforeend', null); }); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { d.insertAdjacentHTML('afterend', null); }); diff --git a/trusted-types/block-string-assignment-to-Element-outerHTML.tentative.html b/trusted-types/block-string-assignment-to-Element-outerHTML.tentative.html index 17815e6a9e9bfe..397606bc056a8d 100644 --- a/trusted-types/block-string-assignment-to-Element-outerHTML.tentative.html +++ b/trusted-types/block-string-assignment-to-Element-outerHTML.tentative.html @@ -30,7 +30,7 @@ test(t => { var d = document.createElement('div'); container.appendChild(d); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { d.outerHTML = "Fail."; }); assert_equals(container.innerText, ""); @@ -42,7 +42,7 @@ test(t => { var d = document.createElement('div'); container.appendChild(d); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { d.outerHTML = null; }); assert_equals(container.innerText, ""); diff --git a/trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html b/trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html index 47c4c3557f8363..e6abf602fb0881 100644 --- a/trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html +++ b/trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html @@ -59,7 +59,7 @@ test(t => { let el = document.createElement('script'); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { el.setAttribute('SrC', INPUTS.URL); }); diff --git a/trusted-types/block-string-assignment-to-Element-setAttributeNS.tentative.html b/trusted-types/block-string-assignment-to-Element-setAttributeNS.tentative.html index cc8b05e8c8370a..aa13d72ceb2f53 100644 --- a/trusted-types/block-string-assignment-to-Element-setAttributeNS.tentative.html +++ b/trusted-types/block-string-assignment-to-Element-setAttributeNS.tentative.html @@ -52,7 +52,7 @@ let elem = document.createElementNS(svg, "script"); const values = [ "abc", null, html, script ]; for (const v of values) { - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { elem.setAttributeNS(xlink, "href", v); }); } diff --git a/trusted-types/block-string-assignment-to-Range-createContextualFragment.tentative.html b/trusted-types/block-string-assignment-to-Range-createContextualFragment.tentative.html index a57376206de6f1..b38e4f3da5f872 100644 --- a/trusted-types/block-string-assignment-to-Range-createContextualFragment.tentative.html +++ b/trusted-types/block-string-assignment-to-Range-createContextualFragment.tentative.html @@ -20,7 +20,7 @@ test(t => { var range = document.createRange(); range.selectNodeContents(document.documentElement); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { var result = range.createContextualFragment("A string"); }); }, "`range.createContextualFragment(string)` throws."); @@ -29,7 +29,7 @@ test(t => { var range = document.createRange(); range.selectNodeContents(document.documentElement); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { var result = range.createContextualFragment(null); }); }, "`range.createContextualFragment(null)` throws."); diff --git a/trusted-types/block-text-node-insertion-into-script-element.tentative.html b/trusted-types/block-text-node-insertion-into-script-element.tentative.html index 1f5e8fda7aeacc..607a622f2b3e9e 100644 --- a/trusted-types/block-text-node-insertion-into-script-element.tentative.html +++ b/trusted-types/block-text-node-insertion-into-script-element.tentative.html @@ -156,12 +156,12 @@ promise_test(t => { const inserted_script = document.getElementById("script1"); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { inserted_script.innerHTML = "2+2"; }); let new_script = document.createElement("script"); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { new_script.innerHTML = "2+2"; container.appendChild(new_script); }); diff --git a/trusted-types/csp-block-eval.tentative.html b/trusted-types/csp-block-eval.tentative.html index 93a97f15f8a972..7902ca4040f582 100644 --- a/trusted-types/csp-block-eval.tentative.html +++ b/trusted-types/csp-block-eval.tentative.html @@ -14,7 +14,7 @@ test(t => { let a = 0; - assert_throws(new EvalError(), _ => { + assert_throws_js(EvalError, _ => { eval('a="hello there"'); }); assert_equals(a, 0); @@ -22,7 +22,7 @@ test(t => { let a = 0; - assert_throws(new EvalError(), _ => { + assert_throws_js(EvalError, _ => { eval(p.createScript('a="Hello transformed string"')); }); assert_equals(a, 0); diff --git a/trusted-types/eval-csp-tt-no-default-policy.tentative.html b/trusted-types/eval-csp-tt-no-default-policy.tentative.html index 0da09a8a5cd1c2..6d48ae48a01a15 100644 --- a/trusted-types/eval-csp-tt-no-default-policy.tentative.html +++ b/trusted-types/eval-csp-tt-no-default-policy.tentative.html @@ -15,7 +15,7 @@ }, "eval of TrustedScript works."); test(t => { - assert_throws(new EvalError(), _ => eval('1+1')); + assert_throws_js(EvalError, _ => eval('1+1')); }, "eval of string fails."); test(t => { diff --git a/trusted-types/eval-with-permissive-csp.tentative.html b/trusted-types/eval-with-permissive-csp.tentative.html index 32f12d8e129d69..5a35561438ab93 100644 --- a/trusted-types/eval-with-permissive-csp.tentative.html +++ b/trusted-types/eval-with-permissive-csp.tentative.html @@ -14,7 +14,7 @@ let p = createScript_policy(window, 1); test(t => { let a = 0; - assert_throws(new EvalError(), _ => { + assert_throws_js(EvalError, _ => { eval('a="hello there"'); }); assert_equals(a, 0); diff --git a/trusted-types/support/WorkerGlobalScope-importScripts.https.js b/trusted-types/support/WorkerGlobalScope-importScripts.https.js index fa63c8bad0fcd9..c40e8550dd659e 100644 --- a/trusted-types/support/WorkerGlobalScope-importScripts.https.js +++ b/trusted-types/support/WorkerGlobalScope-importScripts.https.js @@ -27,13 +27,13 @@ test(t => { test(t => { let untrusted_url = "player.js"; - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { importScripts(untrusted_url) }, "importScripts(untrusted_url)"); }, "importScripts with untrusted URLs throws in " + worker_type); test(t => { - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { importScripts(null) }, "importScripts(null)"); }, "null is not a trusted script URL throws in " + worker_type); @@ -49,7 +49,7 @@ test(t => { test(t => { let untrusted_url = "player.js?variant1"; let untrusted_url2 = "player.js?variant2"; - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { importScripts(untrusted_url, untrusted_url2) }, "importScripts(untrusted_url, untrusted_url2)"); }, "importScripts with two URLs, both strings, in " + worker_type); @@ -57,7 +57,7 @@ test(t => { test(t => { let untrusted_url = "player.js"; let trusted_url = test_policy.createScriptURL(untrusted_url); - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { importScripts(untrusted_url, trusted_url) }, "importScripts(untrusted_url, trusted_url)"); }, "importScripts with two URLs, one trusted, in " + worker_type); diff --git a/trusted-types/support/helper.sub.js b/trusted-types/support/helper.sub.js index 20f56c3cbc7af0..2d1bd436bdf35f 100644 --- a/trusted-types/support/helper.sub.js +++ b/trusted-types/support/helper.sub.js @@ -75,7 +75,7 @@ function assert_element_accepts_trusted_type(tag, attribute, value, expected) { function assert_throws_no_trusted_type(tag, attribute, value) { let elem = document.createElement(tag); let prev = elem[attribute]; - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { elem[attribute] = value; }); assert_equals(elem[attribute], prev); @@ -111,7 +111,7 @@ function assert_element_accepts_trusted_type_explicit_set(tag, attribute, value, function assert_throws_no_trusted_type_explicit_set(tag, attribute, value) { let elem = document.createElement(tag); let prev = elem[attribute]; - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { elem.setAttribute(attribute, value); }); assert_equals(elem[attribute], prev); @@ -153,7 +153,7 @@ function assert_element_accepts_trusted_type_set_ns(tag, attribute, value, expec function assert_throws_no_trusted_type_set_ns(tag, attribute, value) { let elem = document.createElement(tag); - assert_throws(new TypeError(), _ => { + assert_throws_js(TypeError, _ => { elem.setAttributeNS(namespace, attribute, value); }); } diff --git a/trusted-types/trusted-types-createHTMLDocument.tentative.html b/trusted-types/trusted-types-createHTMLDocument.tentative.html index 711e494a1607d5..ac95d9e64de97d 100644 --- a/trusted-types/trusted-types-createHTMLDocument.tentative.html +++ b/trusted-types/trusted-types-createHTMLDocument.tentative.html @@ -35,7 +35,7 @@ for (let doc_type in doc_types) { doc_test(doc_type, doc => { - assert_throws(new TypeError(), + assert_throws_js(TypeError, _ => { doc.createElement("script").textContent = "2+2"; }); }, "Trusted Type assignment is blocked." ); @@ -44,7 +44,7 @@ const value = policy.createHTML("hello"); doc.body.innerHTML = value; assert_equals(doc.body.textContent, "hello"); - assert_throws(new TypeError(), + assert_throws_js(TypeError, _ => { doc.body.innerHTML = "world"; }); }, "Trusted Type instances created in the main doc can be used."); } diff --git a/trusted-types/trusted-types-duplicate-names-list.tentative.html b/trusted-types/trusted-types-duplicate-names-list.tentative.html index 839f2ef7a3ac5e..9a895ffa2ad2b1 100644 --- a/trusted-types/trusted-types-duplicate-names-list.tentative.html +++ b/trusted-types/trusted-types-duplicate-names-list.tentative.html @@ -8,13 +8,13 @@ <script> test(t => { trustedTypes.createPolicy("a", {}), - assert_throws(new TypeError(), + assert_throws_js(TypeError, _ => trustedTypes.createPolicy("a", {}), "Duplicate name"); trustedTypes.createPolicy("b", {}), - assert_throws(new TypeError(), + assert_throws_js(TypeError, _ => trustedTypes.createPolicy("d", {}), "Invalid name."); }, "TrustedTypePolicyFactory and policy list in CSP."); diff --git a/trusted-types/trusted-types-duplicate-names.tentative.html b/trusted-types/trusted-types-duplicate-names.tentative.html index fb808246ac8aa0..e817cf145a260b 100644 --- a/trusted-types/trusted-types-duplicate-names.tentative.html +++ b/trusted-types/trusted-types-duplicate-names.tentative.html @@ -18,7 +18,7 @@ assert_equals("" + b.createHTML(""), "b"); let def = trustedTypes.createPolicy("default", {}); - assert_throws(new TypeError(), + assert_throws_js(TypeError, _ => trustedTypes.createPolicy("default", {})); }, "policy - duplicate names"); </script> diff --git a/trusted-types/trusted-types-eval-reporting.tentative.https.html b/trusted-types/trusted-types-eval-reporting.tentative.https.html index a521f94389ae04..90007168a13d1d 100644 --- a/trusted-types/trusted-types-eval-reporting.tentative.https.html +++ b/trusted-types/trusted-types-eval-reporting.tentative.https.html @@ -70,7 +70,7 @@ let p = Promise.resolve() .then(promise_violation("require-trusted-types-for 'script'")) .then(promise_flush()); - assert_throws(new EvalError(), + assert_throws_js(EvalError, _ => eval('beacon="should not run"')); assert_equals(beacon, 'never_overwritten'); flush(); diff --git a/trusted-types/tt-block-eval.tentative.html b/trusted-types/tt-block-eval.tentative.html index 8fe8aa50d6c9f8..f9c1a5d0b12365 100644 --- a/trusted-types/tt-block-eval.tentative.html +++ b/trusted-types/tt-block-eval.tentative.html @@ -11,7 +11,7 @@ test(t => { let a = 0; - assert_throws(new EvalError(), _ => { + assert_throws_js(EvalError, _ => { eval('a="hello there"'); }); assert_equals(a, 0); diff --git a/uievents/legacy/Event-subclasses-init.html b/uievents/legacy/Event-subclasses-init.html index 676eec9280907b..a79a9f18adba6e 100644 --- a/uievents/legacy/Event-subclasses-init.html +++ b/uievents/legacy/Event-subclasses-init.html @@ -11,7 +11,7 @@ let event = new eventType('test'); let initFunction = "init" + eventTypeName; - assert_throws(new TypeError(), function() { eventType.prototype[initFunction].call(event) }); + assert_throws_js(TypeError, function() { eventType.prototype[initFunction].call(event) }); }, `Call init${eventTypeName} without parameters`); } </script> diff --git a/url/failure.html b/url/failure.html index ac16edf8c743af..e2a88752b75bd5 100644 --- a/url/failure.html +++ b/url/failure.html @@ -20,7 +20,7 @@ self.test(() => { // URL's constructor's first argument is tested by url-constructor.html // If a URL fails to parse with any valid base, it must also fail to parse with no base, i.e. // when used as a base URL itself. - assert_throws(new TypeError(), () => new URL("about:blank", test.input)); + assert_throws_js(TypeError, () => new URL("about:blank", test.input)); }, "URL's constructor's base argument: " + name) self.test(() => { diff --git a/url/historical.any.js b/url/historical.any.js index 407e118f3a05f9..c3067dfd730123 100644 --- a/url/historical.any.js +++ b/url/historical.any.js @@ -15,7 +15,7 @@ if(self.GLOBAL.isWindow()) { test(function() { var url = new URL("./foo", "http://www.example.org"); assert_equals(url.href, "http://www.example.org/foo"); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { url.href = "./bar"; }); }, "Setting URL's href attribute and base URLs"); diff --git a/url/url-constructor.html b/url/url-constructor.html index cb4c0db3571d2f..7ddcdc88170c20 100644 --- a/url/url-constructor.html +++ b/url/url-constructor.html @@ -15,7 +15,7 @@ test(function() { if (expected.failure) { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { bURL(expected.input, expected.base) }) return diff --git a/user-timing/invoke_without_parameter.html b/user-timing/invoke_without_parameter.html index e47a3ba7a981e9..114435e59befbb 100644 --- a/user-timing/invoke_without_parameter.html +++ b/user-timing/invoke_without_parameter.html @@ -15,11 +15,11 @@ <h1>Description</h1> <div id="log"></div> <script> test(function () { - assert_throws(new TypeError(), function () { window.performance.mark() }); + assert_throws_js(TypeError, function () { window.performance.mark() }); }, "window.performance.mark() throws a TypeError exception when invoke without a parameter."); test(function () { - assert_throws(new TypeError(), function () { window.performance.measure(); }); + assert_throws_js(TypeError, function () { window.performance.measure(); }); }, "window.performance.measure() throws a TypeError exception when invoke without a parameter."); </script> </body> diff --git a/user-timing/mark-errors.any.js b/user-timing/mark-errors.any.js index 3207d18b048daf..dcd36695e22f2c 100644 --- a/user-timing/mark-errors.any.js +++ b/user-timing/mark-errors.any.js @@ -1,15 +1,15 @@ test(function() { - assert_throws(new TypeError(), function() { self.performance.mark("mark1", 123); }, "Number passed as a dict argument should cause type-error.") + assert_throws_js(TypeError, function() { self.performance.mark("mark1", 123); }, "Number passed as a dict argument should cause type-error.") }, "Number should be rejected as the mark-options.") test(function() { - assert_throws(new TypeError(), function() { self.performance.mark("mark1", NaN); }, "NaN passed as a dict argument should cause type-error.") + assert_throws_js(TypeError, function() { self.performance.mark("mark1", NaN); }, "NaN passed as a dict argument should cause type-error.") }, "NaN should be rejected as the mark-options.") test(function() { - assert_throws(new TypeError(), function() { self.performance.mark("mark1", Infinity); }, "Infinity passed as a dict argument should cause type-error.") + assert_throws_js(TypeError, function() { self.performance.mark("mark1", Infinity); }, "Infinity passed as a dict argument should cause type-error.") }, "Infinity should be rejected as the mark-options.") test(function() { - assert_throws(new TypeError(), function() { self.performance.mark("mark1", "string"); }, "String passed as a dict argument should cause type-error.") + assert_throws_js(TypeError, function() { self.performance.mark("mark1", "string"); }, "String passed as a dict argument should cause type-error.") }, "String should be rejected as the mark-options.") diff --git a/user-timing/mark_exceptions.html b/user-timing/mark_exceptions.html index e1f4c4e0f49484..b445c6b8778ae7 100644 --- a/user-timing/mark_exceptions.html +++ b/user-timing/mark_exceptions.html @@ -12,14 +12,14 @@ <script> function test_exception(attrName) { test(function () { - assert_throws(new SyntaxError(), function () { + assert_throws_dom("SyntaxError", function () { window.performance.mark(attrName); }) }, "window.performance.mark(\"" + attrName + "\") throws a SyntaxError exception."); } test(() => { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { window.performance.mark(); }); }, 'window.performance.mark() throws a TypeError exception.') diff --git a/user-timing/measure-with-dict.any.js b/user-timing/measure-with-dict.any.js index 95160fea8941d5..b452feb0de6fbb 100644 --- a/user-timing/measure-with-dict.any.js +++ b/user-timing/measure-with-dict.any.js @@ -96,16 +96,16 @@ async_test(function (t) { test(function() { this.add_cleanup(cleanupPerformanceTimeline); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { self.performance.measure("optionsAndNumberEnd", {'start': 2}, 12); }, "measure should throw a TypeError when passed an options object and an end time"); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { self.performance.measure("optionsAndMarkEnd", {'start': 2}, 'mark1'); }, "measure should throw a TypeError when passed an options object and an end mark"); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { self.performance.measure("negativeStartInOptions", {'start': -1}); }, "measure cannot have a negative time stamp."); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { self.performance.measure("negativeEndInOptions", {'end': -1}); }, "measure cannot have a negative time stamp for end."); }, "measure should throw a TypeError when passed an invalid argument combination"); diff --git a/user-timing/measure_syntax_err.any.js b/user-timing/measure_syntax_err.any.js index 84829f11eb166c..9b762a40906351 100644 --- a/user-timing/measure_syntax_err.any.js +++ b/user-timing/measure_syntax_err.any.js @@ -5,28 +5,28 @@ test(function () { self.performance.measure("measure", "existing_mark"); }, "Create a mark \"existing_mark\""); test(function () { - assert_throws(new SyntaxError(), function () { + assert_throws_dom("SyntaxError", function () { self.performance.measure("measure", "mark"); }); }, "self.performance.measure(\"measure\", \"mark\"), where \"mark\" is a non-existent mark, " + "throws a SyntaxError exception."); test(function () { - assert_throws(new SyntaxError(), function () { + assert_throws_dom("SyntaxError", function () { self.performance.measure("measure", "mark", "existing_mark"); }); }, "self.performance.measure(\"measure\", \"mark\", \"existing_mark\"), where \"mark\" is a " + "non-existent mark, throws a SyntaxError exception."); test(function () { - assert_throws(new SyntaxError(), function () { + assert_throws_dom("SyntaxError", function () { self.performance.measure("measure", "existing_mark", "mark"); }); }, "self.performance.measure(\"measure\", \"existing_mark\", \"mark\"), where \"mark\" " + "is a non-existent mark, throws a SyntaxError exception."); test(function () { - assert_throws(new SyntaxError(), function () { + assert_throws_dom("SyntaxError", function () { self.performance.measure("measure", "mark", "mark"); }); }, "self.performance.measure(\"measure\", \"mark\", \"mark\"), where \"mark\" is a " + diff --git a/user-timing/performance-measure-invalid.worker.js b/user-timing/performance-measure-invalid.worker.js index dedd6da8884f1a..29efb729992cc6 100644 --- a/user-timing/performance-measure-invalid.worker.js +++ b/user-timing/performance-measure-invalid.worker.js @@ -1,7 +1,7 @@ importScripts("/resources/testharness.js"); test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { performance.measure('name', 'navigationStart', 'navigationStart'); }); }, "When converting 'navigationStart' to a timestamp, the global object has to be a Window object."); diff --git a/vibration/invalid-values.html b/vibration/invalid-values.html index 9381dadcc06e5d..a8b2534feac011 100644 --- a/vibration/invalid-values.html +++ b/vibration/invalid-values.html @@ -9,7 +9,7 @@ <script> test(function() { assert_precondition(navigator.vibrate, 'navigator.vibrate exists'); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { navigator.vibrate(); }, 'Argument is required, so was expecting a TypeError.'); }, 'Missing pattern argument'); diff --git a/wasm/jsapi/constructor/validate.any.js b/wasm/jsapi/constructor/validate.any.js index 57fa3359770f2c..a0eaa3fb87d624 100644 --- a/wasm/jsapi/constructor/validate.any.js +++ b/wasm/jsapi/constructor/validate.any.js @@ -7,7 +7,7 @@ setup(() => { }); test(() => { - assert_throws(new TypeError(), () => WebAssembly.validate()); + assert_throws_js(TypeError, () => WebAssembly.validate()); }, "Missing argument"); test(() => { @@ -24,7 +24,7 @@ test(() => { Array.from(emptyModuleBinary), ]; for (const argument of invalidArguments) { - assert_throws(new TypeError(), () => WebAssembly.validate(argument), + assert_throws_js(TypeError, () => WebAssembly.validate(argument), `validate(${format_value(argument)})`); } }, "Invalid arguments"); diff --git a/wasm/jsapi/global/constructor.any.js b/wasm/jsapi/global/constructor.any.js index 237f99c8b29818..cb287da4e9afa1 100644 --- a/wasm/jsapi/global/constructor.any.js +++ b/wasm/jsapi/global/constructor.any.js @@ -19,12 +19,12 @@ test(() => { }, "length"); test(() => { - assert_throws(new TypeError(), () => new WebAssembly.Global()); + assert_throws_js(TypeError, () => new WebAssembly.Global()); }, "No arguments"); test(() => { const argument = { "value": "i32" }; - assert_throws(new TypeError(), () => WebAssembly.Global(argument)); + assert_throws_js(TypeError, () => WebAssembly.Global(argument)); }, "Calling"); test(() => { @@ -73,7 +73,7 @@ test(() => { {}, ]; for (const invalidArgument of invalidArguments) { - assert_throws(new TypeError(), + assert_throws_js(TypeError, () => new WebAssembly.Global(invalidArgument), `new Global(${format_value(invalidArgument)})`); } @@ -83,15 +83,15 @@ test(() => { const invalidTypes = ["i16", "i128", "f16", "f128", "u32", "u64", "i32\0"]; for (const value of invalidTypes) { const argument = { value }; - assert_throws(new TypeError(), () => new WebAssembly.Global(argument)); + assert_throws_js(TypeError, () => new WebAssembly.Global(argument)); } }, "Invalid type argument"); test(() => { const argument = { "value": "i64" }; const global = new WebAssembly.Global(argument); - assert_throws(new TypeError(), () => global.value); - assert_throws(new TypeError(), () => global.valueOf()); + assert_throws_js(TypeError, () => global.value); + assert_throws_js(TypeError, () => global.valueOf()); }, "i64 with default"); for (const type of ["i32", "f32", "f64"]) { diff --git a/wasm/jsapi/global/value-get-set.any.js b/wasm/jsapi/global/value-get-set.any.js index 7b45ddc20b273f..69f0e46379ffd2 100644 --- a/wasm/jsapi/global/value-get-set.any.js +++ b/wasm/jsapi/global/value-get-set.any.js @@ -23,8 +23,8 @@ test(() => { assert_equals(typeof setter, "function"); for (const thisValue of thisValues) { - assert_throws(new TypeError(), () => getter.call(thisValue), `getter with this=${format_value(thisValue)}`); - assert_throws(new TypeError(), () => setter.call(thisValue, 1), `setter with this=${format_value(thisValue)}`); + assert_throws_js(TypeError, () => getter.call(thisValue), `getter with this=${format_value(thisValue)}`); + assert_throws_js(TypeError, () => setter.call(thisValue, 1), `setter with this=${format_value(thisValue)}`); } }, "Branding"); @@ -44,7 +44,7 @@ for (const type of ["i32", "f32", "f64"]) { assert_equals(global.value, 0, "initial value"); assert_equals(global.valueOf(), 0, "initial valueOf"); - assert_throws(new TypeError(), () => global.value = 1); + assert_throws_js(TypeError, () => global.value = 1); assert_equals(global.value, 0, "post-set value"); assert_equals(global.valueOf(), 0, "post-set valueOf"); @@ -60,7 +60,7 @@ for (const type of ["i32", "f32", "f64"]) { valueOf: t.unreached_func("should not call valueOf"), toString: t.unreached_func("should not call toString"), }; - assert_throws(new TypeError(), () => global.value = value); + assert_throws_js(TypeError, () => global.value = value); assert_equals(global.value, 0, "post-set value"); assert_equals(global.valueOf(), 0, "post-set valueOf"); @@ -91,9 +91,9 @@ for (const type of ["i32", "f32", "f64"]) { test(() => { const argument = { "value": "i64", "mutable": true }; const global = new WebAssembly.Global(argument); - assert_throws(new TypeError(), () => global.value); - assert_throws(new TypeError(), () => global.value = 0); - assert_throws(new TypeError(), () => global.valueOf()); + assert_throws_js(TypeError, () => global.value); + assert_throws_js(TypeError, () => global.value = 0); + assert_throws_js(TypeError, () => global.valueOf()); }, "i64 with default"); test(t => { @@ -103,7 +103,7 @@ test(t => { valueOf: t.unreached_func("should not call valueOf"), toString: t.unreached_func("should not call toString"), }; - assert_throws(new TypeError(), () => global.value = value); + assert_throws_js(TypeError, () => global.value = value); }, "i64 with ToNumber side-effects"); test(() => { @@ -115,7 +115,7 @@ test(() => { const setter = desc.set; assert_equals(typeof setter, "function"); - assert_throws(new TypeError(), () => setter.call(global)); + assert_throws_js(TypeError, () => setter.call(global)); }, "Calling setter without argument"); test(() => { diff --git a/wasm/jsapi/global/valueOf.any.js b/wasm/jsapi/global/valueOf.any.js index d4a84b254f76ea..0d4de93a6bd229 100644 --- a/wasm/jsapi/global/valueOf.any.js +++ b/wasm/jsapi/global/valueOf.any.js @@ -17,7 +17,7 @@ test(() => { const fn = WebAssembly.Global.prototype.valueOf; for (const thisValue of thisValues) { - assert_throws(new TypeError(), () => fn.call(thisValue), `this=${format_value(thisValue)}`); + assert_throws_js(TypeError, () => fn.call(thisValue), `this=${format_value(thisValue)}`); } }, "Branding"); diff --git a/wasm/jsapi/instance/constructor.any.js b/wasm/jsapi/instance/constructor.any.js index 1ce4de904e16da..745c3f8495123b 100644 --- a/wasm/jsapi/instance/constructor.any.js +++ b/wasm/jsapi/instance/constructor.any.js @@ -17,7 +17,7 @@ test(() => { }, "length"); test(() => { - assert_throws(new TypeError(), () => new WebAssembly.Instance()); + assert_throws_js(TypeError, () => new WebAssembly.Instance()); }, "No arguments"); test(() => { @@ -33,14 +33,14 @@ test(() => { WebAssembly.Module.prototype, ]; for (const argument of invalidArguments) { - assert_throws(new TypeError(), () => new WebAssembly.Instance(argument), + assert_throws_js(TypeError, () => new WebAssembly.Instance(argument), `new Instance(${format_value(argument)})`); } }, "Non-Module arguments"); test(() => { const module = new WebAssembly.Module(emptyModuleBinary); - assert_throws(new TypeError(), () => WebAssembly.Instance(module)); + assert_throws_js(TypeError, () => WebAssembly.Instance(module)); }, "Calling"); for (const [name, fn] of instanceTestFactory) { diff --git a/wasm/jsapi/instance/exports.any.js b/wasm/jsapi/instance/exports.any.js index 2ba57c5e2fd99c..7c81a41295b0a1 100644 --- a/wasm/jsapi/instance/exports.any.js +++ b/wasm/jsapi/instance/exports.any.js @@ -28,7 +28,7 @@ test(() => { assert_equals(typeof desc.set, "undefined"); for (const thisValue of thisValues) { - assert_throws(new TypeError(), () => getter.call(thisValue), `this=${format_value(thisValue)}`); + assert_throws_js(TypeError, () => getter.call(thisValue), `this=${format_value(thisValue)}`); } }, "Branding"); @@ -58,7 +58,7 @@ test(() => { const module = new WebAssembly.Module(emptyModuleBinary); const instance = new WebAssembly.Instance(module); const exports = instance.exports; - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { "use strict"; instance.exports = {}; }); diff --git a/wasm/jsapi/interface.any.js b/wasm/jsapi/interface.any.js index 98c4a1d781b7d7..88940be51a7f57 100644 --- a/wasm/jsapi/interface.any.js +++ b/wasm/jsapi/interface.any.js @@ -63,11 +63,11 @@ test(() => { }, "WebAssembly: property descriptor"); test(() => { - assert_throws(new TypeError(), () => WebAssembly()); + assert_throws_js(TypeError, () => WebAssembly()); }, "WebAssembly: calling"); test(() => { - assert_throws(new TypeError(), () => new WebAssembly()); + assert_throws_js(TypeError, () => new WebAssembly()); }, "WebAssembly: constructing"); const interfaces = [ diff --git a/wasm/jsapi/memory/buffer.any.js b/wasm/jsapi/memory/buffer.any.js index 4788ffcf84ff8d..a835e6511a0a6c 100644 --- a/wasm/jsapi/memory/buffer.any.js +++ b/wasm/jsapi/memory/buffer.any.js @@ -22,7 +22,7 @@ test(() => { assert_equals(typeof desc.set, "undefined"); for (const thisValue of thisValues) { - assert_throws(new TypeError(), () => getter.call(thisValue), `this=${format_value(thisValue)}`); + assert_throws_js(TypeError, () => getter.call(thisValue), `this=${format_value(thisValue)}`); } }, "Branding"); @@ -56,7 +56,7 @@ test(() => { const memory2 = new WebAssembly.Memory(argument); const buffer = memory.buffer; assert_not_equals(buffer, memory2.buffer, "Need two distinct buffers"); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { "use strict"; memory.buffer = memory2.buffer; }); diff --git a/wasm/jsapi/memory/constructor.any.js b/wasm/jsapi/memory/constructor.any.js index cef713fe0fe74f..8bd606e321283a 100644 --- a/wasm/jsapi/memory/constructor.any.js +++ b/wasm/jsapi/memory/constructor.any.js @@ -31,12 +31,12 @@ test(() => { }, "length"); test(() => { - assert_throws(new TypeError(), () => new WebAssembly.Memory()); + assert_throws_js(TypeError, () => new WebAssembly.Memory()); }, "No arguments"); test(() => { const argument = { "initial": 0 }; - assert_throws(new TypeError(), () => WebAssembly.Memory(argument)); + assert_throws_js(TypeError, () => WebAssembly.Memory(argument)); }, "Calling"); test(() => { @@ -53,14 +53,14 @@ test(() => { {}, ]; for (const invalidArgument of invalidArguments) { - assert_throws(new TypeError(), + assert_throws_js(TypeError, () => new WebAssembly.Memory(invalidArgument), `new Memory(${format_value(invalidArgument)})`); } }, "Invalid descriptor argument"); test(() => { - assert_throws(new TypeError(), () => new WebAssembly.Memory({ "initial": undefined })); + assert_throws_js(TypeError, () => new WebAssembly.Memory({ "initial": undefined })); }, "Undefined initial value in descriptor"); const outOfRangeValues = [ @@ -74,20 +74,20 @@ const outOfRangeValues = [ for (const value of outOfRangeValues) { test(() => { - assert_throws(new TypeError(), () => new WebAssembly.Memory({ "initial": value })); + assert_throws_js(TypeError, () => new WebAssembly.Memory({ "initial": value })); }, `Out-of-range initial value in descriptor: ${format_value(value)}`); test(() => { - assert_throws(new TypeError(), () => new WebAssembly.Memory({ "initial": 0, "maximum": value })); + assert_throws_js(TypeError, () => new WebAssembly.Memory({ "initial": 0, "maximum": value })); }, `Out-of-range maximum value in descriptor: ${format_value(value)}`); } test(() => { - assert_throws(new RangeError(), () => new WebAssembly.Memory({ "initial": 10, "maximum": 9 })); + assert_throws_js(RangeError, () => new WebAssembly.Memory({ "initial": 10, "maximum": 9 })); }, "Initial value exceeds maximum"); test(() => { - assert_throws(new TypeError(), () => new WebAssembly.Memory({ "initial": 10, "shared": true })); + assert_throws_js(TypeError, () => new WebAssembly.Memory({ "initial": 10, "shared": true })); }, "Shared memory without maximum"); test(() => { diff --git a/wasm/jsapi/memory/grow.any.js b/wasm/jsapi/memory/grow.any.js index 11c41942510b65..f07a97c92758ac 100644 --- a/wasm/jsapi/memory/grow.any.js +++ b/wasm/jsapi/memory/grow.any.js @@ -27,7 +27,7 @@ function assert_ArrayBuffer(actual, expected, message) { test(() => { const argument = { "initial": 0 }; const memory = new WebAssembly.Memory(argument); - assert_throws(new TypeError(), () => memory.grow()); + assert_throws_js(TypeError, () => memory.grow()); }, "Missing arguments"); test(t => { @@ -51,7 +51,7 @@ test(t => { const fn = WebAssembly.Memory.prototype.grow; for (const thisValue of thisValues) { - assert_throws(new TypeError(), () => fn.call(thisValue, argument), `this=${format_value(thisValue)}`); + assert_throws_js(TypeError, () => fn.call(thisValue, argument), `this=${format_value(thisValue)}`); } }, "Branding"); @@ -145,7 +145,7 @@ test(() => { const oldMemory = memory.buffer; assert_ArrayBuffer(oldMemory, { "size": 1 }, "Buffer before growing"); - assert_throws(new RangeError(), () => memory.grow(2)); + assert_throws_js(RangeError, () => memory.grow(2)); assert_equals(memory.buffer, oldMemory); assert_ArrayBuffer(memory.buffer, { "size": 1 }, "Buffer before trying to grow"); }, "Zero initial growing too much"); @@ -166,7 +166,7 @@ for (const value of outOfRangeValues) { test(() => { const argument = { "initial": 0 }; const memory = new WebAssembly.Memory(argument); - assert_throws(new TypeError(), () => memory.grow(value)); + assert_throws_js(TypeError, () => memory.grow(value)); }, `Out-of-range argument: ${format_value(value)}`); } diff --git a/wasm/jsapi/module/constructor.any.js b/wasm/jsapi/module/constructor.any.js index 03e508aa1e0f10..1fffb6cd4f3b90 100644 --- a/wasm/jsapi/module/constructor.any.js +++ b/wasm/jsapi/module/constructor.any.js @@ -16,11 +16,11 @@ test(() => { }, "length"); test(() => { - assert_throws(new TypeError(), () => new WebAssembly.Module()); + assert_throws_js(TypeError, () => new WebAssembly.Module()); }, "No arguments"); test(() => { - assert_throws(new TypeError(), () => WebAssembly.Module(emptyModuleBinary)); + assert_throws_js(TypeError, () => WebAssembly.Module(emptyModuleBinary)); }, "Calling"); test(() => { @@ -38,7 +38,7 @@ test(() => { Array.from(emptyModuleBinary), ]; for (const argument of invalidArguments) { - assert_throws(new TypeError(), () => new WebAssembly.Module(argument), + assert_throws_js(TypeError, () => new WebAssembly.Module(argument), `new Module(${format_value(argument)})`); } }, "Invalid arguments"); diff --git a/wasm/jsapi/module/customSections.any.js b/wasm/jsapi/module/customSections.any.js index 09355979d84ade..298d89604cf739 100644 --- a/wasm/jsapi/module/customSections.any.js +++ b/wasm/jsapi/module/customSections.any.js @@ -24,9 +24,9 @@ setup(() => { }); test(() => { - assert_throws(new TypeError(), () => WebAssembly.Module.customSections()); + assert_throws_js(TypeError, () => WebAssembly.Module.customSections()); const module = new WebAssembly.Module(emptyModuleBinary); - assert_throws(new TypeError(), () => WebAssembly.Module.customSections(module)); + assert_throws_js(TypeError, () => WebAssembly.Module.customSections(module)); }, "Missing arguments"); test(() => { @@ -42,7 +42,7 @@ test(() => { WebAssembly.Module.prototype, ]; for (const argument of invalidArguments) { - assert_throws(new TypeError(), () => WebAssembly.Module.customSections(argument, ""), + assert_throws_js(TypeError, () => WebAssembly.Module.customSections(argument, ""), `customSections(${format_value(argument)})`); } }, "Non-Module arguments"); diff --git a/wasm/jsapi/module/exports.any.js b/wasm/jsapi/module/exports.any.js index eadfc84f1e4e77..83f97dd67a1e41 100644 --- a/wasm/jsapi/module/exports.any.js +++ b/wasm/jsapi/module/exports.any.js @@ -35,7 +35,7 @@ function assert_exports(exports, expected) { } test(() => { - assert_throws(new TypeError(), () => WebAssembly.Module.exports()); + assert_throws_js(TypeError, () => WebAssembly.Module.exports()); }, "Missing arguments"); test(() => { @@ -51,7 +51,7 @@ test(() => { WebAssembly.Module.prototype, ]; for (const argument of invalidArguments) { - assert_throws(new TypeError(), () => WebAssembly.Module.exports(argument), + assert_throws_js(TypeError, () => WebAssembly.Module.exports(argument), `exports(${format_value(argument)})`); } }, "Non-Module arguments"); diff --git a/wasm/jsapi/module/imports.any.js b/wasm/jsapi/module/imports.any.js index 9d7ef2f0a9b90a..91e4be33aca695 100644 --- a/wasm/jsapi/module/imports.any.js +++ b/wasm/jsapi/module/imports.any.js @@ -41,7 +41,7 @@ setup(() => { }); test(() => { - assert_throws(new TypeError(), () => WebAssembly.Module.imports()); + assert_throws_js(TypeError, () => WebAssembly.Module.imports()); }, "Missing arguments"); test(() => { @@ -57,7 +57,7 @@ test(() => { WebAssembly.Module.prototype, ]; for (const argument of invalidArguments) { - assert_throws(new TypeError(), () => WebAssembly.Module.imports(argument), + assert_throws_js(TypeError, () => WebAssembly.Module.imports(argument), `imports(${format_value(argument)})`); } }, "Non-Module arguments"); diff --git a/wasm/jsapi/table/assertions.js b/wasm/jsapi/table/assertions.js index c88972b4ebdcd7..c42a446a75d01f 100644 --- a/wasm/jsapi/table/assertions.js +++ b/wasm/jsapi/table/assertions.js @@ -2,12 +2,12 @@ function assert_equal_to_array(table, expected, message) { assert_equals(table.length, expected.length, `${message}: length`); // The argument check in get() happens before the range check, and negative numbers // are illegal, hence will throw TypeError per spec. - assert_throws(new TypeError(), () => table.get(-1), `${message}: table.get(-1)`); + assert_throws_js(TypeError, () => table.get(-1), `${message}: table.get(-1)`); for (let i = 0; i < expected.length; ++i) { assert_equals(table.get(i), expected[i], `${message}: table.get(${i} of ${expected.length})`); } - assert_throws(new RangeError(), () => table.get(expected.length), + assert_throws_js(RangeError, () => table.get(expected.length), `${message}: table.get(${expected.length} of ${expected.length})`); - assert_throws(new RangeError(), () => table.get(expected.length + 1), + assert_throws_js(RangeError, () => table.get(expected.length + 1), `${message}: table.get(${expected.length + 1} of ${expected.length})`); } diff --git a/wasm/jsapi/table/constructor.any.js b/wasm/jsapi/table/constructor.any.js index 99eee19fecd49e..a494a9e559b921 100644 --- a/wasm/jsapi/table/constructor.any.js +++ b/wasm/jsapi/table/constructor.any.js @@ -21,16 +21,16 @@ test(() => { }, "length"); test(() => { - assert_throws(new TypeError(), () => new WebAssembly.Table()); + assert_throws_js(TypeError, () => new WebAssembly.Table()); }, "No arguments"); test(() => { const argument = { "element": "anyfunc", "initial": 0 }; - assert_throws(new TypeError(), () => WebAssembly.Table(argument)); + assert_throws_js(TypeError, () => WebAssembly.Table(argument)); }, "Calling"); test(() => { - assert_throws(new TypeError(), () => new WebAssembly.Table({})); + assert_throws_js(TypeError, () => new WebAssembly.Table({})); }, "Empty descriptor"); test(() => { @@ -47,18 +47,18 @@ test(() => { {}, ]; for (const invalidArgument of invalidArguments) { - assert_throws(new TypeError(), + assert_throws_js(TypeError, () => new WebAssembly.Table(invalidArgument), `new Table(${format_value(invalidArgument)})`); } }, "Invalid descriptor argument"); test(() => { - assert_throws(new TypeError(), () => new WebAssembly.Table({ "element": "anyfunc", "initial": undefined })); + assert_throws_js(TypeError, () => new WebAssembly.Table({ "element": "anyfunc", "initial": undefined })); }, "Undefined initial value in descriptor"); test(() => { - assert_throws(new TypeError(), () => new WebAssembly.Table({ "element": undefined, "initial": 0 })); + assert_throws_js(TypeError, () => new WebAssembly.Table({ "element": undefined, "initial": 0 })); }, "Undefined element value in descriptor"); const outOfRangeValues = [ @@ -72,16 +72,16 @@ const outOfRangeValues = [ for (const value of outOfRangeValues) { test(() => { - assert_throws(new TypeError(), () => new WebAssembly.Table({ "element": "anyfunc", "initial": value })); + assert_throws_js(TypeError, () => new WebAssembly.Table({ "element": "anyfunc", "initial": value })); }, `Out-of-range initial value in descriptor: ${format_value(value)}`); test(() => { - assert_throws(new TypeError(), () => new WebAssembly.Table({ "element": "anyfunc", "initial": 0, "maximum": value })); + assert_throws_js(TypeError, () => new WebAssembly.Table({ "element": "anyfunc", "initial": 0, "maximum": value })); }, `Out-of-range maximum value in descriptor: ${format_value(value)}`); } test(() => { - assert_throws(new RangeError(), () => new WebAssembly.Table({ "element": "anyfunc", "initial": 10, "maximum": 9 })); + assert_throws_js(RangeError, () => new WebAssembly.Table({ "element": "anyfunc", "initial": 10, "maximum": 9 })); }, "Initial value exceeds maximum"); test(() => { diff --git a/wasm/jsapi/table/get-set.any.js b/wasm/jsapi/table/get-set.any.js index bd053b389c904e..175f30fbcadca6 100644 --- a/wasm/jsapi/table/get-set.any.js +++ b/wasm/jsapi/table/get-set.any.js @@ -24,7 +24,7 @@ setup(() => { test(() => { const argument = { "element": "anyfunc", "initial": 5 }; const table = new WebAssembly.Table(argument); - assert_throws(new TypeError(), () => table.get()); + assert_throws_js(TypeError, () => table.get()); }, "Missing arguments: get"); test(t => { @@ -48,15 +48,15 @@ test(t => { const fn = WebAssembly.Table.prototype.get; for (const thisValue of thisValues) { - assert_throws(new TypeError(), () => fn.call(thisValue, argument), `this=${format_value(thisValue)}`); + assert_throws_js(TypeError, () => fn.call(thisValue, argument), `this=${format_value(thisValue)}`); } }, "Branding: get"); test(() => { const argument = { "element": "anyfunc", "initial": 5 }; const table = new WebAssembly.Table(argument); - assert_throws(new TypeError(), () => table.set()); - assert_throws(new TypeError(), () => table.set(0)); + assert_throws_js(TypeError, () => table.set()); + assert_throws_js(TypeError, () => table.set(0)); }, "Missing arguments: set"); test(t => { @@ -80,7 +80,7 @@ test(t => { const fn = WebAssembly.Table.prototype.set; for (const thisValue of thisValues) { - assert_throws(new TypeError(), () => fn.call(thisValue, argument, null), `this=${format_value(thisValue)}`); + assert_throws_js(TypeError, () => fn.call(thisValue, argument, null), `this=${format_value(thisValue)}`); } }, "Branding: set"); @@ -128,8 +128,8 @@ test(() => { // -1 is the wrong type hence the type check on entry gets this // before the range check does. - assert_throws(new TypeError(), () => table.set(-1, fn)); - assert_throws(new RangeError(), () => table.set(5, fn)); + assert_throws_js(TypeError, () => table.set(-1, fn)); + assert_throws_js(RangeError, () => table.set(5, fn)); assert_equal_to_array(table, [null, null, null, null, null]); }, "Setting out-of-bounds"); @@ -149,7 +149,7 @@ test(() => { {}, ]; for (const argument of invalidArguments) { - assert_throws(new TypeError(), () => table.set(0, argument), + assert_throws_js(TypeError, () => table.set(0, argument), `set(${format_value(argument)})`); } assert_equal_to_array(table, [null]); @@ -161,7 +161,7 @@ test(() => { assert_equal_to_array(table, [null]); const fn = function() {}; - assert_throws(new TypeError(), () => table.set(0, fn)); + assert_throws_js(TypeError, () => table.set(0, fn)); assert_equal_to_array(table, [null]); }, "Setting non-wasm function"); @@ -171,7 +171,7 @@ test(() => { assert_equal_to_array(table, [null]); const fn = () => {}; - assert_throws(new TypeError(), () => table.set(0, fn)); + assert_throws_js(TypeError, () => table.set(0, fn)); assert_equal_to_array(table, [null]); }, "Setting non-wasm arrow function"); @@ -191,13 +191,13 @@ for (const value of outOfRangeValues) { test(() => { const argument = { "element": "anyfunc", "initial": 1 }; const table = new WebAssembly.Table(argument); - assert_throws(new TypeError(), () => table.get(value)); + assert_throws_js(TypeError, () => table.get(value)); }, `Getting out-of-range argument: ${format_value(value)}`); test(() => { const argument = { "element": "anyfunc", "initial": 1 }; const table = new WebAssembly.Table(argument); - assert_throws(new TypeError(), () => table.set(value, null)); + assert_throws_js(TypeError, () => table.set(value, null)); }, `Setting out-of-range argument: ${format_value(value)}`); } @@ -211,7 +211,7 @@ test(() => { return 0; }, }; - assert_throws(new TypeError(), () => table.set(value, {})); + assert_throws_js(TypeError, () => table.set(value, {})); assert_equals(called, 1); }, "Order of argument conversion"); diff --git a/wasm/jsapi/table/grow-reftypes.tentative.any.js b/wasm/jsapi/table/grow-reftypes.tentative.any.js index 807aea991bbc82..54141c059ed04e 100644 --- a/wasm/jsapi/table/grow-reftypes.tentative.any.js +++ b/wasm/jsapi/table/grow-reftypes.tentative.any.js @@ -32,11 +32,11 @@ test(() => { test(() => { const argument = { "element": "anyfunc", "initial": 1 }; const table = new WebAssembly.Table(argument); - assert_throws(new TypeError(), () => table.grow(2, {})); + assert_throws_js(TypeError, () => table.grow(2, {})); }, "Grow with non-function argument"); test(() => { const argument = { "element": "anyfunc", "initial": 1 }; const table = new WebAssembly.Table(argument); - assert_throws(new TypeError(), () => table.grow(2, () => true)); + assert_throws_js(TypeError, () => table.grow(2, () => true)); }, "Grow with JS-function argument"); diff --git a/wasm/jsapi/table/grow.any.js b/wasm/jsapi/table/grow.any.js index 558b49d1c7d3bc..f543cc620bcc4c 100644 --- a/wasm/jsapi/table/grow.any.js +++ b/wasm/jsapi/table/grow.any.js @@ -8,7 +8,7 @@ function nulls(n) { test(() => { const argument = { "element": "anyfunc", "initial": 5 }; const table = new WebAssembly.Table(argument); - assert_throws(new TypeError(), () => table.grow()); + assert_throws_js(TypeError, () => table.grow()); }, "Missing arguments"); test(t => { @@ -32,7 +32,7 @@ test(t => { const fn = WebAssembly.Table.prototype.grow; for (const thisValue of thisValues) { - assert_throws(new TypeError(), () => fn.call(thisValue, argument), `this=${format_value(thisValue)}`); + assert_throws_js(TypeError, () => fn.call(thisValue, argument), `this=${format_value(thisValue)}`); } }, "Branding"); @@ -61,7 +61,7 @@ test(() => { const table = new WebAssembly.Table(argument); assert_equal_to_array(table, nulls(2), "before"); - assert_throws(new RangeError(), () => table.grow(4)); + assert_throws_js(RangeError, () => table.grow(4)); assert_equal_to_array(table, nulls(2), "after"); }, "Exceeded maximum"); @@ -81,7 +81,7 @@ for (const value of outOfRangeValues) { test(() => { const argument = { "element": "anyfunc", "initial": 1 }; const table = new WebAssembly.Table(argument); - assert_throws(new TypeError(), () => table.grow(value)); + assert_throws_js(TypeError, () => table.grow(value)); }, `Out-of-range argument: ${format_value(value)}`); } diff --git a/wasm/jsapi/table/length.any.js b/wasm/jsapi/table/length.any.js index b1bfa6cfd1f44f..f4e11484797290 100644 --- a/wasm/jsapi/table/length.any.js +++ b/wasm/jsapi/table/length.any.js @@ -22,7 +22,7 @@ test(() => { assert_equals(typeof desc.set, "undefined"); for (const thisValue of thisValues) { - assert_throws(new TypeError(), () => getter.call(thisValue), `this=${format_value(thisValue)}`); + assert_throws_js(TypeError, () => getter.call(thisValue), `this=${format_value(thisValue)}`); } }, "Branding"); @@ -52,7 +52,7 @@ test(() => { const argument = { "element": "anyfunc", "initial": 2 }; const table = new WebAssembly.Table(argument); assert_equals(table.length, 2, "Initial length"); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { "use strict"; table.length = 4; }); diff --git a/wasm/serialization/arraybuffer/transfer.window.js b/wasm/serialization/arraybuffer/transfer.window.js index 3edfdaad958b09..b2b5697fca306a 100644 --- a/wasm/serialization/arraybuffer/transfer.window.js +++ b/wasm/serialization/arraybuffer/transfer.window.js @@ -1,6 +1,6 @@ test(() => { const buffer = new WebAssembly.Memory({initial: 4}).buffer; - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { postMessage('foo', '*', [buffer]); }); }); diff --git a/web-share/canShare-files.tentative.https.html b/web-share/canShare-files.tentative.https.html index 98863a4e2112e8..2c2f2ff9699020 100644 --- a/web-share/canShare-files.tentative.https.html +++ b/web-share/canShare-files.tentative.https.html @@ -13,7 +13,7 @@ const emptyFile = new File([''], 'empty'); test(() => { - assert_throws(new TypeError(), () => { navigator.canShare({files: textFile}) }); + assert_throws_js(TypeError, () => { navigator.canShare({files: textFile}) }); }, 'canShare with single file'); test(() => { diff --git a/webaudio/the-audio-api/the-constantsourcenode-interface/test-constantsourcenode.html b/webaudio/the-audio-api/the-constantsourcenode-interface/test-constantsourcenode.html index 1e0d7255c556be..d141580d3f53fa 100644 --- a/webaudio/the-audio-api/the-constantsourcenode-interface/test-constantsourcenode.html +++ b/webaudio/the-audio-api/the-constantsourcenode-interface/test-constantsourcenode.html @@ -26,12 +26,12 @@ csn.stop(1); }, "Start must be called before stop"); - assert_throws(new RangeError(), function() { + assert_throws_js(RangeError, function() { csn.start(-1); }, "When can not be negative"); csn.start(0); - assert_throws(new RangeError(), function() { + assert_throws_js(RangeError, function() { csn.stop(-1); }, "When can not be negative"); }, "ConstantSourceNode stop and start"); diff --git a/webgl/compressedTexImage2D.html b/webgl/compressedTexImage2D.html index b0a031add0be01..a974c65002448c 100644 --- a/webgl/compressedTexImage2D.html +++ b/webgl/compressedTexImage2D.html @@ -22,7 +22,7 @@ gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0, new Uint8Array(8), null); }); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { gl.compressedTexImage2D(gl.TEXTURE_2D, 0, COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0); }); }, "Should throw a TypeError when passing too few arguments."); diff --git a/webgl/compressedTexSubImage2D.html b/webgl/compressedTexSubImage2D.html index 539f9e17f8a811..20c5ff9bd3841c 100644 --- a/webgl/compressedTexSubImage2D.html +++ b/webgl/compressedTexSubImage2D.html @@ -22,7 +22,7 @@ gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 10, 10, COMPRESSED_RGB_S3TC_DXT1_EXT, new Uint8Array(8), null); }); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 10, 10, COMPRESSED_RGB_S3TC_DXT1_EXT); }); }, "Should throw a TypeError when passing too few arguments."); diff --git a/webgl/texImage2D.html b/webgl/texImage2D.html index 2f769160dfdeaa..86b84d1a999f16 100644 --- a/webgl/texImage2D.html +++ b/webgl/texImage2D.html @@ -10,10 +10,10 @@ <script> test(function() { var gl = getGl(); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { gl.texImage2D(0, 0, 0, 0, 0, window); }); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { gl.texImage2D(0, 0, 0, 0, 0, { get width() { throw 7 }, get height() { throw 7 }, data: new Uint8ClampedArray(10) }); }); }); diff --git a/webgl/texSubImage2D.html b/webgl/texSubImage2D.html index 294b30c7607edc..7a6c2091822a21 100644 --- a/webgl/texSubImage2D.html +++ b/webgl/texSubImage2D.html @@ -10,10 +10,10 @@ <script> test(function() { var gl = getGl(); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { gl.texSubImage2D(0, 0, 0, 0, 0, 0, window); }); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { gl.texSubImage2D(0, 0, 0, 0, 0, 0, { get width() { throw 7 }, get height() { throw 7 }, data: new Uint8ClampedArray(10) }); }); }); diff --git a/webmessaging/Channel_postMessage_ports_readonly_array.htm b/webmessaging/Channel_postMessage_ports_readonly_array.htm index 4ccf3ac4f35356..74027130377a9d 100644 --- a/webmessaging/Channel_postMessage_ports_readonly_array.htm +++ b/webmessaging/Channel_postMessage_ports_readonly_array.htm @@ -28,7 +28,7 @@ function TestMessageEvent(evt) { var channel3 = new MessageChannel(); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { evt.ports.push(channel3.port1); }, "ports is a frozen object"); assert_equals(evt.ports.length, 1, "ports is a read only array with length == 1."); diff --git a/webmessaging/MessageEvent.html b/webmessaging/MessageEvent.html index 4fb68b5999ba4f..401d941e1d6494 100644 --- a/webmessaging/MessageEvent.html +++ b/webmessaging/MessageEvent.html @@ -21,7 +21,7 @@ test(function() { var event = new MessageEvent("message"); - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { event.initMessageEvent(); }, "Not enough arguments to initMessageEvent"); }, "initMessageEvent with no arguments"); diff --git a/webmessaging/broadcastchannel/interface.html b/webmessaging/broadcastchannel/interface.html index a552563ed66b91..d82087e0eaed19 100644 --- a/webmessaging/broadcastchannel/interface.html +++ b/webmessaging/broadcastchannel/interface.html @@ -4,7 +4,7 @@ <script src="/resources/testharnessreport.js"></script> <script> -test(() => assert_throws(new TypeError(), () => new BroadcastChannel()), +test(() => assert_throws_js(TypeError, () => new BroadcastChannel()), 'Should throw if no name is provided'); test(() => { @@ -29,7 +29,7 @@ test(() => { let c = new BroadcastChannel(''); - assert_throws(new TypeError(), () => c.postMessage()); + assert_throws_js(TypeError, () => c.postMessage()); }, 'postMessage without parameters should throw'); test(() => { diff --git a/webmessaging/with-ports/025.html b/webmessaging/with-ports/025.html index 9a0e5cf6ffb729..7af2a852ed603c 100644 --- a/webmessaging/with-ports/025.html +++ b/webmessaging/with-ports/025.html @@ -5,7 +5,7 @@ <div id=log></div> <script> test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { postMessage('', '*', 1); }); }); diff --git a/webmessaging/with-ports/026.html b/webmessaging/with-ports/026.html index cf5c5e18ae5cd4..2af90e6be3afe3 100644 --- a/webmessaging/with-ports/026.html +++ b/webmessaging/with-ports/026.html @@ -5,7 +5,7 @@ <div id=log></div> <script> test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { postMessage('', '*', {length:1}); }); }); diff --git a/webmessaging/with-ports/027.html b/webmessaging/with-ports/027.html index e5f8c9c14abeaf..78ea225eb75577 100644 --- a/webmessaging/with-ports/027.html +++ b/webmessaging/with-ports/027.html @@ -18,7 +18,7 @@ channel[0] = channel.port1; channel[1] = channel.port2; channel.length = 2; - assert_throws(new TypeError(), + assert_throws_js(TypeError, () => { postMessage('', '*', channel) }, 'Old-style WebIDL arrays must throw a type error'); }, "Old-style array objects"); diff --git a/webmessaging/without-ports/009.html b/webmessaging/without-ports/009.html index 779383da203902..d613b4a0734449 100644 --- a/webmessaging/without-ports/009.html +++ b/webmessaging/without-ports/009.html @@ -5,7 +5,7 @@ <div id="log"></div> <script> test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { postMessage(); }); }); diff --git a/webmessaging/without-ports/025-1.js b/webmessaging/without-ports/025-1.js index c088fc98194722..bd1d778d9b3265 100644 --- a/webmessaging/without-ports/025-1.js +++ b/webmessaging/without-ports/025-1.js @@ -7,7 +7,7 @@ test(function() { }, "Worker MessageChannel's port should be an instance of MessagePort"); test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { new MessagePort() }, "MessagePort is [[Callable]]"); }, "Worker MessagePort should not be [[Callable]]"); diff --git a/webmessaging/without-ports/025.html b/webmessaging/without-ports/025.html index 47bec6bd842d36..4686febe94e0b2 100644 --- a/webmessaging/without-ports/025.html +++ b/webmessaging/without-ports/025.html @@ -7,7 +7,7 @@ test(function() { var ch = new MessageChannel(); assert_true(ch.port1 instanceof MessagePort, "MessageChannel's port not an instance of MessagePort"); - assert_throws(new TypeError(), function () { var p = new MessagePort();}, "MessagePort is [[Callable]]"); + assert_throws_js(TypeError, function () { var p = new MessagePort();}, "MessagePort is [[Callable]]"); }); fetch_tests_from_worker(new Worker("025-1.js")); </script> diff --git a/webrtc-extensions/RTCRtpReceiver-playoutDelayHint.html b/webrtc-extensions/RTCRtpReceiver-playoutDelayHint.html index d8e47bda22174c..29dfc19a6b6890 100644 --- a/webrtc-extensions/RTCRtpReceiver-playoutDelayHint.html +++ b/webrtc-extensions/RTCRtpReceiver-playoutDelayHint.html @@ -36,7 +36,7 @@ t.add_cleanup(() => pc.close()); const {receiver} = pc.addTransceiver('audio', {direction:'recvonly'}); receiver.playoutDelayHint = 0.7 - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { receiver.playoutDelayHint = -0.5; }, 'audio playoutDelayHint doesn\'t accept negative values'); assert_equals(receiver.playoutDelayHint, 0.7); @@ -87,7 +87,7 @@ t.add_cleanup(() => pc.close()); const {receiver} = pc.addTransceiver('video', {direction:'recvonly'}); receiver.playoutDelayHint = 0.7 - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { receiver.playoutDelayHint = -0.5; }, 'video playoutDelayHint doesn\'t accept negative values'); assert_equals(receiver.playoutDelayHint, 0.7); diff --git a/webrtc/RTCConfiguration-bundlePolicy.html b/webrtc/RTCConfiguration-bundlePolicy.html index 6b64cf8ddd53ad..83517db52a5780 100644 --- a/webrtc/RTCConfiguration-bundlePolicy.html +++ b/webrtc/RTCConfiguration-bundlePolicy.html @@ -88,12 +88,12 @@ }, `setConfiguration({ bundlePolicy: 'max-bundle' }) with initial bundlePolicy max-bundle should succeed`); test(() => { - assert_throws(new TypeError(), () => + assert_throws_js(TypeError, () => new RTCPeerConnection({ bundlePolicy: null })); }, `new RTCPeerConnection({ bundlePolicy: null }) should throw TypeError`); test(() => { - assert_throws(new TypeError(), () => + assert_throws_js(TypeError, () => new RTCPeerConnection({ bundlePolicy: 'invalid' })); }, `new RTCPeerConnection({ bundlePolicy: 'invalid' }) should throw TypeError`); diff --git a/webrtc/RTCConfiguration-iceCandidatePoolSize.html b/webrtc/RTCConfiguration-iceCandidatePoolSize.html index 2e6859d2596163..0dccf4c11d2ca7 100644 --- a/webrtc/RTCConfiguration-iceCandidatePoolSize.html +++ b/webrtc/RTCConfiguration-iceCandidatePoolSize.html @@ -47,7 +47,7 @@ }, "Initialize a new RTCPeerConnection with iceCandidatePoolSize: 255"); test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new RTCPeerConnection({ iceCandidatePoolSize: -1 }); @@ -55,7 +55,7 @@ }, "Initialize a new RTCPeerConnection with iceCandidatePoolSize: -1 (Out Of Range)"); test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new RTCPeerConnection({ iceCandidatePoolSize: 256 }); @@ -98,7 +98,7 @@ test(() => { const pc = new RTCPeerConnection(); assert_equals(typeof pc.setConfiguration, "function", "RTCPeerConnection.prototype.setConfiguration is not implemented"); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { pc.setConfiguration({ iceCandidatePoolSize: -1 }); @@ -108,7 +108,7 @@ test(() => { const pc = new RTCPeerConnection(); assert_equals(typeof pc.setConfiguration, "function", "RTCPeerConnection.prototype.setConfiguration is not implemented"); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { pc.setConfiguration({ iceCandidatePoolSize: 256 }); diff --git a/webrtc/RTCConfiguration-iceTransportPolicy.html b/webrtc/RTCConfiguration-iceTransportPolicy.html index 74e8b4b2ae7c2b..25d4511f48e32e 100644 --- a/webrtc/RTCConfiguration-iceTransportPolicy.html +++ b/webrtc/RTCConfiguration-iceTransportPolicy.html @@ -85,18 +85,18 @@ }, `setConfiguration({}) with initial iceTransportPolicy relay should set new value to all`); config_test(makePc => { - assert_throws(new TypeError(), () => + assert_throws_js(TypeError, () => makePc({ iceTransportPolicy: 'invalid' })); }, `with invalid iceTransportPolicy should throw TypeError`); // "none" is in Blink and Gecko's IDL, but not in the spec. config_test(makePc => { - assert_throws(new TypeError(), () => + assert_throws_js(TypeError, () => makePc({ iceTransportPolicy: 'none' })); }, `with none iceTransportPolicy should throw TypeError`); config_test(makePc => { - assert_throws(new TypeError(), () => + assert_throws_js(TypeError, () => makePc({ iceTransportPolicy: null })); }, `with null iceTransportPolicy should throw TypeError`); diff --git a/webrtc/RTCConfiguration-rtcpMuxPolicy.html b/webrtc/RTCConfiguration-rtcpMuxPolicy.html index 7d0c81f5eabfdd..683b202de5729b 100644 --- a/webrtc/RTCConfiguration-rtcpMuxPolicy.html +++ b/webrtc/RTCConfiguration-rtcpMuxPolicy.html @@ -71,12 +71,12 @@ }, `new RTCPeerConnection({ rtcpMuxPolicy: 'negotiate' }) may succeed or throw NotSupportedError`); config_test(makePc => { - assert_throws(new TypeError(), () => + assert_throws_js(TypeError, () => makePc({ rtcpMuxPolicy: null })); }, `with { rtcpMuxPolicy: null } should throw TypeError`); config_test(makePc => { - assert_throws(new TypeError(), () => + assert_throws_js(TypeError, () => makePc({ rtcpMuxPolicy: 'invalid' })); }, `with { rtcpMuxPolicy: 'invalid' } should throw TypeError`); diff --git a/webrtc/RTCDataChannelEvent-constructor.html b/webrtc/RTCDataChannelEvent-constructor.html index 03211eccb920e1..265943ae56350e 100644 --- a/webrtc/RTCDataChannelEvent-constructor.html +++ b/webrtc/RTCDataChannelEvent-constructor.html @@ -9,22 +9,22 @@ test(function() { assert_equals(RTCDataChannelEvent.length, 2); - assert_throws( - new TypeError(), + assert_throws_js( + TypeError, function() { new RTCDataChannelEvent('type'); } ); }, 'RTCDataChannelEvent constructor without a required argument.'); test(function() { - assert_throws( - new TypeError(), + assert_throws_js( + TypeError, function() { new RTCDataChannelEvent('type', { channel: null }); } ); }, 'RTCDataChannelEvent constructor with channel passed as null.'); test(function() { - assert_throws( - new TypeError(), + assert_throws_js( + TypeError, function() { new RTCDataChannelEvent('type', { channel: undefined }); } ); }, 'RTCDataChannelEvent constructor with a channel passed as undefined.'); diff --git a/webrtc/RTCError.html b/webrtc/RTCError.html index 9c7227521edeb8..bcc5749bf7d5e6 100644 --- a/webrtc/RTCError.html +++ b/webrtc/RTCError.html @@ -19,16 +19,16 @@ }, 'RTCError constructor\'s message argument is optional'); test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new RTCError(); }); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new RTCError({}); // {errorDetail} is missing. }); }, 'RTCError constructor throws TypeError if arguments are missing'); test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new RTCError({errorDetail:'invalid-error-detail'}, 'message'); }); }, 'RTCError constructor throws TypeError if the errorDetail is invalid'); @@ -45,7 +45,7 @@ test(() => { const error = new RTCError({errorDetail:'data-channel-failure'}, 'message'); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { error.errorDetail = 'dtls-failure'; }); }, 'RTCError.errorDetail is readonly.'); @@ -53,7 +53,7 @@ test(() => { // Infers what are valid RTCErrorInit objects by passing them to the RTCError // constructor. - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new RTCError({}, 'message'); }); new RTCError({errorDetail:'data-channel-failure'}, 'message'); @@ -80,7 +80,7 @@ test(() => { const error = new RTCError({errorDetail:'data-channel-failure'}, 'message'); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { error[attribute] = 42; }); }, 'RTCError.' + attribute + ' is readonly'); diff --git a/webrtc/RTCIceCandidate-constructor.html b/webrtc/RTCIceCandidate-constructor.html index 344007ded2b4d4..6c208e887f473a 100644 --- a/webrtc/RTCIceCandidate-constructor.html +++ b/webrtc/RTCIceCandidate-constructor.html @@ -15,7 +15,7 @@ // Note that current browsers pass this test but may throw TypeError for // different reason, i.e. they don't accept empty argument. // Further tests below are used to differentiate the errors. - assert_throws(new TypeError(), () => new RTCIceCandidate()); + assert_throws_js(TypeError, () => new RTCIceCandidate()); }, 'new RTCIceCandidate()'); test(t => { @@ -24,13 +24,13 @@ // Note that current browsers pass this test but may throw TypeError for // different reason, i.e. they don't allow undefined candidate string. // Further tests below are used to differentiate the errors. - assert_throws(new TypeError(), () => new RTCIceCandidate({})); + assert_throws_js(TypeError, () => new RTCIceCandidate({})); }, 'new RTCIceCandidate({})'); test(t => { // Checks that manually filling the default values for RTCIceCandidateInit // still throws because both sdpMid and sdpMLineIndex are null - assert_throws(new TypeError(), + assert_throws_js(TypeError, () => new RTCIceCandidate({ candidate: '', sdpMid: null, @@ -41,7 +41,7 @@ test(t => { // Checks that explicitly setting both sdpMid and sdpMLineIndex null should throw - assert_throws(new TypeError(), + assert_throws_js(TypeError, () => new RTCIceCandidate({ sdpMid: null, sdpMLineIndex: null @@ -50,7 +50,7 @@ test(t => { // Throws because both sdpMid and sdpMLineIndex are null by default - assert_throws(new TypeError(), + assert_throws_js(TypeError, () => new RTCIceCandidate({ candidate: '' })); @@ -58,7 +58,7 @@ test(t => { // Throws because the candidate field is not nullable - assert_throws(new TypeError(), + assert_throws_js(TypeError, () => new RTCIceCandidate({ candidate: null })); @@ -66,7 +66,7 @@ test(t => { // Throws because both sdpMid and sdpMLineIndex are null by default - assert_throws(new TypeError(), + assert_throws_js(TypeError, () => new RTCIceCandidate({ candidate: candidateString })); diff --git a/webrtc/RTCIceTransport-extension.https.html b/webrtc/RTCIceTransport-extension.https.html index 94beb9927861e8..13f217346e2f2d 100644 --- a/webrtc/RTCIceTransport-extension.https.html +++ b/webrtc/RTCIceTransport-extension.https.html @@ -39,7 +39,7 @@ test(t => { const iceTransport = makeIceTransport(t); - assert_throws(new TypeError(), () => + assert_throws_js(TypeError, () => iceTransport.gather({ iceServers: null })); }, 'gather() with { iceServers: null } should throw TypeError'); @@ -140,10 +140,10 @@ test(() => { const iceTransport = new RTCIceTransport(); - assert_throws(new TypeError(), () => iceTransport.start({})); - assert_throws(new TypeError(), + assert_throws_js(TypeError, () => iceTransport.start({})); + assert_throws_js(TypeError, () => iceTransport.start({ usernameFragment: 'dummy' })); - assert_throws(new TypeError(), + assert_throws_js(TypeError, () => iceTransport.start({ password: 'dummy' })); assert_equals(iceTransport.getRemoteParameters(), null); }, 'start() throws if usernameFragment or password not set'); diff --git a/webrtc/RTCPeerConnection-addTransceiver.https.html b/webrtc/RTCPeerConnection-addTransceiver.https.html index 3640bfb31cd32b..bc537c26867fe6 100644 --- a/webrtc/RTCPeerConnection-addTransceiver.https.html +++ b/webrtc/RTCPeerConnection-addTransceiver.https.html @@ -80,7 +80,7 @@ t.add_cleanup(() => pc.close()); assert_idl_attribute(pc, 'addTransceiver'); - assert_throws(new TypeError(), () => pc.addTransceiver('invalid')); + assert_throws_js(TypeError, () => pc.addTransceiver('invalid')); }, 'addTransceiver() with string argument as invalid kind should throw TypeError'); /* @@ -232,7 +232,7 @@ t.add_cleanup(() => pc.close()); assert_idl_attribute(pc, 'addTransceiver'); - assert_throws(new TypeError(), () => + assert_throws_js(TypeError, () => pc.addTransceiver('audio', { direction: 'invalid' })); }, `addTransceiver() with invalid direction should throw TypeError`); @@ -324,7 +324,7 @@ t.add_cleanup(() => pc.close()); assert_idl_attribute(pc, 'addTransceiver'); - assert_throws(new TypeError(), () => + assert_throws_js(TypeError, () => pc.addTransceiver('audio', { sendEncodings: [{ rid: '@Invalid!' @@ -337,7 +337,7 @@ t.add_cleanup(() => pc.close()); assert_idl_attribute(pc, 'addTransceiver'); - assert_throws(new TypeError(), () => + assert_throws_js(TypeError, () => pc.addTransceiver('audio', { sendEncodings: [{ rid: 'a'.repeat(17) diff --git a/webrtc/RTCPeerConnection-setRemoteDescription.html b/webrtc/RTCPeerConnection-setRemoteDescription.html index 464e16d736a020..efa79d4eec5bc7 100644 --- a/webrtc/RTCPeerConnection-setRemoteDescription.html +++ b/webrtc/RTCPeerConnection-setRemoteDescription.html @@ -54,7 +54,7 @@ await pc.setRemoteDescription({ type: 'bogus', sdp: 'bogus' }); t.unreached_func("Should have rejected."); } catch (e) { - assert_throws(new TypeError(), () => { throw e }); + assert_throws_js(TypeError, () => { throw e }); } }, 'setRemoteDescription with invalid type and invalid SDP should reject with TypeError'); diff --git a/webrtc/RTCPeerConnectionIceEvent-constructor.html b/webrtc/RTCPeerConnectionIceEvent-constructor.html index 7de7fcaeb10ef2..447002dca1fa35 100644 --- a/webrtc/RTCPeerConnectionIceEvent-constructor.html +++ b/webrtc/RTCPeerConnectionIceEvent-constructor.html @@ -20,7 +20,7 @@ }; */ test(() => { - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { new RTCPeerConnectionIceEvent(); }); }, "RTCPeerConnectionIceEvent with no arguments throws TypeError"); @@ -109,7 +109,7 @@ test(() => { const plain = { candidate, sdpMid, sdpMLineIndex, usernameFragment }; - assert_throws(new TypeError(), () => new RTCPeerConnectionIceEvent("type", { candidate: plain })); + assert_throws_js(TypeError, () => new RTCPeerConnectionIceEvent("type", { candidate: plain })); }, "RTCPeerConnectionIceEvent with non RTCIceCandidate object throws"); test(() => { diff --git a/webrtc/RTCTrackEvent-constructor.html b/webrtc/RTCTrackEvent-constructor.html index a0c031eaa5a257..c9105e693af666 100644 --- a/webrtc/RTCTrackEvent-constructor.html +++ b/webrtc/RTCTrackEvent-constructor.html @@ -117,7 +117,7 @@ const { receiver } = transceiver; const { track } = receiver; - assert_throws(new TypeError(), () => + assert_throws_js(TypeError, () => new RTCTrackEvent('track', { receiver, track })); @@ -129,7 +129,7 @@ const transceiver = pc.addTransceiver('audio'); const { receiver } = transceiver; - assert_throws(new TypeError(), () => + assert_throws_js(TypeError, () => new RTCTrackEvent('track', { receiver, transceiver })); @@ -142,7 +142,7 @@ const { receiver } = transceiver; const { track } = receiver; - assert_throws(new TypeError(), () => + assert_throws_js(TypeError, () => new RTCTrackEvent('track', { track, transceiver })); diff --git a/websockets/constructor/001.html b/websockets/constructor/001.html index 2a868bfa0d37a3..b82d941c7787d0 100644 --- a/websockets/constructor/001.html +++ b/websockets/constructor/001.html @@ -8,6 +8,6 @@ <div id=log></div> <script> test(function() { - assert_throws(new TypeError(), function(){new WebSocket()}); + assert_throws_js(TypeError, function(){new WebSocket()}); }); </script> diff --git a/websockets/interfaces/WebSocket/constants/005.html b/websockets/interfaces/WebSocket/constants/005.html index b3c2e932e6d08c..8f17deb3785fc0 100644 --- a/websockets/interfaces/WebSocket/constants/005.html +++ b/websockets/interfaces/WebSocket/constants/005.html @@ -10,7 +10,7 @@ var constants = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED']; for (var i = 0; i < constants.length; ++i) { test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { Object.defineProperty(WebSocket.prototype, constants[i], { get: function() { return 'foo'; } }); diff --git a/websockets/interfaces/WebSocket/constants/006.html b/websockets/interfaces/WebSocket/constants/006.html index 70219345647781..0396687736a25e 100644 --- a/websockets/interfaces/WebSocket/constants/006.html +++ b/websockets/interfaces/WebSocket/constants/006.html @@ -10,7 +10,7 @@ var constants = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED']; for (var i = 0; i < constants.length; ++i) { test(function() { - assert_throws(new TypeError(), function(){ + assert_throws_js(TypeError, function(){ Object.defineProperty(WebSocket.prototype, constants[i], { set: function() { return 'foo'; } }); diff --git a/websockets/interfaces/WebSocket/send/001.html b/websockets/interfaces/WebSocket/send/001.html index 3a22420ad6cb27..829a4ed7610f8d 100644 --- a/websockets/interfaces/WebSocket/send/001.html +++ b/websockets/interfaces/WebSocket/send/001.html @@ -9,7 +9,7 @@ <script> test(function(t) { var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/'); - assert_throws(new TypeError(), function(){ws.send()}); + assert_throws_js(TypeError, function(){ws.send()}); }); </script> diff --git a/websockets/stream-tentative/close.any.js b/websockets/stream-tentative/close.any.js index ddcdc2b2c8f626..f580dc934ef730 100644 --- a/websockets/stream-tentative/close.any.js +++ b/websockets/stream-tentative/close.any.js @@ -50,7 +50,7 @@ promise_test(async () => { promise_test(async () => { const wss = new WebSocketStream(ECHOURL); await wss.connection; - assert_throws(new TypeError(), () => wss.close(true), + assert_throws_js(TypeError, () => wss.close(true), 'close should throw a TypeError'); }, 'close(true) should throw a TypeError'); diff --git a/webstorage/missing_arguments.html b/webstorage/missing_arguments.html index 38c52cf62754d5..1c8a1a44815818 100644 --- a/webstorage/missing_arguments.html +++ b/webstorage/missing_arguments.html @@ -21,7 +21,7 @@ ]; tests.forEach(function(fun) { test(function() { - assert_throws(new TypeError(), fun); + assert_throws_js(TypeError, fun); }, "Should throw TypeError for " + format_value(fun) + "."); }); </script> diff --git a/webxr/xrDevice_requestSession_no_mode.https.html b/webxr/xrDevice_requestSession_no_mode.https.html index 5ef249c5818613..9c1ebb7efd7bfc 100644 --- a/webxr/xrDevice_requestSession_no_mode.https.html +++ b/webxr/xrDevice_requestSession_no_mode.https.html @@ -12,7 +12,7 @@ .then( (controller) => new Promise((resolve) => { navigator.xr.test.simulateUserActivation( () => { t.step_func(() => { - assert_throws(new TypeError(), () => navigator.xr.requestSession()) + assert_throws_js(TypeError, () => navigator.xr.requestSession()) }) resolve() }); diff --git a/webxr/xrRigidTransform_constructor.https.html b/webxr/xrRigidTransform_constructor.https.html index 15a7f2b5771a78..6608b3f36f568e 100644 --- a/webxr/xrRigidTransform_constructor.https.html +++ b/webxr/xrRigidTransform_constructor.https.html @@ -96,7 +96,7 @@ coordDict([1.1, 2.1, 3.1, 1.0])); checkTransform(transform, "Created with dict"); - assert_throws(new TypeError(), () => new XRRigidTransform( + assert_throws_js(TypeError, () => new XRRigidTransform( coordDict([1.0, 2.0, 3.0, 0.5]), coordDict([1.1, 2.1, 3.1, 1.0]) ), "Constructor should throw TypeError for non-1 position w values"); diff --git a/workers/SharedWorker-constructor.html b/workers/SharedWorker-constructor.html index 2bfe7d9b87adfe..5347891d41855a 100644 --- a/workers/SharedWorker-constructor.html +++ b/workers/SharedWorker-constructor.html @@ -5,14 +5,14 @@ <script> test(() => { - assert_throws(new Error(), + assert_throws_js(Error, function() { new SharedWorker({toString:function(){throw new Error()}}, "name") }, "toString exception not propagagted"); }, "Test toString exception propagated correctly."); test(() => { - assert_throws(new RangeError(), + assert_throws_js(RangeError, function() { var foo = {toString:function(){new Worker(foo)}} new SharedWorker(foo, name); }, @@ -20,7 +20,7 @@ }, "Test recursive worker creation results in exception."); test(() => { - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { new SharedWorker(); }, "Invoking SharedWorker constructor without arguments did not result in an exception."); }, "Test SharedWorker creation without arguments results in exception."); diff --git a/workers/Worker-multi-port.html b/workers/Worker-multi-port.html index 138f8f02d4e722..a622dc9800f14e 100644 --- a/workers/Worker-multi-port.html +++ b/workers/Worker-multi-port.html @@ -38,7 +38,7 @@ test(() => { var worker = new Worker("support/Worker-thread-multi-port.js"); - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { worker.postMessage(); }, 'Empty postMessage should throw exception.'); }, 'Test empty postMessage throws exception.'); @@ -46,7 +46,7 @@ test(() => { var worker = new Worker("support/Worker-thread-multi-port.js"); var channel = new MessageChannel(); - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { worker.postMessage("null port", [channel.port1, null, channel.port2]); }, diff --git a/workers/constructors/SharedWorker/no-arguments-ctor.html b/workers/constructors/SharedWorker/no-arguments-ctor.html index eaee870db0e14c..c189e556019d8d 100644 --- a/workers/constructors/SharedWorker/no-arguments-ctor.html +++ b/workers/constructors/SharedWorker/no-arguments-ctor.html @@ -10,7 +10,7 @@ <div id="log"></div> <script> test(function() { - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { var worker = new SharedWorker(); }); }); diff --git a/workers/constructors/Worker/Worker-constructor.html b/workers/constructors/Worker/Worker-constructor.html index e073df76f36f01..524a0982a9e532 100644 --- a/workers/constructors/Worker/Worker-constructor.html +++ b/workers/constructors/Worker/Worker-constructor.html @@ -5,7 +5,7 @@ <script> test(() => { - assert_throws(new Error(), + assert_throws_js(Error, function() { new Worker({toString:function(){throw new Error()}})}, 'toString exception should be propagated'); @@ -22,7 +22,7 @@ }, 'Test recursive Worker creation.'); test(() => { - assert_throws(new TypeError(), + assert_throws_js(TypeError, function() { new Worker(); }, 'invoking Worker constructor without arguments should result' + 'in an exception.') @@ -37,7 +37,7 @@ }, 'Test Worker creation with empty script URL.'); test(() => { - assert_throws(new SyntaxError(), + assert_throws_dom("SyntaxError", function() { var worker = new Worker('http://invalid:123$'); }, 'Invoking Worker constructor with invalid script URL should' + 'result in an exception.'); diff --git a/workers/postMessage_ports_readonly_array.htm b/workers/postMessage_ports_readonly_array.htm index 0645ea7ef5f892..bd833ede9361de 100644 --- a/workers/postMessage_ports_readonly_array.htm +++ b/workers/postMessage_ports_readonly_array.htm @@ -11,7 +11,7 @@ targetPort.start(); targetPort.addEventListener("message", t.step_func_done(function(e) { var channel3 = new MessageChannel(); - assert_throws(new TypeError(), () => { + assert_throws_js(TypeError, () => { e.ports.push(channel3.port1); }, "ports is a frozen object"); assert_equals(e.ports.length, 1, "ports is a read only array with length == 1."); diff --git a/xhr/FormData-append.html b/xhr/FormData-append.html index a10244fa23d475..c64b93cbc7ef82 100644 --- a/xhr/FormData-append.html +++ b/xhr/FormData-append.html @@ -81,11 +81,11 @@ }, 'testFormDataAppendToFormNull2'); test(function() { var fd = new FormData(document.getElementById("form")); - assert_throws(new TypeError(), () => {fd.append('name', "string", 'filename')}); + assert_throws_js(TypeError, () => {fd.append('name', "string", 'filename')}); }, 'testFormDataAppendToFormString'); test(function() { var fd = new FormData(document.getElementById("form")); - assert_throws(new TypeError(), () => {fd.append('name', new URLSearchParams(), 'filename')}); + assert_throws_js(TypeError, () => {fd.append('name', new URLSearchParams(), 'filename')}); }, 'testFormDataAppendToFormWrongPlatformObject'); test(function() { var before = new Date(new Date().getTime() - 2000); // two seconds ago, in case there's clock drift diff --git a/xhr/formdata-blob.htm b/xhr/formdata-blob.htm index 5efef7b615bbfa..92cee55cd2f80f 100644 --- a/xhr/formdata-blob.htm +++ b/xhr/formdata-blob.htm @@ -38,7 +38,7 @@ // If 3rd argument is given and 2nd is not a Blob, formdata.append() should throw var test = async_test('formdata.append() should throw if value is string and file name is given'); // needs to be async just because the others above are test.step(function(){ - assert_throws(new TypeError(), function(){ + assert_throws_js(TypeError, function(){ create_formdata('a', 'b', 'c'); }); }); diff --git a/xhr/formdata-set.htm b/xhr/formdata-set.htm index ee43e1569f1958..d46e44a916fd20 100644 --- a/xhr/formdata-set.htm +++ b/xhr/formdata-set.htm @@ -81,11 +81,11 @@ }, 'testFormDataSetToFormNull2'); test(function() { var fd = new FormData(document.getElementById("form")); - assert_throws(new TypeError(), () => {fd.set('name', "string", 'filename')}); + assert_throws_js(TypeError, () => {fd.set('name', "string", 'filename')}); }, 'testFormDataSetToFormString'); test(function() { var fd = new FormData(document.getElementById("form")); - assert_throws(new TypeError(), () => {fd.set('name', new URLSearchParams(), 'filename')}); + assert_throws_js(TypeError, () => {fd.set('name', new URLSearchParams(), 'filename')}); }, 'testFormDataSetToFormWrongPlatformObject'); test(function() { var fd = new FormData(); diff --git a/xhr/formdata.htm b/xhr/formdata.htm index 699c11ab7838a3..861226603881bb 100644 --- a/xhr/formdata.htm +++ b/xhr/formdata.htm @@ -39,8 +39,8 @@ } test(() => { - assert_throws(new TypeError(), () => { new FormData(null); }); - assert_throws(new TypeError(), () => { new FormData("string"); }); + assert_throws_js(TypeError, () => { new FormData(null); }); + assert_throws_js(TypeError, () => { new FormData("string"); }); }, "Constructors should throw a type error"); do_test("empty formdata", new FormData(), '\n'); diff --git a/xhr/progressevent-interface.html b/xhr/progressevent-interface.html index 850d1b23dcfa26..7552ff73d3f449 100644 --- a/xhr/progressevent-interface.html +++ b/xhr/progressevent-interface.html @@ -14,7 +14,7 @@ assert_equals(desc.writable, false) assert_equals(desc.enumerable, false) assert_equals(desc.configurable, false) - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { "use strict"; delete ProgressEvent.prototype; }) @@ -31,7 +31,7 @@ var desc = Object.getOwnPropertyDescriptor(ProgressEvent.prototype, a[1]) assert_equals(desc.enumerable, true) assert_equals(desc.configurable, true) - assert_throws(new TypeError(), function() { + assert_throws_js(TypeError, function() { ProgressEvent.prototype[a[1]] }) }) diff --git a/xhr/send-data-readablestream.any.js b/xhr/send-data-readablestream.any.js index cca6e76a042cc8..c53b1071828f95 100644 --- a/xhr/send-data-readablestream.any.js +++ b/xhr/send-data-readablestream.any.js @@ -3,7 +3,7 @@ function assert_xhr(stream) { const client = new XMLHttpRequest(); client.open("POST", "..."); - assert_throws(new TypeError(), () => client.send(stream)); + assert_throws_js(TypeError, () => client.send(stream)); } test(() => { diff --git a/xhr/setrequestheader-bogus-name.htm b/xhr/setrequestheader-bogus-name.htm index 86e55f33a00649..c7970bd2cb331d 100644 --- a/xhr/setrequestheader-bogus-name.htm +++ b/xhr/setrequestheader-bogus-name.htm @@ -34,7 +34,7 @@ test(function() { var client = new XMLHttpRequest() client.open("GET", "...") - assert_throws(new TypeError(), function() { client.setRequestHeader(name, 'x-value') }) + assert_throws_js(TypeError, function() { client.setRequestHeader(name, 'x-value') }) }, "setRequestHeader should throw with header name " + format_value(invalid_byte_strings[i]) + ".") } var invalid_headers = ["(", ")", "<", ">", "@", ",", ";", ":", "\\", diff --git a/xhr/setrequestheader-bogus-value.htm b/xhr/setrequestheader-bogus-value.htm index 15fbb39052526d..72d85e677f3f27 100644 --- a/xhr/setrequestheader-bogus-value.htm +++ b/xhr/setrequestheader-bogus-value.htm @@ -23,13 +23,13 @@ test(function() { var client = new XMLHttpRequest(); client.open("GET", "..."); - assert_throws(new TypeError(), function() { client.setRequestHeader("x-test", "テスト") }, ' given value テスト,'); + assert_throws_js(TypeError, function() { client.setRequestHeader("x-test", "テスト") }, ' given value テスト,'); }); test(function() { var client = new XMLHttpRequest() client.open("GET", "...") - assert_throws(new TypeError(), function() { client.setRequestHeader("x-test") }) + assert_throws_js(TypeError, function() { client.setRequestHeader("x-test") }) }, 'Omitted value argument') </script> </body>