Changeset 129122 in webkit


Ignore:
Timestamp:
Sep 20, 2012 5:44:51 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Andrey Adaikin <aandrey@chromium.org> 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:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r129120 r129122  
     12012-09-20  Andrey Adaikin  <aandrey@chromium.org>
     2
     3        Web Inspector: setPropertyValue does not work for non-finite numbers
     4        https://bugs.webkit.org/show_bug.cgi?id=97016
     5
     6        Reviewed by Vsevolod Vlasov.
     7
     8        Expands the test with non-finite numbers case.
     9
     10        * inspector/runtime/runtime-setPropertyValue-expected.txt:
     11        * inspector/runtime/runtime-setPropertyValue.html:
     12
    1132012-09-20  Marcelo Lira  <marcelo.lira@openbossa.org>
    214
  • trunk/LayoutTests/inspector/runtime/runtime-setPropertyValue-expected.txt

    r103711 r129122  
    2323CONSOLE MESSAGE: line 12: {"foo":""}
    2424CONSOLE MESSAGE: line 13:
     25CONSOLE MESSAGE: line 11: ===== Set non-finite numbers =====
     26CONSOLE MESSAGE: line 12: {"foo":"NaN","foo1":"Infinity","foo2":"-Infinity"}
     27CONSOLE MESSAGE: line 13:
    2528Tests WebInspector.RemoveObject.setPropertyValue implementation.
    2629
     
    4346exception
    4447
     48Running: testSetNonFiniteNumbers
     49
  • trunk/LayoutTests/inspector/runtime/runtime-setPropertyValue.html

    r103711 r129122  
    1010{
    1111    console.log("===== " + label + " =====");
    12     console.log(JSON.stringify(object1));
     12    console.log(JSON.stringify(object1, replacer));
    1313    console.log("");
     14
     15    function replacer(key, value)
     16    {
     17        if (typeof value === "number" && !isFinite(value))
     18            return String(value);
     19        return value;
     20    }
    1421}
    1522
     
    110117                InspectorTest.evaluateInPage("dumpObject('Set exception')", next);
    111118            }
     119        },
     120
     121        function testSetNonFiniteNumbers(next)
     122        {
     123            obj1.setPropertyValue("foo", "NaN", step1);
     124
     125            function step1(error)
     126            {
     127                obj1.setPropertyValue("foo1", "Infinity", step2);
     128            }
     129
     130            function step2(error)
     131            {
     132                obj1.setPropertyValue("foo2", "-Infinity", step3);
     133            }
     134
     135            function step3(error)
     136            {
     137                InspectorTest.evaluateInPage("dumpObject('Set non-finite numbers')", next);
     138            }
    112139        }
    113140    ]);
  • trunk/Source/WebCore/ChangeLog

    r129118 r129122  
     12012-09-20  Andrey Adaikin  <aandrey@chromium.org>
     2
     3        Web Inspector: setPropertyValue does not work for non-finite numbers
     4        https://bugs.webkit.org/show_bug.cgi?id=97016
     5
     6        Reviewed by Vsevolod Vlasov.
     7
     8        Fix: setting a property to NaN, Infinity or -Infinity numbers did not work.
     9
     10        * inspector/front-end/RemoteObject.js:
     11        (WebInspector.RemoteObject.prototype.setPropertyValue):
     12
    1132012-09-20  Otto Derek Cheung  <otcheung@rim.com>
    214
  • trunk/Source/WebCore/inspector/front-end/RemoteObject.js

    r125174 r129122  
    242242            }
    243243
    244             function setPropertyValue(propertyName, propertyValue)
    245             {
    246                 this[propertyName] = propertyValue;
    247             }
     244            var setPropertyValueFunction = "function(a, b) { this[a] = b; }";
     245
     246            // Special case for NaN, Infinity and -Infinity
     247            if (result.type === "number" && typeof result.value !== "number")
     248                setPropertyValueFunction = "function(a) { this[a] = " + result.description + "; }";
    248249
    249250            delete result.description; // Optimize on traffic.
    250             RuntimeAgent.callFunctionOn(this._objectId, setPropertyValue.toString(), [{ value:name }, result], true, undefined, propertySetCallback.bind(this));
     251            RuntimeAgent.callFunctionOn(this._objectId, setPropertyValueFunction, [{ value:name }, result], true, undefined, propertySetCallback.bind(this));
    251252            if (result._objectId)
    252253                RuntimeAgent.releaseObject(result._objectId);
Note: See TracChangeset for help on using the changeset viewer.