Commit 04fc7b0e authored by arv@chromium.org's avatar arv@chromium.org

Replace DOMException TYPE_MISMATCH_ERR with TypeError

https://bugs.webkit.org/show_bug.cgi?id=101604

Reviewed by Adam Barth.

Source/WebCore:

DOMException.TYPE_MISMATCH_ERR is deprecated in favor of using TypeError.

We have historically used TYPE_MISMATCH_ERR as a blanket DOMException code when
the spec mandates TypeError being thrown.

Updated existing tests.

* Modules/mediastream/MediaConstraintsImpl.cpp:
* Modules/mediastream/MediaStreamTrackList.cpp:
* Modules/mediastream/PeerConnection00.cpp:
* Modules/mediastream/RTCDataChannel.cpp:
* Modules/mediastream/RTCIceCandidate.cpp:
* Modules/mediastream/RTCPeerConnection.cpp:
* Modules/mediastream/RTCSessionDescription.cpp:
* Modules/mediastream/SessionDescription.cpp:
* bindings/js/CallbackFunction.cpp:
* bindings/js/JSCustomXPathNSResolver.cpp:
* bindings/js/JSHTMLOptionsCollectionCustom.cpp:
* bindings/js/JSHTMLSelectElementCustom.cpp:
* bindings/js/JSMutationObserverCustom.cpp:
* bindings/js/JSSQLResultSetRowListCustom.cpp:
* bindings/js/JSSQLTransactionCustom.cpp:
* bindings/js/JSSQLTransactionSyncCustom.cpp:
* bindings/scripts/CodeGeneratorJS.pm:
* bindings/scripts/CodeGeneratorObjC.pm:
* bindings/scripts/CodeGeneratorV8.pm:
* bindings/v8/V8Callback.h:
* bindings/v8/V8Collection.cpp:
* bindings/v8/custom/V8DocumentCustom.cpp:
* bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
* bindings/v8/custom/V8MutationObserverCustom.cpp:
* bindings/v8/custom/V8SQLTransactionCustom.cpp:
* bindings/v8/custom/V8SQLTransactionSyncCustom.cpp:
* dom/DOMCoreException.idl:
* html/HTMLElement.cpp:
* html/HTMLMediaElement.cpp:
* html/HTMLOptionsCollection.cpp:
* html/canvas/CanvasRenderingContext2D.cpp:
* page/Crypto.cpp:
* page/DOMSelection.cpp:
* svg/properties/SVGTransformListPropertyTearOff.h:

LayoutTests:

Update the tests to test for TypeError instead of DOMException with the TYPE_MISMATCH_ERR code.

