Set but unused variables cleanup in v8 bindings (gcc 4.6)
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Sep 2011 23:21:42 +0000 (23:21 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Sep 2011 23:21:42 +0000 (23:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=68079

Patch by Max Perepelitsyn <pph34r@gmail.com> on 2011-09-26
Reviewed by Adam Barth.

Source/WebCore:

Test: http/tests/websocket/tests/hybi/send-object-tostring-check.html

* bindings/scripts/CodeGeneratorV8.pm:
* bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp:
(WebCore::ConfigureV8TestMediaQueryListListenerTemplate):
* bindings/scripts/test/V8/V8TestObj.cpp:
(WebCore::ConfigureV8TestObjTemplate):
* bindings/v8/WorkerScriptDebugServer.cpp:
(WebCore::WorkerScriptDebugServer::addListener):
* bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
(WebCore::V8HTMLOptionsCollection::lengthAccessorSetter):
* bindings/v8/custom/V8WebSocketCustom.cpp:
(WebCore::V8WebSocket::sendCallback):

LayoutTests:

* http/tests/websocket/tests/hybi/send-object-tostring-check-expected.txt: Added.
* http/tests/websocket/tests/hybi/send-object-tostring-check.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@96030 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/websocket/tests/hybi/send-object-tostring-check-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/send-object-tostring-check.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp
Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
Source/WebCore/bindings/v8/WorkerScriptDebugServer.cpp
Source/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp

index 1e0f636..5d6bd6a 100644 (file)
@@ -1,3 +1,13 @@
+2011-09-26  Max Perepelitsyn  <pph34r@gmail.com>
+
+        Set but unused variables cleanup in v8 bindings (gcc 4.6)
+        https://bugs.webkit.org/show_bug.cgi?id=68079
+
+        Reviewed by Adam Barth.
+
+        * http/tests/websocket/tests/hybi/send-object-tostring-check-expected.txt: Added.
+        * http/tests/websocket/tests/hybi/send-object-tostring-check.html: Added.
+
 2011-09-26  Tony Chang  <tony@chromium.org>
 
         switch the initial value of flex-order to 0
diff --git a/LayoutTests/http/tests/websocket/tests/hybi/send-object-tostring-check-expected.txt b/LayoutTests/http/tests/websocket/tests/hybi/send-object-tostring-check-expected.txt
new file mode 100644 (file)
index 0000000..6ef1c73
--- /dev/null
@@ -0,0 +1,10 @@
+WebSocket: Object's toString method should be called only once.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS testObj.callCounter is 1
+PASS closeEvent.wasClean is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/http/tests/websocket/tests/hybi/send-object-tostring-check.html b/LayoutTests/http/tests/websocket/tests/hybi/send-object-tostring-check.html
new file mode 100644 (file)
index 0000000..da03df2
--- /dev/null
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href="../../../../js-test-resources/js-test-style.css">
+<script src="../../../../js-test-resources/js-test-pre.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script type="text/javascript">
+description("WebSocket: Object's toString method should be called only once.");
+
+window.jsTestIsAsync = true;
+if (window.layoutTestController)
+    layoutTestController.overridePreference("WebKitHixie76WebSocketProtocolEnabled", 0);
+
+
+var testObj = new function() {
+    this.callCounter = 0;
+    this.toString = function() {
+        this.callCounter++;
+    };
+}
+
+var url = "ws://127.0.0.1:8880/";
+var ws = new WebSocket(url);
+var closeEvent;
+
+
+ws.onopen = function()
+{
+    ws.send(testObj);
+};
+
+ws.onclose = function(event)
+{
+    closeEvent = event;
+    shouldEvaluateTo("testObj.callCounter", 1);
+    shouldBeTrue("closeEvent.wasClean");
+    finishJSTest();
+};
+
+var successfullyParsed = true;
+</script>
+<script src="../../../../js-test-resources/js-test-post.js"></script>
+</body>
+</html>
index 63e0ee8..0ddde8d 100644 (file)
@@ -1,3 +1,24 @@
+2011-09-26  Max Perepelitsyn  <pph34r@gmail.com>
+
+        Set but unused variables cleanup in v8 bindings (gcc 4.6)
+        https://bugs.webkit.org/show_bug.cgi?id=68079
+
+        Reviewed by Adam Barth.
+
+        Test: http/tests/websocket/tests/hybi/send-object-tostring-check.html
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp:
+        (WebCore::ConfigureV8TestMediaQueryListListenerTemplate):
+        * bindings/scripts/test/V8/V8TestObj.cpp:
+        (WebCore::ConfigureV8TestObjTemplate):
+        * bindings/v8/WorkerScriptDebugServer.cpp:
+        (WebCore::WorkerScriptDebugServer::addListener):
+        * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
+        (WebCore::V8HTMLOptionsCollection::lengthAccessorSetter):
+        * bindings/v8/custom/V8WebSocketCustom.cpp:
+        (WebCore::V8WebSocket::sendCallback):
+
 2011-09-26  Tony Chang  <tony@chromium.org>
 
         switch the initial value of flex-order to 0
index 1c63bbc..1d07682 100644 (file)
@@ -2194,10 +2194,13 @@ END
     } else {
         push(@implContent, <<END);
         0, 0);
-    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
 END
-        AddToImplIncludes("wtf/UnusedParam.h");
     }
