Title: [129122] trunk
Revision
129122
Author
[email protected]
Date
2012-09-20 05:44:51 -0700 (Thu, 20 Sep 2012)

Log Message

Web Inspector: setPropertyValue does not work for non-finite numbers
https://bugs.webkit.org/show_bug.cgi?id=97016

Patch by Andrey Adaikin <[email protected]> on 2012-09-20
Reviewed by Vsevolod Vlasov.

Source/WebCore:

Fix: setting a property to NaN, Infinity or -Infinity numbers did not work.

* inspector/front-end/RemoteObject.js:
(WebInspector.RemoteObject.prototype.setPropertyValue):

LayoutTests:

Expands the test with non-finite numbers case.

* inspector/runtime/runtime-setPropertyValue-expected.txt:
* inspector/runtime/runtime-setPropertyValue.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (129121 => 129122)


--- trunk/LayoutTests/ChangeLog	2012-09-20 12:09:08 UTC (rev 129121)
+++ trunk/LayoutTests/ChangeLog	2012-09-20 12:44:51 UTC (rev 129122)
@@ -1,3 +1,15 @@
+2012-09-20  Andrey Adaikin  <[email protected]>
+
+        Web Inspector: setPropertyValue does not work for non-finite numbers
+        https://bugs.webkit.org/show_bug.cgi?id=97016
+
+        Reviewed by Vsevolod Vlasov.
+
+        Expands the test with non-finite numbers case.
+
+        * inspector/runtime/runtime-setPropertyValue-expected.txt:
+        * inspector/runtime/runtime-setPropertyValue.html:
+
 2012-09-20  Marcelo Lira  <[email protected]>
 
         [Qt] [WK1] Spaces missing in output of fast/forms/mailto/advanced-{get,put}.html

Modified: trunk/LayoutTests/inspector/runtime/runtime-setPropertyValue-expected.txt (129121 => 129122)


--- trunk/LayoutTests/inspector/runtime/runtime-setPropertyValue-expected.txt	2012-09-20 12:09:08 UTC (rev 129121)
+++ trunk/LayoutTests/inspector/runtime/runtime-setPropertyValue-expected.txt	2012-09-20 12:44:51 UTC (rev 129122)
@@ -22,6 +22,9 @@
 CONSOLE MESSAGE: line 11: ===== Set exception =====
 CONSOLE MESSAGE: line 12: {"foo":""}
 CONSOLE MESSAGE: line 13: 
+CONSOLE MESSAGE: line 11: ===== Set non-finite numbers =====
+CONSOLE MESSAGE: line 12: {"foo":"NaN","foo1":"Infinity","foo2":"-Infinity"}
+CONSOLE MESSAGE: line 13: 
 Tests WebInspector.RemoveObject.setPropertyValue implementation.
 
 
@@ -42,3 +45,5 @@
 Running: testSetException
 exception
 
+Running: testSetNonFiniteNumbers
+

Modified: trunk/LayoutTests/inspector/runtime/runtime-setPropertyValue.html (129121 => 129122)


--- trunk/LayoutTests/inspector/runtime/runtime-setPropertyValue.html	2012-09-20 12:09:08 UTC (rev 129121)
+++ trunk/LayoutTests/inspector/runtime/runtime-setPropertyValue.html	2012-09-20 12:44:51 UTC (rev 129122)
@@ -9,8 +9,15 @@
 function dumpObject(label)
 {
     console.log("===== " + label + " =====");
-    console.log(JSON.stringify(object1));
+    console.log(JSON.stringify(object1, replacer));
     console.log("");
+
+    function replacer(key, value)
+    {
+        if (typeof value === "number" && !isFinite(value))
+            return String(value);
+        return value;
+    }
 }
 
 function test()
@@ -109,6 +116,26 @@
                 InspectorTest.addResult(error);
                 InspectorTest.evaluateInPage("dumpObject('Set exception')", next);
             }
+        },
+
+        function testSetNonFiniteNumbers(next)
+        {
+            obj1.setPropertyValue("foo", "NaN", step1);
+
+            function step1(error)
+            {
+                obj1.setPropertyValue("foo1", "Infinity", step2);
+            }
+
+            function step2(error)
+            {
+                obj1.setPropertyValue("foo2", "-Infinity", step3);
+            }
+
+            function step3(error)
+            {
+                InspectorTest.evaluateInPage("dumpObject('Set non-finite numbers')", next);
+            }
         }
     ]);
 }

Modified: trunk/Source/WebCore/ChangeLog (129121 => 129122)


--- trunk/Source/WebCore/ChangeLog	2012-09-20 12:09:08 UTC (rev 129121)
+++ trunk/Source/WebCore/ChangeLog	2012-09-20 12:44:51 UTC (rev 129122)
@@ -1,3 +1,15 @@
+2012-09-20  Andrey Adaikin  <[email protected]>
+
+        Web Inspector: setPropertyValue does not work for non-finite numbers
+        https://bugs.webkit.org/show_bug.cgi?id=97016
+
+        Reviewed by Vsevolod Vlasov.
+
+        Fix: setting a property to NaN, Infinity or -Infinity numbers did not work.
+
+        * inspector/front-end/RemoteObject.js:
+        (WebInspector.RemoteObject.prototype.setPropertyValue):
+
 2012-09-20  Otto Derek Cheung  <[email protected]>
 
         Web Inspector: Cookie info in Network Resources Cookies tab are incorrect

Modified: trunk/Source/WebCore/inspector/front-end/RemoteObject.js (129121 => 129122)


--- trunk/Source/WebCore/inspector/front-end/RemoteObject.js	2012-09-20 12:09:08 UTC (rev 129121)
+++ trunk/Source/WebCore/inspector/front-end/RemoteObject.js	2012-09-20 12:44:51 UTC (rev 129122)
@@ -241,13 +241,14 @@
                 return;
             }
 
-            function setPropertyValue(propertyName, propertyValue)
-            {
-                this[propertyName] = propertyValue;
-            }
+            var setPropertyValueFunction = "function(a, b) { this[a] = b; }";
 
+            // Special case for NaN, Infinity and -Infinity
+            if (result.type === "number" && typeof result.value !== "number")
+                setPropertyValueFunction = "function(a) { this[a] = " + result.description + "; }";
+
             delete result.description; // Optimize on traffic.
-            RuntimeAgent.callFunctionOn(this._objectId, setPropertyValue.toString(), [{ value:name }, result], true, undefined, propertySetCallback.bind(this));
+            RuntimeAgent.callFunctionOn(this._objectId, setPropertyValueFunction, [{ value:name }, result], true, undefined, propertySetCallback.bind(this));
             if (result._objectId)
                 RuntimeAgent.releaseObject(result._objectId);
         }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to