Title: [115670] trunk/Source/WebCore
Revision
115670
Author
[email protected]
Date
2012-04-30 14:37:14 -0700 (Mon, 30 Apr 2012)

Log Message

[V8][JSC] Remove hard-coded "Not enough arguments" errors
https://bugs.webkit.org/show_bug.cgi?id=85207

Reviewed by Sam Weinig.

In bug 85022 and bug 85097, we implemented
createNotEnoughArgumentsError() in JSC and
V8Proxy::throwNotEnoughArgumentsError() in V8 and partially
removed hard-coded "Not enough arguments" errors.
This patch removes hard-coded "Not enough arguments"
errors by using the helper methods.

No tests. No change in behavior.

* 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/ScriptController.cpp:
(WebCore::setValueAndClosePopupCallback):
* 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (115669 => 115670)


--- trunk/Source/WebCore/ChangeLog	2012-04-30 21:32:44 UTC (rev 115669)
+++ trunk/Source/WebCore/ChangeLog	2012-04-30 21:37:14 UTC (rev 115670)
@@ -1,3 +1,40 @@
+2012-04-30  Kentaro Hara  <[email protected]>
+
+        [V8][JSC] Remove hard-coded "Not enough arguments" errors
+        https://bugs.webkit.org/show_bug.cgi?id=85207
+
+        Reviewed by Sam Weinig.
+
+        In bug 85022 and bug 85097, we implemented
+        createNotEnoughArgumentsError() in JSC and
+        V8Proxy::throwNotEnoughArgumentsError() in V8 and partially
+        removed hard-coded "Not enough arguments" errors.
+        This patch removes hard-coded "Not enough arguments"
+        errors by using the helper methods.
+
+        No tests. No change in behavior.
+
+        * 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/ScriptController.cpp:
+        (WebCore::setValueAndClosePopupCallback):
+        * 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-30  Benjamin Poulain  <[email protected]>
 
         Add String::startsWith() and endsWith() for string literals

Modified: trunk/Source/WebCore/bindings/js/JSAudioContextCustom.cpp (115669 => 115670)


--- trunk/Source/WebCore/bindings/js/JSAudioContextCustom.cpp	2012-04-30 21:32:44 UTC (rev 115669)
+++ trunk/Source/WebCore/bindings/js/JSAudioContextCustom.cpp	2012-04-30 21:37:14 UTC (rev 115670)
@@ -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, createTypeError(exec, "Not enough arguments"));
+            return throwVMError(exec, createNotEnoughArgumentsError(exec));
 
         int32_t numberOfChannels = exec->argument(0).toInt32(exec);
         int32_t numberOfFrames = exec->argument(1).toInt32(exec);

Modified: trunk/Source/WebCore/bindings/js/JSSVGLengthCustom.cpp (115669 => 115670)


--- trunk/Source/WebCore/bindings/js/JSSVGLengthCustom.cpp	2012-04-30 21:32:44 UTC (rev 115669)
+++ trunk/Source/WebCore/bindings/js/JSSVGLengthCustom.cpp	2012-04-30 21:37:14 UTC (rev 115670)
@@ -81,7 +81,7 @@
     SVGLength& podImp = impl()->propertyReference();
 
     if (exec->argumentCount() < 1)
-        return throwError(exec, createTypeError(exec, "Not enough arguments"));
+        return throwError(exec, createNotEnoughArgumentsError(exec));
 
     unsigned short unitType = exec->argument(0).toUInt32(exec);
     if (exec->hadException())

Modified: trunk/Source/WebCore/bindings/js/JSWebSocketCustom.cpp (115669 => 115670)


--- trunk/Source/WebCore/bindings/js/JSWebSocketCustom.cpp	2012-04-30 21:32:44 UTC (rev 115669)
+++ trunk/Source/WebCore/bindings/js/JSWebSocketCustom.cpp	2012-04-30 21:37:14 UTC (rev 115670)
@@ -58,7 +58,7 @@
         return throwVMError(exec, createReferenceError(exec, "WebSocket constructor associated document is unavailable"));
 
     if (!exec->argumentCount())
