Title: [96030] trunk
Revision
96030
Author
[email protected]
Date
2011-09-26 16:21:42 -0700 (Mon, 26 Sep 2011)

Log Message

Set but unused variables cleanup in v8 bindings (gcc 4.6)
https://bugs.webkit.org/show_bug.cgi?id=68079

Patch by Max Perepelitsyn <[email protected]> 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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (96029 => 96030)


--- trunk/LayoutTests/ChangeLog	2011-09-26 23:20:47 UTC (rev 96029)
+++ trunk/LayoutTests/ChangeLog	2011-09-26 23:21:42 UTC (rev 96030)
@@ -1,3 +1,13 @@
+2011-09-26  Max Perepelitsyn  <[email protected]>
+
+        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  <[email protected]>
 
         switch the initial value of flex-order to 0

Added: trunk/LayoutTests/http/tests/websocket/tests/hybi/send-object-tostring-check-expected.txt (0 => 96030)


--- trunk/LayoutTests/http/tests/websocket/tests/hybi/send-object-tostring-check-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/send-object-tostring-check-expected.txt	2011-09-26 23:21:42 UTC (rev 96030)
@@ -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
+

Added: trunk/LayoutTests/http/tests/websocket/tests/hybi/send-object-tostring-check.html (0 => 96030)


--- trunk/LayoutTests/http/tests/websocket/tests/hybi/send-object-tostring-check.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/send-object-tostring-check.html	2011-09-26 23:21:42 UTC (rev 96030)
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</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 = ""
+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=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (96029 => 96030)


--- trunk/Source/WebCore/ChangeLog	2011-09-26 23:20:47 UTC (rev 96029)
+++ trunk/Source/WebCore/ChangeLog	2011-09-26 23:21:42 UTC (rev 96030)
@@ -1,3 +1,24 @@
+2011-09-26  Max Perepelitsyn  <[email protected]>
+
+        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  <[email protected]>
 
         switch the initial value of flex-order to 0

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (96029 => 96030)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2011-09-26 23:20:47 UTC (rev 96029)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2011-09-26 23:21:42 UTC (rev 96030)
@@ -2194,10 +2194,13 @@
     } else {
         push(@implContent, <<END);
         0, 0);
+END
+    }
+    
+    AddToImplIncludes("wtf/UnusedParam.h");
+    push(@implContent, <<END);
     UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
 END
-        AddToImplIncludes("wtf/UnusedParam.h");
-    }
 
     if ($dataNode->extendedAttributes->{"CanBeConstructed"} || $dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"Constructer"}) {
         push(@implContent, <<END);
@@ -2209,6 +2212,8 @@
         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
     }
 

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp (96029 => 96030)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp	2011-09-26 23:20:47 UTC (rev 96029)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp	2011-09-26 23:21:42 UTC (rev 96030)
@@ -30,6 +30,7 @@
 #include "V8DOMWrapper.h"
 #include "V8IsolatedContext.h"
 #include "V8Proxy.h"
+#include <wtf/UnusedParam.h>
 
 namespace WebCore {
 
@@ -61,8 +62,11 @@
     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

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp (96029 => 96030)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp	2011-09-26 23:20:47 UTC (rev 96029)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp	2011-09-26 23:21:42 UTC (rev 96030)
@@ -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 @@
     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 =\

Modified: trunk/Source/WebCore/bindings/v8/WorkerScriptDebugServer.cpp (96029 => 96030)


--- trunk/Source/WebCore/bindings/v8/WorkerScriptDebugServer.cpp	2011-09-26 23:20:47 UTC (rev 96029)
+++ trunk/Source/WebCore/bindings/v8/WorkerScriptDebugServer.cpp	2011-09-26 23:21:42 UTC (rev 96030)
@@ -87,10 +87,10 @@
     }
     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>() };

Modified: trunk/Source/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp (96029 => 96030)


--- trunk/Source/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp	2011-09-26 23:20:47 UTC (rev 96029)
+++ trunk/Source/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp	2011-09-26 23:21:42 UTC (rev 96030)
@@ -109,7 +109,7 @@
             newLength = static_cast<unsigned>(v);
     }
     if (!ec)
-        imp->setLength(value->Uint32Value(), ec);
+        imp->setLength(newLength, ec);
 
     V8Proxy::setDOMException(ec);
 }

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


--- trunk/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp	2011-09-26 23:20:47 UTC (rev 96029)
+++ trunk/Source/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp	2011-09-26 23:21:42 UTC (rev 96030)
@@ -137,7 +137,7 @@
         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);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to