Title: [134386] trunk/Source/WebCore
Revision
134386
Author
tom...@google.com
Date
2012-11-13 01:15:35 -0800 (Tue, 13 Nov 2012)

Log Message

Remove the custom WebSocket::send for both V8 and JSC
https://bugs.webkit.org/show_bug.cgi?id=101936

Reviewed by Kentaro Hara.

This patch removes the custom WebSocket::send since it isn't needed anymore.

Patch covered by existing tests.

* Modules/websockets/WebSocket.idl:
* UseV8.cmake:
* WebCore.gypi:
* bindings/js/JSWebSocketCustom.cpp:
* bindings/v8/custom/V8WebSocketCustom.cpp: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (134385 => 134386)


--- trunk/Source/WebCore/ChangeLog	2012-11-13 09:08:54 UTC (rev 134385)
+++ trunk/Source/WebCore/ChangeLog	2012-11-13 09:15:35 UTC (rev 134386)
@@ -1,3 +1,20 @@
+2012-11-13  Tommy Widenflycht  <tom...@google.com>
+
+        Remove the custom WebSocket::send for both V8 and JSC
+        https://bugs.webkit.org/show_bug.cgi?id=101936
+
+        Reviewed by Kentaro Hara.
+
+        This patch removes the custom WebSocket::send since it isn't needed anymore.
+
+        Patch covered by existing tests.
+
+        * Modules/websockets/WebSocket.idl:
+        * UseV8.cmake:
+        * WebCore.gypi:
+        * bindings/js/JSWebSocketCustom.cpp:
+        * bindings/v8/custom/V8WebSocketCustom.cpp: Removed.
+
 2012-11-13  Pavel Feldman  <pfeld...@chromium.org>
 
         Web Inspector: move indentation logic into TextEditorModel

Modified: trunk/Source/WebCore/Modules/websockets/WebSocket.idl (134385 => 134386)


--- trunk/Source/WebCore/Modules/websockets/WebSocket.idl	2012-11-13 09:08:54 UTC (rev 134385)
+++ trunk/Source/WebCore/Modules/websockets/WebSocket.idl	2012-11-13 09:15:35 UTC (rev 134386)
@@ -65,16 +65,14 @@
 
     attribute DOMString binaryType;
 
-    // FIXME: Use overloading provided by our IDL code generator.
-    // According to Web IDL specification, overloaded function with DOMString argument
-    // should accept anything that can be converted to a string (including numbers,
-    // booleans, null, undefined and objects except ArrayBuffer and Blob). Current code
-    // generator does not handle this rule correctly.
-    // boolean send(in ArrayBuffer data) raises(DOMException);
-    // boolean send(in ArrayBufferView data) raises(DOMException);
-    // boolean send(in Blob data) raises(DOMException);
-    // boolean send(in DOMString data) raises(DOMException);
-    [Custom] boolean send(in DOMString data) raises(DOMException);
+    boolean send(in ArrayBuffer data)
+        raises(DOMException);
+    boolean send(in ArrayBufferView data)
+        raises(DOMException);
+    boolean send(in Blob data)
+        raises(DOMException);
+    boolean send(in DOMString data)
+        raises(DOMException);
 
     void close(in [Clamp, Optional] unsigned short code, in [Optional] DOMString reason) raises(DOMException);
 

Modified: trunk/Source/WebCore/UseV8.cmake (134385 => 134386)


--- trunk/Source/WebCore/UseV8.cmake	2012-11-13 09:08:54 UTC (rev 134385)
+++ trunk/Source/WebCore/UseV8.cmake	2012-11-13 09:15:35 UTC (rev 134386)
@@ -149,7 +149,6 @@
     bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
     bindings/v8/custom/V8WebKitAnimationCustom.cpp
     bindings/v8/custom/V8WebKitPointConstructor.cpp
-    bindings/v8/custom/V8WebSocketCustom.cpp
     bindings/v8/custom/V8WorkerContextCustom.cpp
     bindings/v8/custom/V8WorkerCustom.cpp
     bindings/v8/custom/V8XMLHttpRequestConstructor.cpp

Modified: trunk/Source/WebCore/WebCore.gypi (134385 => 134386)


--- trunk/Source/WebCore/WebCore.gypi	2012-11-13 09:08:54 UTC (rev 134385)
+++ trunk/Source/WebCore/WebCore.gypi	2012-11-13 09:15:35 UTC (rev 134386)
@@ -2421,7 +2421,6 @@
             'bindings/v8/custom/V8WebGLRenderingContextCustom.cpp',
             'bindings/v8/custom/V8WebKitAnimationCustom.cpp',
             'bindings/v8/custom/V8WebKitPointConstructor.cpp',