+    
+    AddToImplIncludes("wtf/UnusedParam.h");
+    push(@implContent, <<END);
+    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
+END
 
     if ($dataNode->extendedAttributes->{"CanBeConstructed"} || $dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"Constructer"}) {
         push(@implContent, <<END);
@@ -2209,6 +2212,8 @@ END
         push(@implContent,  <<END);
     v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
     v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
+    UNUSED_PARAM(instance); // In some cases, it will not be used.
+    UNUSED_PARAM(proto); // In some cases, it will not be used.
 END
     }
 
index 4eab22d..7f0aae1 100644 (file)
@@ -30,6 +30,7 @@
 #include "V8DOMWrapper.h"
 #include "V8IsolatedContext.h"
 #include "V8Proxy.h"
+#include <wtf/UnusedParam.h>
 
 namespace WebCore {
 
@@ -61,8 +62,11 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestMediaQueryListListene
     v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "TestMediaQueryListListener", v8::Persistent<v8::FunctionTemplate>(), V8TestMediaQueryListListener::internalFieldCount,
         0, 0,
         TestMediaQueryListListenerCallbacks, WTF_ARRAY_LENGTH(TestMediaQueryListListenerCallbacks));
+    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
     v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
     v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
+    UNUSED_PARAM(instance); // In some cases, it will not be used.
+    UNUSED_PARAM(proto); // In some cases, it will not be used.
     
 
     // Custom toString template
index 8dd6662..4a0bb94 100644 (file)
@@ -45,6 +45,7 @@
 #include <wtf/GetPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
+#include <wtf/UnusedParam.h>
 
 #if ENABLE(Condition1)
 #include "V8TestObjectA.h"
@@ -1408,8 +1409,11 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persi
     v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "TestObj", v8::Persistent<v8::FunctionTemplate>(), V8TestObj::internalFieldCount,
         TestObjAttrs, WTF_ARRAY_LENGTH(TestObjAttrs),
         TestObjCallbacks, WTF_ARRAY_LENGTH(TestObjCallbacks));
+    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
     v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
     v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
+    UNUSED_PARAM(instance); // In some cases, it will not be used.
+    UNUSED_PARAM(proto); // In some cases, it will not be used.
     
     if (RuntimeEnabledFeatures::enabledAtRuntimeAttr1Enabled()) {
         static const BatchedAttribute attrData =\
index 5fa0011..c0a5d9e 100755 (executable)
@@ -87,10 +87,10 @@ void WorkerScriptDebugServer::addListener(ScriptDebugListener* listener, WorkerC
     }
     m_listenersMap.set(workerContext, listener);
     
+    // TODO: Should we remove |proxy|? It looks like unused now.
     WorkerContextExecutionProxy* proxy = workerContext->script()->proxy();
     if (!proxy)
         return;
-    v8::Handle<v8::Context> context = proxy->context();
 
     v8::Handle<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("getWorkerScripts")));
     v8::Handle<v8::Value> argv[] = { v8::Handle<v8::Value>() };
index 81bc287..e320c84 100644 (file)
@@ -109,7 +109,7 @@ void V8HTMLOptionsCollection::lengthAccessorSetter(v8::Local<v8::String> name, v
             newLength = static_cast<unsigned>(v);
     }
     if (!ec)
-        imp->setLength(value->Uint32Value(), ec);
+        imp->setLength(newLength, ec);
 
     V8Proxy::setDOMException(ec);
 }
index 2ee116e..56645e0 100644 (file)
@@ -137,7 +137,7 @@ v8::Handle<v8::Value> V8WebSocket::sendCallback(const v8::Arguments& args)
         v8::Handle<v8::String> stringMessage = message->ToString();
         if (tryCatch.HasCaught())
             return throwError(tryCatch.Exception());
-        result = webSocket->send(toWebCoreString(message), ec);
+        result = webSocket->send(toWebCoreString(stringMessage), ec);
     }
     if (ec)
         return throwError(ec);