* canvas/philip/tests/2d.drawImage.null.html:
* canvas/philip/tests/2d.imageData.put.null.html:
* canvas/philip/tests/2d.pattern.image.null.html:
* editing/selection/extend-expected.txt:
* fast/dom/Geolocation/argument-types-expected.txt:
* fast/dom/Geolocation/not-enough-arguments-expected.txt:
* fast/dom/Geolocation/script-tests/argument-types.js:
* fast/dom/HTMLSelectElement/select-selectedIndex-expected.txt:
* fast/dom/HTMLSelectElement/select-selectedIndex-multiple-expected.txt:
* fast/js/select-options-add-expected.txt:
* fast/mediastream/RTCIceCandidate-expected.txt:
* fast/mediastream/RTCPeerConnection-expected.txt:
* fast/mediastream/RTCSessionDescription-expected.txt:
* fast/mediastream/SessionDescription-expected.txt:
* fast/mediastream/peerconnection-addstream-expected.txt:
* fast/mediastream/peerconnection-iceoptions-expected.txt:
* fast/mediastream/peerconnection-iceoptions.html:
* fast/mediastream/peerconnection-removestream-expected.txt:
* media/encrypted-media/encrypted-media-syntax.html:
* media/video-test.js:
* platform/chromium/fast/dynamic/insertAdjacentElement-expected.txt:
* security/crypto-random-values-types-expected.txt:
* svg/dom/SVGTransformList-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@134345 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d4a2bf71
2012-11-12 Erik Arvidsson <arv@chromium.org>
Replace DOMException TYPE_MISMATCH_ERR with TypeError
https://bugs.webkit.org/show_bug.cgi?id=101604
Reviewed by Adam Barth.
Update the tests to test for TypeError instead of DOMException with the TYPE_MISMATCH_ERR code.
* canvas/philip/tests/2d.drawImage.null.html:
* canvas/philip/tests/2d.imageData.put.null.html:
* canvas/philip/tests/2d.pattern.image.null.html:
* editing/selection/extend-expected.txt:
* fast/dom/Geolocation/argument-types-expected.txt:
* fast/dom/Geolocation/not-enough-arguments-expected.txt:
* fast/dom/Geolocation/script-tests/argument-types.js:
* fast/dom/HTMLSelectElement/select-selectedIndex-expected.txt:
* fast/dom/HTMLSelectElement/select-selectedIndex-multiple-expected.txt:
* fast/js/select-options-add-expected.txt:
* fast/mediastream/RTCIceCandidate-expected.txt:
* fast/mediastream/RTCPeerConnection-expected.txt:
* fast/mediastream/RTCSessionDescription-expected.txt:
* fast/mediastream/SessionDescription-expected.txt:
* fast/mediastream/peerconnection-addstream-expected.txt:
* fast/mediastream/peerconnection-iceoptions-expected.txt:
* fast/mediastream/peerconnection-iceoptions.html:
* fast/mediastream/peerconnection-removestream-expected.txt:
* media/encrypted-media/encrypted-media-syntax.html:
* media/video-test.js:
* platform/chromium/fast/dynamic/insertAdjacentElement-expected.txt:
* security/crypto-random-values-types-expected.txt:
* svg/dom/SVGTransformList-expected.txt:
2012-11-12 Joshua Bell <jsbell@chromium.org> 2012-11-12 Joshua Bell <jsbell@chromium.org>
IndexedDB: storage/indexeddb/cursor-prev-no-duplicate.html is flaky IndexedDB: storage/indexeddb/cursor-prev-no-duplicate.html is flaky
...@@ -14,7 +14,7 @@ _addTest(function(canvas, ctx) { ...@@ -14,7 +14,7 @@ _addTest(function(canvas, ctx) {
try { var _thrown = false; try { var _thrown = false;
ctx.drawImage(null, 0, 0); ctx.drawImage(null, 0, 0);
} catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) _fail("Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type TYPE_MISMATCH_ERR: ctx.drawImage(null, 0, 0)"); } } catch (e) { if (e.name != "TypeError") _fail("Failed assertion: expected exception of type TypeError, got: "+e.name); _thrown = true; } finally { _assert(_thrown, "should throw exception of type TypeError: ctx.drawImage(null, 0, 0)"); }
}); });
......
...@@ -14,7 +14,7 @@ _addTest(function(canvas, ctx) { ...@@ -14,7 +14,7 @@ _addTest(function(canvas, ctx) {
try { var _thrown = false; try { var _thrown = false;
ctx.putImageData(null, 0, 0); ctx.putImageData(null, 0, 0);
} catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) _fail("Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type TYPE_MISMATCH_ERR: ctx.putImageData(null, 0, 0)"); } } catch (e) { if (e.name != "TypeError") _fail("Failed assertion: expected exception of type TypeError, got: "+e.name); _thrown = true; } finally { _assert(_thrown, "should throw exception of type TypeError: ctx.putImageData(null, 0, 0)"); }
}); });
......
...@@ -14,7 +14,7 @@ _addTest(function(canvas, ctx) { ...@@ -14,7 +14,7 @@ _addTest(function(canvas, ctx) {
try { var _thrown = false; try { var _thrown = false;
ctx.createPattern(null, 'repeat'); ctx.createPattern(null, 'repeat');
} catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) _fail("Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); _thrown = true; } finally { _assert(_thrown, "should throw exception of type TYPE_MISMATCH_ERR: ctx.createPattern(null, 'repeat')"); } } catch (e) { if (e.name != "TypeError") _fail("Failed assertion: expected exception of type TypeError, got: "+e.name); _thrown = true; } finally { _assert(_thrown, "should throw exception of type TypeError: ctx.createPattern(null, 'repeat')"); }
}); });
......
...@@ -4,5 +4,5 @@ Success: s.extend(span2.firstChild, 4) raised Error: INDEX_SIZE_ERR: DOM Excepti ...@@ -4,5 +4,5 @@ Success: s.extend(span2.firstChild, 4) raised Error: INDEX_SIZE_ERR: DOM Excepti
Success: s.extend(span2.firstChild, -1) raised Error: INDEX_SIZE_ERR: DOM Exception 1. Success: s.extend(span2.firstChild, -1) raised Error: INDEX_SIZE_ERR: DOM Exception 1.
Success: window.getSelection() is b. Success: window.getSelection() is b.
Success: window.getSelection() is arbaz. Success: window.getSelection() is arbaz.
Success: s.extend() raised Error: TYPE_MISMATCH_ERR: DOM Exception 17. Success: s.extend() raised TypeError: Type error.
Success: s.extend(null, 0) raised Error: TYPE_MISMATCH_ERR: DOM Exception 17. Success: s.extend(null, 0) raised TypeError: Type error.
...@@ -3,31 +3,31 @@ Tests the acceptable types for arguments to Geolocation methods. ...@@ -3,31 +3,31 @@ Tests the acceptable types for arguments to Geolocation methods.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS navigator.geolocation.getCurrentPosition() threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition() threw exception TypeError: Type error.
PASS navigator.geolocation.getCurrentPosition(undefined) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(undefined) threw exception TypeError: Type error.
PASS navigator.geolocation.getCurrentPosition(null) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(null) threw exception TypeError: Type error.
PASS navigator.geolocation.getCurrentPosition({}) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition({}) threw exception TypeError: Type error.
PASS navigator.geolocation.getCurrentPosition(objectThrowingException) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(objectThrowingException) threw exception TypeError: Type error.
PASS navigator.geolocation.getCurrentPosition(emptyFunction) did not throw exception. PASS navigator.geolocation.getCurrentPosition(emptyFunction) did not throw exception.
PASS navigator.geolocation.getCurrentPosition(Math.abs) did not throw exception. PASS navigator.geolocation.getCurrentPosition(Math.abs) did not throw exception.
PASS navigator.geolocation.getCurrentPosition(testRunner.setGeolocationPermission) did not throw exception. PASS navigator.geolocation.getCurrentPosition(testRunner.setGeolocationPermission) did not throw exception.
PASS navigator.geolocation.getCurrentPosition(true) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(true) threw exception TypeError: Type error.
PASS navigator.geolocation.getCurrentPosition(42) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(42) threw exception TypeError: Type error.
PASS navigator.geolocation.getCurrentPosition(Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(Infinity) threw exception TypeError: Type error.
PASS navigator.geolocation.getCurrentPosition(-Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(-Infinity) threw exception TypeError: Type error.
PASS navigator.geolocation.getCurrentPosition("string") threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition("string") threw exception TypeError: Type error.
PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined) did not throw exception. PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined) did not throw exception.
PASS navigator.geolocation.getCurrentPosition(emptyFunction, null) did not throw exception. PASS navigator.geolocation.getCurrentPosition(emptyFunction, null) did not throw exception.
PASS navigator.geolocation.getCurrentPosition(emptyFunction, {}) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(emptyFunction, {}) threw exception TypeError: Type error.
PASS navigator.geolocation.getCurrentPosition(emptyFunction, objectThrowingException) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(emptyFunction, objectThrowingException) threw exception TypeError: Type error.
PASS navigator.geolocation.getCurrentPosition(emptyFunction, emptyFunction) did not throw exception. PASS navigator.geolocation.getCurrentPosition(emptyFunction, emptyFunction) did not throw exception.
PASS navigator.geolocation.getCurrentPosition(emptyFunction, Math.abs) did not throw exception. PASS navigator.geolocation.getCurrentPosition(emptyFunction, Math.abs) did not throw exception.
PASS navigator.geolocation.getCurrentPosition(emptyFunction, testRunner.setGeolocationPermission) did not throw exception. PASS navigator.geolocation.getCurrentPosition(emptyFunction, testRunner.setGeolocationPermission) did not throw exception.
PASS navigator.geolocation.getCurrentPosition(emptyFunction, true) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(emptyFunction, true) threw exception TypeError: Type error.
PASS navigator.geolocation.getCurrentPosition(emptyFunction, 42) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(emptyFunction, 42) threw exception TypeError: Type error.
PASS navigator.geolocation.getCurrentPosition(emptyFunction, Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(emptyFunction, Infinity) threw exception TypeError: Type error.
PASS navigator.geolocation.getCurrentPosition(emptyFunction, -Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(emptyFunction, -Infinity) threw exception TypeError: Type error.
PASS navigator.geolocation.getCurrentPosition(emptyFunction, "string") threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS navigator.geolocation.getCurrentPosition(emptyFunction, "string") threw exception TypeError: Type error.
PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, undefined) did not throw exception. PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, undefined) did not throw exception.
PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, null) did not throw exception. PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, null) did not throw exception.
PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {}) did not throw exception. PASS navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {}) did not throw exception.
......
...@@ -3,8 +3,8 @@ Tests how Geolocation handles receiving too few arguments. ...@@ -3,8 +3,8 @@ Tests how Geolocation handles receiving too few arguments.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS window.navigator.geolocation.getCurrentPosition() threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS window.navigator.geolocation.getCurrentPosition() threw exception TypeError: Type error.
PASS window.navigator.geolocation.watchPosition() threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS window.navigator.geolocation.watchPosition() threw exception TypeError: Type error.
PASS window.navigator.geolocation.clearWatch() threw exception TypeError: Not enough arguments. PASS window.navigator.geolocation.clearWatch() threw exception TypeError: Not enough arguments.
PASS successfullyParsed is true PASS successfullyParsed is true
......
...@@ -13,9 +13,9 @@ function shouldNotThrow(expression) ...@@ -13,9 +13,9 @@ function shouldNotThrow(expression)
function test(expression, expressionShouldThrow, expectedException) { function test(expression, expressionShouldThrow, expectedException) {
if (expressionShouldThrow) { if (expressionShouldThrow) {
if (expectedException) if (expectedException)
shouldThrow(expression, '(function() { return "' + expectedException + '"; })();'); shouldThrow(expression, '"' + expectedException + '"');
else else
shouldThrow(expression, '(function() { return "Error: TYPE_MISMATCH_ERR: DOM Exception 17"; })();'); shouldThrow(expression, '"TypeError: Type error"');
} else { } else {
shouldNotThrow(expression); shouldNotThrow(expression);
} }
......
...@@ -57,7 +57,7 @@ PASS mySelect.selectedIndex is -1 ...@@ -57,7 +57,7 @@ PASS mySelect.selectedIndex is -1
PASS mySelect.options.length is 10 PASS mySelect.options.length is 10
PASS mySelect.selectedIndex is -1 PASS mySelect.selectedIndex is -1
19) trying to set an element that's not an option: select element 19) trying to set an element that's not an option: select element
PASS mySelect.options[10] = mySelect; threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS mySelect.options[10] = mySelect; threw exception TypeError: Type error.
PASS mySelect.options.length is 10 PASS mySelect.options.length is 10
PASS mySelect.selectedIndex is -1 PASS mySelect.selectedIndex is -1
20) trying to set a option element using an invalid index: negative infinity 20) trying to set a option element using an invalid index: negative infinity
......
...@@ -57,7 +57,7 @@ PASS mySelect.selectedIndex is 0 ...@@ -57,7 +57,7 @@ PASS mySelect.selectedIndex is 0
PASS mySelect.options.length is 10 PASS mySelect.options.length is 10
PASS mySelect.selectedIndex is 0 PASS mySelect.selectedIndex is 0
19) trying to set an element that's not an option: select element 19) trying to set an element that's not an option: select element
PASS mySelect.options[10] = mySelect; threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS mySelect.options[10] = mySelect; threw exception TypeError: Type error.
PASS mySelect.options.length is 10 PASS mySelect.options.length is 10
PASS mySelect.selectedIndex is 0 PASS mySelect.selectedIndex is 0
20) trying to set a option element using an invalid index: negative infinity 20) trying to set a option element using an invalid index: negative infinity
......
...@@ -29,47 +29,47 @@ PASS select1.options[2].value is '3' ...@@ -29,47 +29,47 @@ PASS select1.options[2].value is '3'
PASS select1.options[2].textContent is 'C' PASS select1.options[2].textContent is 'C'
1.4 Add a non-Option element 1.4 Add a non-Option element
PASS select1.options.add(option1) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select1.options.add(option1) threw exception TypeError: Type error.
PASS select1.options.length is 3 PASS select1.options.length is 3
PASS select1.selectedIndex is 0 PASS select1.selectedIndex is 0
1.5 Add a non-element (string) 1.5 Add a non-element (string)
PASS select1.options.add(option1) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select1.options.add(option1) threw exception TypeError: Type error.
PASS select1.options.length is 3 PASS select1.options.length is 3
PASS select1.selectedIndex is 0 PASS select1.selectedIndex is 0
1.6 Add a non-element (number) 1.6 Add a non-element (number)
PASS select1.options.add(option1) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select1.options.add(option1) threw exception TypeError: Type error.
PASS select1.options.length is 3 PASS select1.options.length is 3
PASS select1.selectedIndex is 0 PASS select1.selectedIndex is 0
1.7 Add a non-element (boolean) 1.7 Add a non-element (boolean)
PASS select1.options.add(option1) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select1.options.add(option1) threw exception TypeError: Type error.
PASS select1.options.length is 3 PASS select1.options.length is 3
PASS select1.selectedIndex is 0 PASS select1.selectedIndex is 0
1.8 Add undefined 1.8 Add undefined
PASS select1.options.add(option1) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select1.options.add(option1) threw exception TypeError: Type error.
PASS select1.options.length is 3 PASS select1.options.length is 3
PASS select1.selectedIndex is 0 PASS select1.selectedIndex is 0
1.9 Add null 1.9 Add null
PASS select1.options.add(option1) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select1.options.add(option1) threw exception TypeError: Type error.
PASS select1.options.length is 3 PASS select1.options.length is 3
PASS select1.selectedIndex is 0 PASS select1.selectedIndex is 0
1.10 Add negative infinity 1.10 Add negative infinity
PASS select1.options.add(option1) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select1.options.add(option1) threw exception TypeError: Type error.
PASS select1.options.length is 3 PASS select1.options.length is 3
PASS select1.selectedIndex is 0 PASS select1.selectedIndex is 0
1.11 Add NaN 1.11 Add NaN
PASS select1.options.add(option1) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select1.options.add(option1) threw exception TypeError: Type error.
PASS select1.options.length is 3 PASS select1.options.length is 3
PASS select1.selectedIndex is 0 PASS select1.selectedIndex is 0
1.12 Add positive infinity 1.12 Add positive infinity
PASS select1.options.add(option1) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select1.options.add(option1) threw exception TypeError: Type error.
PASS select1.options.length is 3 PASS select1.options.length is 3
PASS select1.selectedIndex is 0 PASS select1.selectedIndex is 0
...@@ -163,62 +163,62 @@ PASS select2.options.length is 7 ...@@ -163,62 +163,62 @@ PASS select2.options.length is 7
PASS select2.selectedIndex is 1 PASS select2.selectedIndex is 1
2.9 Add an Option at index -Infinity 2.9 Add an Option at index -Infinity
PASS select2.options.add(option2, -1/0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select2.options.add(option2, -1/0) threw exception TypeError: Type error.
PASS select2.options.length is 7 PASS select2.options.length is 7
PASS select2.selectedIndex is 1 PASS select2.selectedIndex is 1
2.10 Add an Option at index NaN 2.10 Add an Option at index NaN
PASS select2.options.add(option2, 0/0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select2.options.add(option2, 0/0) threw exception TypeError: Type error.
PASS select2.options.length is 7 PASS select2.options.length is 7
PASS select2.selectedIndex is 1 PASS select2.selectedIndex is 1
2.11 Add an Option at index Infinity 2.11 Add an Option at index Infinity
PASS select2.options.add(option2, 1/0) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select2.options.add(option2, 1/0) threw exception TypeError: Type error.
PASS select2.options.length is 7 PASS select2.options.length is 7
PASS select2.selectedIndex is 1 PASS select2.selectedIndex is 1
2.12 Add a non-Option element 2.12 Add a non-Option element
PASS select2.options.add(option2, 1) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select2.options.add(option2, 1) threw exception TypeError: Type error.
PASS select2.options.length is 7 PASS select2.options.length is 7
PASS select2.selectedIndex is 1 PASS select2.selectedIndex is 1
2.13 Add a non-element (string) 2.13 Add a non-element (string)
PASS select2.options.add(option2, 1) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select2.options.add(option2, 1) threw exception TypeError: Type error.
PASS select2.options.length is 7 PASS select2.options.length is 7
PASS select2.selectedIndex is 1 PASS select2.selectedIndex is 1
2.14 Add a non-element (number) 2.14 Add a non-element (number)
PASS select2.options.add(option2, 1) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select2.options.add(option2, 1) threw exception TypeError: Type error.
PASS select2.options.length is 7 PASS select2.options.length is 7
PASS select2.selectedIndex is 1 PASS select2.selectedIndex is 1
2.15 Add a non-element (boolean) 2.15 Add a non-element (boolean)
PASS select2.options.add(option2, 1) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select2.options.add(option2, 1) threw exception TypeError: Type error.
PASS select2.options.length is 7 PASS select2.options.length is 7
PASS select2.selectedIndex is 1 PASS select2.selectedIndex is 1
2.16 Add undefined 2.16 Add undefined
PASS select2.options.add(option2, 1) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select2.options.add(option2, 1) threw exception TypeError: Type error.
PASS select2.options.length is 7 PASS select2.options.length is 7
PASS select2.selectedIndex is 1 PASS select2.selectedIndex is 1
2.17 Add null 2.17 Add null
PASS select2.options.add(option2, 1) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select2.options.add(option2, 1) threw exception TypeError: Type error.
PASS select2.options.length is 7 PASS select2.options.length is 7
PASS select2.selectedIndex is 1 PASS select2.selectedIndex is 1
2.18 Add negative infinity 2.18 Add negative infinity
PASS select2.options.add(option2, 1) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select2.options.add(option2, 1) threw exception TypeError: Type error.
PASS select2.options.length is 7 PASS select2.options.length is 7
PASS select2.selectedIndex is 1 PASS select2.selectedIndex is 1
2.19 Add NaN 2.19 Add NaN
PASS select2.options.add(option2, 1) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select2.options.add(option2, 1) threw exception TypeError: Type error.
PASS select2.options.length is 7 PASS select2.options.length is 7
PASS select2.selectedIndex is 1 PASS select2.selectedIndex is 1
2.20 Add positive infinity 2.20 Add positive infinity
PASS select2.options.add(option2, 1) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS select2.options.add(option2, 1) threw exception TypeError: Type error.
PASS select2.options.length is 7 PASS select2.options.length is 7
PASS select2.selectedIndex is 1 PASS select2.selectedIndex is 1
......
...@@ -12,7 +12,7 @@ PASS candidate = new RTCIceCandidate(initializer); did not throw exception. ...@@ -12,7 +12,7 @@ PASS candidate = new RTCIceCandidate(initializer); did not throw exception.
PASS candidate.candidate is "foo" PASS candidate.candidate is "foo"
PASS candidate.sdpMid is "bar" PASS candidate.sdpMid is "bar"
PASS candidate.sdpMLineIndex is 6 PASS candidate.sdpMLineIndex is 6
PASS new RTCIceCandidate({}); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS new RTCIceCandidate({}); threw exception TypeError: Type error.
PASS new RTCIceCandidate(5); threw exception TypeError: Not an object.. PASS new RTCIceCandidate(5); threw exception TypeError: Not an object..
PASS new RTCIceCandidate("foobar"); threw exception TypeError: Not an object.. PASS new RTCIceCandidate("foobar"); threw exception TypeError: Not an object..
PASS new RTCIceCandidate(candidate:""); threw exception SyntaxError: Unexpected token :. PASS new RTCIceCandidate(candidate:""); threw exception SyntaxError: Unexpected token :.
......
...@@ -14,11 +14,11 @@ PASS new webkitRTCPeerConnection({iceServers:[]}, null); did not throw exception ...@@ -14,11 +14,11 @@ PASS new webkitRTCPeerConnection({iceServers:[]}, null); did not throw exception
PASS new webkitRTCPeerConnection({iceServers:[{url:'stun:foo.com'}]}, null); did not throw exception. PASS new webkitRTCPeerConnection({iceServers:[{url:'stun:foo.com'}]}, null); did not throw exception.
PASS new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', credential:'x'}]}, null); did not throw exception. PASS new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', credential:'x'}]}, null); did not throw exception.
PASS new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', credential:'x'},{url:'stun:bar.com'}]}, null); did not throw exception. PASS new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', credential:'x'},{url:'stun:bar.com'}]}, null); did not throw exception.
PASS new webkitRTCPeerConnection({fooServers:[]}, null); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS new webkitRTCPeerConnection({fooServers:[]}, null); threw exception TypeError: Type error.
PASS new webkitRTCPeerConnection({iceServers:true}, null); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS new webkitRTCPeerConnection({iceServers:true}, null); threw exception TypeError: Type error.
PASS new webkitRTCPeerConnection({iceServers:[1, 2, 3]}, null); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS new webkitRTCPeerConnection({iceServers:[1, 2, 3]}, null); threw exception TypeError: Type error.
PASS new webkitRTCPeerConnection({iceServers:[{}]}, null); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS new webkitRTCPeerConnection({iceServers:[{}]}, null); threw exception TypeError: Type error.
PASS new webkitRTCPeerConnection({iceServers:[{url:'foo'}]}, null); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS new webkitRTCPeerConnection({iceServers:[{url:'foo'}]}, null); threw exception TypeError: Type error.
PASS new webkitRTCPeerConnection(null, {mandatory:{valid_and_supported_1:1}}); did not throw exception. PASS new webkitRTCPeerConnection(null, {mandatory:{valid_and_supported_1:1}}); did not throw exception.
PASS new webkitRTCPeerConnection(null, {mandatory:{valid_and_supported_1:1, valid_and_supported_2:1}}); did not throw exception. PASS new webkitRTCPeerConnection(null, {mandatory:{valid_and_supported_1:1, valid_and_supported_2:1}}); did not throw exception.
PASS new webkitRTCPeerConnection(null, {optional:[{valid_and_supported_1:0}]}); did not throw exception. PASS new webkitRTCPeerConnection(null, {optional:[{valid_and_supported_1:0}]}); did not throw exception.
...@@ -28,12 +28,12 @@ PASS new webkitRTCPeerConnection(null, {mandatory:{valid_and_supported_1:66}}); ...@@ -28,12 +28,12 @@ PASS new webkitRTCPeerConnection(null, {mandatory:{valid_and_supported_1:66}});
PASS new webkitRTCPeerConnection(null, {mandatory:{invalid:1}}); threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. PASS new webkitRTCPeerConnection(null, {mandatory:{invalid:1}}); threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
PASS new webkitRTCPeerConnection(null, {mandatory:{valid_but_unsupported_1:1}}); threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. PASS new webkitRTCPeerConnection(null, {mandatory:{valid_but_unsupported_1:1}}); threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
PASS new webkitRTCPeerConnection(null, {mandatory:{valid_but_unsupported_1:1, valid_and_supported_1:1}}); threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. PASS new webkitRTCPeerConnection(null, {mandatory:{valid_but_unsupported_1:1, valid_and_supported_1:1}}); threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
PASS new webkitRTCPeerConnection(null, {optional:{valid_and_supported_1:0}}); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS new webkitRTCPeerConnection(null, {optional:{valid_and_supported_1:0}}); threw exception TypeError: Type error.
PASS new webkitRTCPeerConnection(null, {optional:[{valid_and_supported_1:0,valid_and_supported_2:0}]}); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS new webkitRTCPeerConnection(null, {optional:[{valid_and_supported_1:0,valid_and_supported_2:0}]}); threw exception TypeError: Type error.
PASS new webkitRTCPeerConnection(null, {optional:[{invalid:0}]}); threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9. PASS new webkitRTCPeerConnection(null, {optional:[{invalid:0}]}); threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
PASS new webkitRTCPeerConnection(null, {valid_and_supported_1:1}); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS new webkitRTCPeerConnection(null, {valid_and_supported_1:1}); threw exception TypeError: Type error.
PASS new webkitRTCPeerConnection(null, {valid_but_unsupported_1:1}); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS new webkitRTCPeerConnection(null, {valid_but_unsupported_1:1}); threw exception TypeError: Type error.
PASS new webkitRTCPeerConnection(null, {valid_and_supported_2:1, mandatory:{valid_and_supported_1:1}}); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS new webkitRTCPeerConnection(null, {valid_and_supported_2:1, mandatory:{valid_and_supported_1:1}}); threw exception TypeError: Type error.
PASS successfullyParsed is true PASS successfullyParsed is true
TEST COMPLETE TEST COMPLETE
......
...@@ -10,11 +10,11 @@ PASS initializer = JSON.parse(JSON.stringify(sessionDescription)); did not throw ...@@ -10,11 +10,11 @@ PASS initializer = JSON.parse(JSON.stringify(sessionDescription)); did not throw
PASS sessionDescription = new RTCSessionDescription(initializer); did not throw exception. PASS sessionDescription = new RTCSessionDescription(initializer); did not throw exception.
PASS sessionDescription.type is "offer" PASS sessionDescription.type is "offer"
PASS sessionDescription.sdp is "foobar" PASS sessionDescription.sdp is "foobar"
PASS new RTCSessionDescription({}); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS new RTCSessionDescription({}); threw exception TypeError: Type error.
PASS new RTCSessionDescription(5); threw exception TypeError: Not an object.. PASS new RTCSessionDescription(5); threw exception TypeError: Not an object..
PASS new RTCSessionDescription('foobar'); threw exception TypeError: Not an object.. PASS new RTCSessionDescription('foobar'); threw exception TypeError: Not an object..
PASS new RTCSessionDescription({type:'foobar', sdp:'x'}); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS new RTCSessionDescription({type:'foobar', sdp:'x'}); threw exception TypeError: Type error.
PASS new RTCSessionDescription({type:'offer', sdp:''}); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS new RTCSessionDescription({type:'offer', sdp:''}); threw exception TypeError: Type error.
PASS new RTCSessionDescription({type:'offer', sdp:'x'}); did not throw exception. PASS new RTCSessionDescription({type:'offer', sdp:'x'}); did not throw exception.
PASS new RTCSessionDescription({type:'answer', sdp:'x'}); did not throw exception. PASS new RTCSessionDescription({type:'answer', sdp:'x'}); did not throw exception.
PASS new RTCSessionDescription({type:'pranswer', sdp:'x'}); did not throw exception. PASS new RTCSessionDescription({type:'pranswer', sdp:'x'}); did not throw exception.
......
...@@ -25,7 +25,7 @@ TEST(video.webkitAddKey('webkit-org.w3.clearkey', null)) THROWS(DOMException.SYN ...@@ -25,7 +25,7 @@ TEST(video.webkitAddKey('webkit-org.w3.clearkey', null)) THROWS(DOMException.SYN
TEST(video.webkitAddKey('webkit-org.w3.clearkey', undefined)) THROWS(DOMException.SYNTAX_ERR) OK TEST(video.webkitAddKey('webkit-org.w3.clearkey', undefined)) THROWS(DOMException.SYNTAX_ERR) OK
0-length key is caught before load state is checked. 0-length key is caught before load state is checked.
TEST(video.webkitAddKey('webkit-org.w3.clearkey', new Uint8Array())) THROWS(DOMException.TYPE_MISMATCH_ERR) OK TEST(video.webkitAddKey('webkit-org.w3.clearkey', new Uint8Array())) THROWS('TypeError') OK
Key system validity is not checked before loading. Key system validity is not checked before loading.
TEST(video.webkitGenerateKeyRequest('com.example.invalid')) THROWS(DOMException.INVALID_STATE_ERR) OK TEST(video.webkitGenerateKeyRequest('com.example.invalid')) THROWS(DOMException.INVALID_STATE_ERR) OK
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
testException("video.webkitAddKey('webkit-org.w3.clearkey', undefined)", "DOMException.SYNTAX_ERR"); testException("video.webkitAddKey('webkit-org.w3.clearkey', undefined)", "DOMException.SYNTAX_ERR");
consoleWrite("<br>0-length key is caught before load state is checked."); consoleWrite("<br>0-length key is caught before load state is checked.");
testException("video.webkitAddKey('webkit-org.w3.clearkey', new Uint8Array())", "DOMException.TYPE_MISMATCH_ERR"); testError("video.webkitAddKey('webkit-org.w3.clearkey', new Uint8Array())", "'TypeError'");
consoleWrite("<br>Key system validity is not checked before loading."); consoleWrite("<br>Key system validity is not checked before loading.");
testException("video.webkitGenerateKeyRequest('com.example.invalid')", "DOMException.INVALID_STATE_ERR"); testException("video.webkitGenerateKeyRequest('com.example.invalid')", "DOMException.INVALID_STATE_ERR");
......
...@@ -211,6 +211,15 @@ function testException(testString, exceptionString) ...@@ -211,6 +211,15 @@ function testException(testString, exceptionString)
} }
} }
function testError(testString, errorName)
{
try {
eval(testString);
} catch (ex) {
logResult(ex.name == eval(errorName), "TEST(" + testString + ") THROWS("+errorName+")");
}
}
var testEnded = false; var testEnded = false;
function endTest() function endTest()
......
Caught expected exception: Error: NOT_SUPPORTED_ERR: DOM Exception 9 Caught expected exception: Error: NOT_SUPPORTED_ERR: DOM Exception 9
Caught expected exception: Error: TYPE_MISMATCH_ERR: DOM Exception 17 Caught expected exception: TypeError: Type error
1 (black) 2 (green) 3 (green) 4 (black) 1 (black) 2 (green) 3 (green) 4 (black)
PASS PASS
...@@ -11,7 +11,7 @@ PASS crypto.getRandomValues(new Uint16Array(3)) is undefined. ...@@ -11,7 +11,7 @@ PASS crypto.getRandomValues(new Uint16Array(3)) is undefined.
PASS crypto.getRandomValues(new Int16Array(3)) is undefined. PASS crypto.getRandomValues(new Int16Array(3)) is undefined.
PASS crypto.getRandomValues(new Uint32Array(3)) is undefined. PASS crypto.getRandomValues(new Uint32Array(3)) is undefined.
PASS crypto.getRandomValues(new Int32Array(3)) is undefined. PASS crypto.getRandomValues(new Int32Array(3)) is undefined.
PASS crypto.getRandomValues(new Float32Array(3)) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS crypto.getRandomValues(new Float32Array(3)) threw exception TypeError: Type error.
PASS successfullyParsed is true PASS successfullyParsed is true
TEST COMPLETE TEST COMPLETE
......
...@@ -11,8 +11,8 @@ PASS transform.createSVGTransformFromMatrix(svgElement) threw exception TypeErro ...@@ -11,8 +11,8 @@ PASS transform.createSVGTransformFromMatrix(svgElement) threw exception TypeErro
PASS transform.createSVGTransformFromMatrix('aString') threw exception TypeError: Type error. PASS transform.createSVGTransformFromMatrix('aString') threw exception TypeError: Type error.
PASS transform.createSVGTransformFromMatrix(1) threw exception TypeError: Type error. PASS transform.createSVGTransformFromMatrix(1) threw exception TypeError: Type error.
PASS transform.createSVGTransformFromMatrix(true) threw exception TypeError: Type error. PASS transform.createSVGTransformFromMatrix(true) threw exception TypeError: Type error.
PASS transform.createSVGTransformFromMatrix(undefined) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS transform.createSVGTransformFromMatrix(undefined) threw exception TypeError: Type error.
PASS transform.createSVGTransformFromMatrix(null) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17. PASS transform.createSVGTransformFromMatrix(null) threw exception TypeError: Type error.
PASS successfullyParsed is true PASS successfullyParsed is true
TEST COMPLETE TEST COMPLETE
......
2012-11-12 Erik Arvidsson <arv@chromium.org>
Replace DOMException TYPE_MISMATCH_ERR with TypeError
https://bugs.webkit.org/show_bug.cgi?id=101604
Reviewed by Adam Barth.
DOMException.TYPE_MISMATCH_ERR is deprecated in favor of using TypeError.
We have historically used TYPE_MISMATCH_ERR as a blanket DOMException code when
the spec mandates TypeError being thrown.
Updated existing tests.
* Modules/mediastream/MediaConstraintsImpl.cpp:
* Modules/mediastream/MediaStreamTrackList.cpp:
* Modules/mediastream/PeerConnection00.cpp:
* Modules/mediastream/RTCDataChannel.cpp:
* Modules/mediastream/RTCIceCandidate.cpp:
* Modules/mediastream/RTCPeerConnection.cpp:
* Modules/mediastream/RTCSessionDescription.cpp:
* Modules/mediastream/SessionDescription.cpp:
* bindings/js/CallbackFunction.cpp:
* bindings/js/JSCustomXPathNSResolver.cpp:
* bindings/js/JSHTMLOptionsCollectionCustom.cpp:
* bindings/js/JSHTMLSelectElementCustom.cpp:
* bindings/js/JSMutationObserverCustom.cpp:
* bindings/js/JSSQLResultSetRowListCustom.cpp:
* bindings/js/JSSQLTransactionCustom.cpp:
* bindings/js/JSSQLTransactionSyncCustom.cpp:
* bindings/scripts/CodeGeneratorJS.pm:
* bindings/scripts/CodeGeneratorObjC.pm:
* bindings/scripts/CodeGeneratorV8.pm:
* bindings/v8/V8Callback.h:
* bindings/v8/V8Collection.cpp:
* bindings/v8/custom/V8DocumentCustom.cpp:
* bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
* bindings/v8/custom/V8MutationObserverCustom.cpp:
* bindings/v8/custom/V8SQLTransactionCustom.cpp:
* bindings/v8/custom/V8SQLTransactionSyncCustom.cpp:
* dom/DOMCoreException.idl:
* html/HTMLElement.cpp:
* html/HTMLMediaElement.cpp:
* html/HTMLOptionsCollection.cpp:
* html/canvas/CanvasRenderingContext2D.cpp:
* page/Crypto.cpp:
* page/DOMSelection.cpp:
* svg/properties/SVGTransformListPropertyTearOff.h:
2012-11-12 Joshua Bell <jsbell@chromium.org> 2012-11-12 Joshua Bell <jsbell@chromium.org>
IndexedDB: Use sequence<> instead of DOMString[] in IDL IndexedDB: Use sequence<> instead of DOMString[] in IDL
...@@ -45,7 +45,7 @@ PassRefPtr<MediaConstraintsImpl> MediaConstraintsImpl::create(const Dictionary& ...@@ -45,7 +45,7 @@ PassRefPtr<MediaConstraintsImpl> MediaConstraintsImpl::create(const Dictionary&
{ {
RefPtr<MediaConstraintsImpl> object = adoptRef(new MediaConstraintsImpl()); RefPtr<MediaConstraintsImpl> object = adoptRef(new MediaConstraintsImpl());
if (!object->initialize(constraints)) { if (!object->initialize(constraints)) {