-            'bindings/v8/custom/V8WebSocketCustom.cpp',
             'bindings/v8/custom/V8WorkerContextCustom.cpp',
             'bindings/v8/custom/V8WorkerCustom.cpp',
             'bindings/v8/custom/V8XMLHttpRequestConstructor.cpp',

Modified: trunk/Source/WebCore/bindings/js/JSWebSocketCustom.cpp (134385 => 134386)


--- trunk/Source/WebCore/bindings/js/JSWebSocketCustom.cpp	2012-11-13 09:08:54 UTC (rev 134385)
+++ trunk/Source/WebCore/bindings/js/JSWebSocketCustom.cpp	2012-11-13 09:15:35 UTC (rev 134386)
@@ -91,34 +91,6 @@
     return JSValue::encode(CREATE_DOM_WRAPPER(exec, jsConstructor->globalObject(), WebSocket, webSocket.get()));
 }
 
-JSValue JSWebSocket::send(ExecState* exec)
-{
-    if (!exec->argumentCount())
-        return throwError(exec, createNotEnoughArgumentsError(exec));
-
-    JSValue message = exec->argument(0);
-    ExceptionCode ec = 0;
-    bool result;
-    if (message.inherits(&JSArrayBuffer::s_info))
-        result = impl()->send(toArrayBuffer(message), ec);
-    else if (message.inherits(&JSArrayBufferView::s_info))
-        result = impl()->send(toArrayBufferView(message), ec);
-    else if (message.inherits(&JSBlob::s_info))
-        result = impl()->send(toBlob(message), ec);
-    else {
-        String stringMessage = message.toString(exec)->value(exec);
-        if (exec->hadException())
-            return jsUndefined();
-        result = impl()->send(stringMessage, ec);
-    }
-    if (ec) {
-        setDOMException(exec, ec);
-        return jsUndefined();
-    }
-
-    return jsBoolean(result);
-}
-
 } // namespace WebCore
 
 #endif

Deleted: trunk/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp (134385 => 134386)


--- trunk/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp	2012-11-13 09:08:54 UTC (rev 134385)
+++ trunk/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp	2012-11-13 09:15:35 UTC (rev 134386)
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(WEB_SOCKETS)
-
-#include "V8WebSocket.h"
-
-#include "ExceptionCode.h"
-#include "Frame.h"
-#include "Settings.h"
-#include "V8ArrayBuffer.h"
-#include "V8ArrayBufferView.h"
-#include "V8Binding.h"
-#include "V8Blob.h"
-#include "V8Utilities.h"
-#include "WebSocket.h"
-#include "WebSocketChannel.h"
-#include "WorkerContext.h"
-#include "WorkerContextExecutionProxy.h"
-#include <wtf/MathExtras.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8WebSocket::sendCallback(const v8::Arguments& args)
-{
-    INC_STATS("DOM.WebSocket.send()");
-
-    if (!args.Length())
-        return throwNotEnoughArgumentsError(args.GetIsolate());
-
-    WebSocket* webSocket = V8WebSocket::toNative(args.Holder());
-    v8::Handle<v8::Value> message = args[0];
-    ExceptionCode ec = 0;
-    bool result;
-    if (V8ArrayBuffer::HasInstance(message)) {
-        ArrayBuffer* arrayBuffer = V8ArrayBuffer::toNative(v8::Handle<v8::Object>::Cast(message));
-        ASSERT(arrayBuffer);
-        result = webSocket->send(arrayBuffer, ec);
-    } else if (V8ArrayBufferView::HasInstance(message)) {
-        ArrayBufferView* arrayBufferView = V8ArrayBufferView::toNative(v8::Handle<v8::Object>::Cast(message));
-        ASSERT(arrayBufferView);
-        result = webSocket->send(arrayBufferView, ec);
-    } else if (V8Blob::HasInstance(message)) {
-        Blob* blob = V8Blob::toNative(v8::Handle<v8::Object>::Cast(message));
-        ASSERT(blob);
-        result = webSocket->send(blob, ec);
-    } else {
-        v8::TryCatch tryCatch;
-        v8::Handle<v8::String> stringMessage = message->ToString();
-        if (tryCatch.HasCaught())
-            return throwError(tryCatch.Exception(), args.GetIsolate());
-        result = webSocket->send(toWebCoreString(stringMessage), ec);
-    }
-    if (ec)
-        return setDOMException(ec, args.GetIsolate());
-
-    return v8Boolean(result, args.GetIsolate());
-}
-
-}  // namespace WebCore
-
-#endif  // ENABLE(WEB_SOCKETS)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to