-        return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
+        return throwVMError(exec, createNotEnoughArgumentsError(exec));
 
     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, createTypeError(exec, "Not enough arguments"));
+        return throwError(exec, createNotEnoughArgumentsError(exec));
 
     JSValue message = exec->argument(0);
     ExceptionCode ec = 0;

Modified: trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp (115669 => 115670)


--- trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp	2012-04-30 21:32:44 UTC (rev 115669)
+++ trunk/Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp	2012-04-30 21:37:14 UTC (rev 115670)
@@ -83,7 +83,7 @@
 JSValue JSXMLHttpRequest::open(ExecState* exec)
 {
     if (exec->argumentCount() < 2)
-        return throwError(exec, createTypeError(exec, "Not enough arguments"));
+        return throwError(exec, createNotEnoughArgumentsError(exec));
 
     const KURL& url = ""
     String method = ustringToString(exec->argument(0).toString(exec)->value(exec));

Modified: trunk/Source/WebCore/bindings/v8/ScriptController.cpp (115669 => 115670)


--- trunk/Source/WebCore/bindings/v8/ScriptController.cpp	2012-04-30 21:32:44 UTC (rev 115669)
+++ trunk/Source/WebCore/bindings/v8/ScriptController.cpp	2012-04-30 21:37:14 UTC (rev 115670)
@@ -254,7 +254,7 @@
 static v8::Handle<v8::Value> setValueAndClosePopupCallback(const v8::Arguments& args)
 {
     if (args.Length() < 2)
-        return throwError("Not enough arguments", V8Proxy::TypeError);
+        return V8Proxy::throwNotEnoughArgumentsError();
     DOMWindow* imp = V8DOMWindow::toNative(args.Data()->ToObject());
     EXCEPTION_BLOCK(int, intValue, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, stringValue, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined));

Modified: trunk/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp (115669 => 115670)


--- trunk/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp	2012-04-30 21:32:44 UTC (rev 115669)
+++ trunk/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp	2012-04-30 21:37:14 UTC (rev 115670)
@@ -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::TypeError);
+            return V8Proxy::throwNotEnoughArgumentsError();
 
         bool ok = false;
 

Modified: trunk/Source/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp (115669 => 115670)


--- trunk/Source/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp	2012-04-30 21:32:44 UTC (rev 115669)
+++ trunk/Source/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp	2012-04-30 21:37:14 UTC (rev 115670)
@@ -90,7 +90,7 @@
     }
 
     if (args.Length() < 1)
-        return throwError("Not enough arguments", V8Proxy::TypeError);
+        return V8Proxy::throwNotEnoughArgumentsError();
 
     SVGLength& imp = wrapper->propertyReference();
     ExceptionCode ec = 0;

Modified: trunk/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp (115669 => 115670)


--- trunk/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp	2012-04-30 21:32:44 UTC (rev 115669)
+++ trunk/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp	2012-04-30 21:37:14 UTC (rev 115670)
@@ -62,7 +62,7 @@
         return args.Holder();
 
     if (args.Length() == 0)
-        return throwError("Not enough arguments", V8Proxy::TypeError);
+        return V8Proxy::throwNotEnoughArgumentsError();
 
     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::TypeError);
+        return V8Proxy::throwNotEnoughArgumentsError();
 
     WebSocket* webSocket = V8WebSocket::toNative(args.Holder());
     v8::Handle<v8::Value> message = args[0];

Modified: trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp (115669 => 115670)


--- trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp	2012-04-30 21:32:44 UTC (rev 115669)
+++ trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp	2012-04-30 21:37:14 UTC (rev 115670)
@@ -121,7 +121,7 @@
     // open(method, url, async, user, passwd)
 
     if (args.Length() < 2)
-        return throwError("Not enough arguments", V8Proxy::TypeError);
+        return V8Proxy::throwNotEnoughArgumentsError();
 
     XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(args.Holder());
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to