Diff
Modified: trunk/LayoutTests/ChangeLog (115532 => 115533)
--- trunk/LayoutTests/ChangeLog 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/LayoutTests/ChangeLog 2012-04-28 03:30:28 UTC (rev 115533)
@@ -1,3 +1,28 @@
+2012-04-27 Kentaro Hara <[email protected]>
+
+ "Not enough arguments" error should be TypeError
+ https://bugs.webkit.org/show_bug.cgi?id=84628
+
+ Reviewed by Darin Adler.
+
+ Currently, some custom bindings implement "Not enough arguments"
+ error as SyntaxError. The Web IDL spec requires that it should be
+ TypeError: http://www.w3.org/TR/WebIDL/#dfn-overload-resolution-algorithm
+ Thus, this patch changes SyntaxError to TypeError, and adds test
+ cases for the exception.
+
+ * http/tests/websocket/tests/hixie76/send-empty-expected.txt:
+ * http/tests/websocket/tests/hixie76/url-parsing.html:
+ * http/tests/websocket/tests/hybi/send-empty-expected.txt:
+ * http/tests/websocket/tests/hybi/url-parsing.html:
+ * http/tests/xmlhttprequest/exceptions-expected.txt:
+ * http/tests/xmlhttprequest/exceptions.html:
+ * platform/chromium-linux/http/tests/websocket/tests/hixie76/url-parsing-expected.txt:
+ * platform/chromium/http/tests/websocket/tests/hybi/url-parsing-expected.txt:
+ * svg/dom/SVGLength-expected.txt:
+ * webaudio/audionode-expected.txt:
+ * webaudio/audionode.html:
+
2012-04-27 Kenneth Russell <[email protected]>
Remove SHADER_COMPILER constant
Modified: trunk/LayoutTests/http/tests/websocket/tests/hixie76/send-empty-expected.txt (115532 => 115533)
--- trunk/LayoutTests/http/tests/websocket/tests/hixie76/send-empty-expected.txt 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/LayoutTests/http/tests/websocket/tests/hixie76/send-empty-expected.txt 2012-04-28 03:30:28 UTC (rev 115533)
@@ -2,7 +2,7 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS ws.send() threw exception SyntaxError: Not enough arguments.
+PASS ws.send() threw exception TypeError: Not enough arguments.
PASS closeEvent.wasClean is true
PASS receivedMessages.length is 1
PASS receivedMessages[0] is "Goodbye"
Modified: trunk/LayoutTests/http/tests/websocket/tests/hixie76/url-parsing.html (115532 => 115533)
--- trunk/LayoutTests/http/tests/websocket/tests/hixie76/url-parsing.html 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/LayoutTests/http/tests/websocket/tests/hixie76/url-parsing.html 2012-04-28 03:30:28 UTC (rev 115533)
@@ -12,6 +12,9 @@
if (window.layoutTestController)
layoutTestController.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 1);
+// Not enough arguments.
+shouldThrow('new WebSocket()');
+
// Invalid url will fail to be parsed.
shouldThrow('new WebSocket("ws://_javascript_:a")');
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/send-empty-expected.txt (115532 => 115533)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/send-empty-expected.txt 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/send-empty-expected.txt 2012-04-28 03:30:28 UTC (rev 115533)
@@ -2,7 +2,7 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS ws.send() threw exception SyntaxError: Not enough arguments.
+PASS ws.send() threw exception TypeError: Not enough arguments.
PASS closeEvent.wasClean is true
PASS receivedMessages.length is 1
PASS receivedMessages[0] is "Goodbye"
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/url-parsing.html (115532 => 115533)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/url-parsing.html 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/url-parsing.html 2012-04-28 03:30:28 UTC (rev 115533)
@@ -12,6 +12,9 @@
if (window.layoutTestController)
layoutTestController.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 0);
+// Not enough arguments.
+shouldThrow('new WebSocket()');
+
// Invalid url will fail to be parsed.
shouldThrow('new WebSocket("ws://_javascript_:a")');
Modified: trunk/LayoutTests/http/tests/xmlhttprequest/exceptions-expected.txt (115532 => 115533)
--- trunk/LayoutTests/http/tests/xmlhttprequest/exceptions-expected.txt 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/exceptions-expected.txt 2012-04-28 03:30:28 UTC (rev 115533)
@@ -12,3 +12,5 @@
PASS: req.send(null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
PASS: req.setRequestHeader("Foo", "bar") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
PASS: req.getResponseHeader() threw exception TypeError: Not enough arguments.
+PASS: req.open() threw exception TypeError: Not enough arguments.
+PASS: req.open(null) threw exception TypeError: Not enough arguments.
Modified: trunk/LayoutTests/http/tests/xmlhttprequest/exceptions.html (115532 => 115533)
--- trunk/LayoutTests/http/tests/xmlhttprequest/exceptions.html 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/exceptions.html 2012-04-28 03:30:28 UTC (rev 115533)
@@ -73,6 +73,9 @@
shouldThrow('req.send(null)');
shouldThrow('req.setRequestHeader("Foo", "bar")');
shouldThrow('req.getResponseHeader()');
+
+ shouldThrow('req.open()');
+ shouldThrow('req.open(null)');
</script>
</body>
Modified: trunk/LayoutTests/platform/chromium/http/tests/websocket/tests/hybi/url-parsing-expected.txt (115532 => 115533)
--- trunk/LayoutTests/platform/chromium/http/tests/websocket/tests/hybi/url-parsing-expected.txt 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/LayoutTests/platform/chromium/http/tests/websocket/tests/hybi/url-parsing-expected.txt 2012-04-28 03:30:28 UTC (rev 115533)
@@ -8,6 +8,7 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+PASS new WebSocket() threw exception TypeError: Not enough arguments.
PASS new WebSocket("ws://_javascript_:a") threw exception Error: SYNTAX_ERR: DOM Exception 12.
PASS new WebSocket("/applet") threw exception Error: SYNTAX_ERR: DOM Exception 12.
PASS new WebSocket("_javascript_:a") threw exception Error: SYNTAX_ERR: DOM Exception 12.
Modified: trunk/LayoutTests/platform/chromium-linux/http/tests/websocket/tests/hixie76/url-parsing-expected.txt (115532 => 115533)
--- trunk/LayoutTests/platform/chromium-linux/http/tests/websocket/tests/hixie76/url-parsing-expected.txt 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/LayoutTests/platform/chromium-linux/http/tests/websocket/tests/hixie76/url-parsing-expected.txt 2012-04-28 03:30:28 UTC (rev 115533)
@@ -8,6 +8,7 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+PASS new WebSocket() threw exception TypeError: Not enough arguments.
PASS new WebSocket("ws://_javascript_:a") threw exception Error: SYNTAX_ERR: DOM Exception 12.
PASS new WebSocket("/applet") threw exception Error: SYNTAX_ERR: DOM Exception 12.
PASS new WebSocket("_javascript_:a") threw exception Error: SYNTAX_ERR: DOM Exception 12.
Modified: trunk/LayoutTests/svg/dom/SVGLength-expected.txt (115532 => 115533)
--- trunk/LayoutTests/svg/dom/SVGLength-expected.txt 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/LayoutTests/svg/dom/SVGLength-expected.txt 2012-04-28 03:30:28 UTC (rev 115533)
@@ -23,7 +23,7 @@
PASS length.convertToSpecifiedUnits('aString') threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
PASS length.convertToSpecifiedUnits(length) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
PASS length.convertToSpecifiedUnits(svgElement) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
-PASS length.convertToSpecifiedUnits() threw exception SyntaxError: Not enough arguments.
+PASS length.convertToSpecifiedUnits() threw exception TypeError: Not enough arguments.
PASS length.unitType is SVGLength.SVG_LENGTHTYPE_PX
PASS length.value is 2
PASS length.valueInSpecifiedUnits is 2
Modified: trunk/LayoutTests/webaudio/audionode-expected.txt (115532 => 115533)
--- trunk/LayoutTests/webaudio/audionode-expected.txt 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/LayoutTests/webaudio/audionode-expected.txt 2012-04-28 03:30:28 UTC (rev 115533)
@@ -12,6 +12,7 @@
PASS connect() exception thrown for illegal input index.
PASS audioNode.connect(context.destination) succeeded.
PASS exception thrown when connecting to other context's node.
+PASS exception thrown when creating audio context with not enough arguments.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/webaudio/audionode.html (115532 => 115533)
--- trunk/LayoutTests/webaudio/audionode.html 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/LayoutTests/webaudio/audionode.html 2012-04-28 03:30:28 UTC (rev 115533)
@@ -82,6 +82,14 @@
testPassed("exception thrown when connecting to other context's node.");
}
+ // Create a new context with not enough arguments
+ try {
+ context2 = new webkitAudioContext(0, 0);
+ testFailed("exception should be thrown when creating audio context with not enough arguments.");
+ } catch(e) {
+ testPassed("exception thrown when creating audio context with not enough arguments.");
+ }
+
finishJSTest();
}
Modified: trunk/Source/WebCore/ChangeLog (115532 => 115533)
--- trunk/Source/WebCore/ChangeLog 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/Source/WebCore/ChangeLog 2012-04-28 03:30:28 UTC (rev 115533)
@@ -1,3 +1,40 @@
+2012-04-27 Kentaro Hara <[email protected]>
+
+ "Not enough arguments" error should be TypeError
+ https://bugs.webkit.org/show_bug.cgi?id=84628
+
+ Reviewed by Darin Adler.
+
+ Currently, some custom bindings implement "Not enough arguments"
+ error as SyntaxError. The Web IDL spec requires that it should be
+ TypeError: http://www.w3.org/TR/WebIDL/#dfn-overload-resolution-algorithm
+ Thus, this patch changes SyntaxError to TypeError.
+
+ Tests: http/tests/websocket/tests/hixie76/url-parsing.html:
+ http/tests/websocket/tests/hybi/url-parsing.html:
+ http/tests/xmlhttprequest/exceptions.html:
+ svg/dom/SVGLength.html:
+ webaudio/audionode.html:
+
+ * bindings/js/JSAudioContextCustom.cpp:
+ (WebCore::JSAudioContextConstructor::constructJSAudioContext):
+ * bindings/js/JSSVGLengthCustom.cpp:
+ (WebCore::JSSVGLength::convertToSpecifiedUnits):
+ * bindings/js/JSWebSocketCustom.cpp:
+ (WebCore::JSWebSocketConstructor::constructJSWebSocket):
+ (WebCore::JSWebSocket::send):
+ * bindings/js/JSXMLHttpRequestCustom.cpp:
+ (WebCore::JSXMLHttpRequest::open):
+ * bindings/v8/custom/V8AudioContextCustom.cpp:
+ (WebCore::V8AudioContext::constructorCallback):
+ * bindings/v8/custom/V8SVGLengthCustom.cpp:
+ (WebCore::V8SVGLength::convertToSpecifiedUnitsCallback):
+ * bindings/v8/custom/V8WebSocketCustom.cpp:
+ (WebCore::V8WebSocket::constructorCallback):
+ (WebCore::V8WebSocket::sendCallback):
+ * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
+ (WebCore::V8XMLHttpRequest::openCallback):
+
2012-04-27 Kenneth Russell <[email protected]>
Remove SHADER_COMPILER constant
Modified: trunk/Source/WebCore/bindings/js/JSAudioContextCustom.cpp (115532 => 115533)
--- trunk/Source/WebCore/bindings/js/JSAudioContextCustom.cpp 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/Source/WebCore/bindings/js/JSAudioContextCustom.cpp 2012-04-28 03:30:28 UTC (rev 115533)
@@ -80,7 +80,7 @@
// Constructor for offline (render-target) AudioContext which renders into an AudioBuffer.
// new AudioContext(in unsigned long numberOfChannels, in unsigned long numberOfFrames, in float sampleRate);
if (exec->argumentCount() < 3)
- return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));
+ return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
int32_t numberOfChannels = exec->argument(0).toInt32(exec);
int32_t numberOfFrames = exec->argument(1).toInt32(exec);
Modified: trunk/Source/WebCore/bindings/js/JSSVGLengthCustom.cpp (115532 => 115533)
--- trunk/Source/WebCore/bindings/js/JSSVGLengthCustom.cpp 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/Source/WebCore/bindings/js/JSSVGLengthCustom.cpp 2012-04-28 03:30:28 UTC (rev 115533)
@@ -81,7 +81,7 @@
SVGLength& podImp = impl()->propertyReference();
if (exec->argumentCount() < 1)
- return throwError(exec, createSyntaxError(exec, "Not enough arguments"));
+ return throwError(exec, createTypeError(exec, "Not enough arguments"));
unsigned short unitType = exec->argument(0).toUInt32(exec);
if (exec->hadException())
Modified: trunk/Source/WebCore/bindings/js/JSWebSocketCustom.cpp (115532 => 115533)
--- trunk/Source/WebCore/bindings/js/JSWebSocketCustom.cpp 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/Source/WebCore/bindings/js/JSWebSocketCustom.cpp 2012-04-28 03:30:28 UTC (rev 115533)
@@ -58,7 +58,7 @@
return throwVMError(exec, createReferenceError(exec, "WebSocket constructor associated document is unavailable"));
if (!exec->argumentCount())
- return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));
+ return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
String urlString = ustringToString(exec->argument(0).toString(exec)->value(exec));
if (exec->hadException())
@@ -93,7 +93,7 @@
JSValue JSWebSocket::send(ExecState* exec)
{
if (!exec->argumentCount())
- return throwError(exec, createSyntaxError(exec, "Not enough arguments"));
+ return throwError(exec, createTypeError(exec, "Not enough arguments"));
JSValue message = exec->argument(0);
ExceptionCode ec = 0;
Modified: trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp (115532 => 115533)
--- trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp 2012-04-28 03:30:28 UTC (rev 115533)
@@ -83,7 +83,7 @@
JSValue JSXMLHttpRequest::open(ExecState* exec)
{
if (exec->argumentCount() < 2)
- return throwError(exec, createSyntaxError(exec, "Not enough arguments"));
+ return throwError(exec, createTypeError(exec, "Not enough arguments"));
const KURL& url = ""
String method = ustringToString(exec->argument(0).toString(exec)->value(exec));
Modified: trunk/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp (115532 => 115533)
--- trunk/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp 2012-04-28 03:30:28 UTC (rev 115533)
@@ -71,7 +71,7 @@
// Constructor for offline (render-target) AudioContext which renders into an AudioBuffer.
// new AudioContext(in unsigned long numberOfChannels, in unsigned long numberOfFrames, in float sampleRate);
if (args.Length() < 3)
- return throwError("Not enough arguments", V8Proxy::SyntaxError);
+ return throwError("Not enough arguments", V8Proxy::TypeError);
bool ok = false;
Modified: trunk/Source/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp (115532 => 115533)
--- trunk/Source/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/Source/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp 2012-04-28 03:30:28 UTC (rev 115533)
@@ -90,7 +90,7 @@
}
if (args.Length() < 1)
- return throwError("Not enough arguments", V8Proxy::SyntaxError);
+ return throwError("Not enough arguments", V8Proxy::TypeError);
SVGLength& imp = wrapper->propertyReference();
ExceptionCode ec = 0;
Modified: trunk/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp (115532 => 115533)
--- trunk/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp 2012-04-28 03:30:28 UTC (rev 115533)
@@ -62,7 +62,7 @@
return args.Holder();
if (args.Length() == 0)
- return throwError("Not enough arguments", V8Proxy::SyntaxError);
+ return throwError("Not enough arguments", V8Proxy::TypeError);
v8::TryCatch tryCatch;
v8::Handle<v8::String> urlstring = args[0]->ToString();
@@ -117,7 +117,7 @@
INC_STATS("DOM.WebSocket.send()");
if (!args.Length())
- return throwError("Not enough arguments", V8Proxy::SyntaxError);
+ return throwError("Not enough arguments", V8Proxy::TypeError);
WebSocket* webSocket = V8WebSocket::toNative(args.Holder());
v8::Handle<v8::Value> message = args[0];
Modified: trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp (115532 => 115533)
--- trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp 2012-04-28 03:23:49 UTC (rev 115532)
+++ trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp 2012-04-28 03:30:28 UTC (rev 115533)
@@ -121,7 +121,7 @@
// open(method, url, async, user, passwd)
if (args.Length() < 2)
- return throwError("Not enough arguments", V8Proxy::SyntaxError);
+ return throwError("Not enough arguments", V8Proxy::TypeError);
XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder());