Changeset 125284 in webkit


Ignore:
Timestamp:
Aug 10, 2012 8:42:23 AM (12 years ago)
Author:
pfeldman@chromium.org
Message:

Web Inspector: render arrays as dir in case they were logged into console prior to the front-end opening.
https://bugs.webkit.org/show_bug.cgi?id=93713

Reviewed by Vsevolod Vlasov.

Source/WebCore:

Dumping potentially outdated arrays using the "dir" representation.

  • inspector/front-end/ConsoleMessage.js:

(WebInspector.ConsoleMessageImpl):
(WebInspector.ConsoleMessageImpl.prototype._formatParameterAsArray):
(WebInspector.ConsoleMessageImpl.prototype.clone):

  • inspector/front-end/ConsoleModel.js:

(WebInspector.ConsoleModel.prototype.enableAgent.callback):
(WebInspector.ConsoleModel.prototype.enablingConsole):
(WebInspector.ConsoleMessage.create):
(WebInspector.ConsoleDispatcher.prototype.messageAdded):

  • inspector/front-end/ConsoleView.js:

(WebInspector.ConsoleMessage.create):

LayoutTests:

  • inspector/console/console-dirxml-expected.txt:
  • inspector/console/console-external-array-expected.txt:
  • inspector/console/console-format-collections-expected.txt:
  • inspector/console/console-format-expected.txt:
  • inspector/console/console-format.html:
  • inspector/console/console-tests-expected.txt:
  • platform/chromium/inspector/console/console-format-collections-expected.txt:
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r125280 r125284  
     12012-08-10  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Web Inspector: render arrays as dir in case they were logged into console prior to the front-end opening.
     4        https://bugs.webkit.org/show_bug.cgi?id=93713
     5
     6        Reviewed by Vsevolod Vlasov.
     7
     8        * inspector/console/console-dirxml-expected.txt:
     9        * inspector/console/console-external-array-expected.txt:
     10        * inspector/console/console-format-collections-expected.txt:
     11        * inspector/console/console-format-expected.txt:
     12        * inspector/console/console-format.html:
     13        * inspector/console/console-tests-expected.txt:
     14        * platform/chromium/inspector/console/console-format-collections-expected.txt:
     15
    1162012-08-10  Jon Lee  <jonlee@apple.com>
    217
  • trunk/LayoutTests/inspector/console/console-dirxml-expected.txt

    r110693 r125284  
    88#document-fragment console-dirxml.html:13
    99<p></p> console-dirxml.html:14
    10 [<p></p>] console-dirxml.html:15
     10Array[1] console-dirxml.html:15
    1111
  • trunk/LayoutTests/inspector/console/console-external-array-expected.txt

    r111388 r125284  
    1717Tests that console logging detects external arrays as arrays.
    1818
    19 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] console-external-array.html:9
    20 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] console-external-array.html:10
    21 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] console-external-array.html:11
    22 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] console-external-array.html:12
    23 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] console-external-array.html:13
    24 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] console-external-array.html:14
    25 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] console-external-array.html:15
    26 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] console-external-array.html:16
     19Int8Array[10] console-external-array.html:9
     20Int16Array[10] console-external-array.html:10
     21Int32Array[10] console-external-array.html:11
     22Uint8Array[10] console-external-array.html:12
     23Uint16Array[10] console-external-array.html:13
     24Uint32Array[10] console-external-array.html:14
     25Float32Array[10] console-external-array.html:15
     26Float64Array[10] console-external-array.html:16
    2727Int8Array[10] console-external-array.html:18
    2828Int16Array[10] console-external-array.html:19
  • trunk/LayoutTests/inspector/console/console-format-collections-expected.txt

    r125174 r125284  
    1919Tests that console nicely formats HTML Collections and NodeLists.
    2020
    21 [<select id="sel" name="sel">…</select>] console-format-collections.html:15
    22 [<script src="../../http/tests/inspector/inspector-test.js"></script>, <script src="../../http/tests/inspector/console-test.js"></script>, <script>…</script>] console-format-collections.html:19
    23 [<option value="1">one</option>, <option value="2">two</option>] console-format-collections.html:23
    24 [<html>…</html>, <head>…</head>, <script src="../../http/tests/inspector/inspector-test.js"></script>, <script src="../../http/tests/inspector/console-test.js"></script>, <script>…</script>, <body onload="onload()">…</body>, <p>
    25 Tests that console nicely formats HTML Collections and NodeLists.
    26 </p>, <div style="display:none">…</div>, <form id="f">…</form>, <select id="sel" name="sel">…</select>, <option value="1">one</option>, <option value="2">two</option>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">] console-format-collections.html:27
    27 [<select id="sel" name="sel">…</select>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">] console-format-collections.html:31
    28 [<input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">] console-format-collections.html:35
    29 [1, Array[2]] console-format-collections.html:41
     21NodeList[1] console-format-collections.html:15
     22HTMLCollection[3] console-format-collections.html:19
     23HTMLOptionsCollection[2] console-format-collections.html:23
     24HTMLAllCollection[14] console-format-collections.html:27
     25HTMLCollection[3] console-format-collections.html:31
     26NodeList[2] console-format-collections.html:35
     27Array[2] console-format-collections.html:41
    3028NonArrayWithLength console-format-collections.html:44
    31 [1, "2"] console-format-collections.html:51
     29Arguments[2] console-format-collections.html:51
    3230[<select>] console-format-collections.html:15
    3331 console-format-collections.html:19
  • trunk/LayoutTests/inspector/console/console-format-expected.txt

    r125186 r125284  
    4747CONSOLE MESSAGE: line 54: -Infinity
    4848CONSOLE MESSAGE: line 55: -Infinity
     49CONSOLE MESSAGE: line 54: test,test2,,,test4,,,,,
     50CONSOLE MESSAGE: line 55: test,test2,,,test4,,,,,
    4951Tests that console logging dumps proper messages.
    5052
     
    5254Message format for string console-format.html:13
    5355Object Object console-format.html:14
    54 ["test", "test2", undefined × 2, "test4", undefined × 5] console-format.html:20
    55 ["test", "test2", undefined × 2, "test4", undefined × 5] console-format.html:21
     56Array[10] console-format.html:20
     57Array[10] console-format.html:21
    5658Array[10] console-format.html:22
    5759/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i console-format.html:54
     
    137139globals[18]
    138140-Infinity
     141["test", "test2", 4: "test4", foo: Object] console-format.html:54
     142[Array[10]] console-format.html:55
     143globals[19]
     144["test", "test2", undefined × 2, "test4", undefined × 5]
    139145
  • trunk/LayoutTests/inspector/console/console-format.html

    r125174 r125284  
    4444        regex1, regex2, str, str2, error, node, func, multilinefunc, num, linkify,
    4545        null, undefined, valuelessAttribute, valuedAttribute, existingAttribute, throwingLengthGetter,
    46         NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY
     46        NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, array
    4747    ];
    4848
  • trunk/LayoutTests/inspector/console/console-tests-expected.txt

    r110693 r125284  
    4242function () { } console-tests.html:28 console-message console-log-level
    4343function f() { } console-tests.html:29 console-message console-log-level
    44 [1, 2, 3] console-tests.html:30 console-message console-log-level
     44Array[3] console-tests.html:30 console-message console-log-level
    4545/regexp.*/ console-tests.html:31 console-message console-log-level
    4646
  • trunk/LayoutTests/platform/chromium/inspector/console/console-format-collections-expected.txt

    r125174 r125284  
    1919Tests that console nicely formats HTML Collections and NodeLists.
    2020
    21 [<select id="sel" name="sel">…</select>] console-format-collections.html:15
    22 [<script src="../../http/tests/inspector/inspector-test.js"></script>, <script src="../../http/tests/inspector/console-test.js"></script>, <script>…</script>] console-format-collections.html:19
    23 [<option value="1">one</option>, <option value="2">two</option>] console-format-collections.html:23
    24 [<html>…</html>, <head>…</head>, <script src="../../http/tests/inspector/inspector-test.js"></script>, <script src="../../http/tests/inspector/console-test.js"></script>, <script>…</script>, <body onload="onload()">…</body>, <p>
    25 Tests that console nicely formats HTML Collections and NodeLists.
    26 </p>, <div style="display:none">…</div>, <form id="f">…</form>, <select id="sel" name="sel">…</select>, <option value="1">one</option>, <option value="2">two</option>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">] console-format-collections.html:27
    27 [<select id="sel" name="sel">…</select>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">] console-format-collections.html:31
    28 [<input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">] console-format-collections.html:35
    29 [1, Array[2]] console-format-collections.html:41
     21NodeList[1] console-format-collections.html:15
     22HTMLCollection[3] console-format-collections.html:19
     23HTMLOptionsCollection[2] console-format-collections.html:23
     24HTMLAllCollection[14] console-format-collections.html:27
     25HTMLCollection[3] console-format-collections.html:31
     26NodeList[2] console-format-collections.html:35
     27Array[2] console-format-collections.html:41
    3028NonArrayWithLength console-format-collections.html:44
    31 [1, "2"] console-format-collections.html:51
     29Arguments[2] console-format-collections.html:51
    3230[<select>] console-format-collections.html:15
    3331[<script>, <script>, <script>] console-format-collections.html:19
  • trunk/Source/WebCore/ChangeLog

    r125283 r125284  
     12012-08-10  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Web Inspector: render arrays as dir in case they were logged into console prior to the front-end opening.
     4        https://bugs.webkit.org/show_bug.cgi?id=93713
     5
     6        Reviewed by Vsevolod Vlasov.
     7
     8        Dumping potentially outdated arrays using the "dir" representation.
     9
     10        * inspector/front-end/ConsoleMessage.js:
     11        (WebInspector.ConsoleMessageImpl):
     12        (WebInspector.ConsoleMessageImpl.prototype._formatParameterAsArray):
     13        (WebInspector.ConsoleMessageImpl.prototype.clone):
     14        * inspector/front-end/ConsoleModel.js:
     15        (WebInspector.ConsoleModel.prototype.enableAgent.callback):
     16        (WebInspector.ConsoleModel.prototype.enablingConsole):
     17        (WebInspector.ConsoleMessage.create):
     18        (WebInspector.ConsoleDispatcher.prototype.messageAdded):
     19        * inspector/front-end/ConsoleView.js:
     20        (WebInspector.ConsoleMessage.create):
     21
    1222012-08-10  Dana Jansens  <danakj@chromium.org>
    223
  • trunk/Source/WebCore/inspector/front-end/ConsoleMessage.js

    r125174 r125284  
    4444 * @param {ConsoleAgent.StackTrace=} stackTrace
    4545 * @param {WebInspector.NetworkRequest=} request
     46 * @param {boolean=} isOutdated
    4647 */
    47 WebInspector.ConsoleMessageImpl = function(source, level, message, linkifier, type, url, line, repeatCount, parameters, stackTrace, request)
     48WebInspector.ConsoleMessageImpl = function(source, level, message, linkifier, type, url, line, repeatCount, parameters, stackTrace, request, isOutdated)
    4849{
    4950    WebInspector.ConsoleMessage.call(this, source, level, url, line, repeatCount);
     
    5556    this._stackTrace = stackTrace;
    5657    this._request = request;
     58    this._isOutdated = isOutdated;
    5759
    5860    this._customFormatters = {
     
    362364
    363365        const maxFlatArrayLength = 100;
    364         if (array.arrayLength() > maxFlatArrayLength)
     366        if (this._isOutdated || array.arrayLength() > maxFlatArrayLength)
    365367            this._formatParameterAsObject(array, elem, false);
    366368        else
     
    714716    clone: function()
    715717    {
    716         return WebInspector.ConsoleMessage.create(this.source, this.level, this._messageText, this.type, this.url, this.line, this.repeatCount, this._parameters, this._stackTrace, this._request);
     718        return WebInspector.ConsoleMessage.create(this.source, this.level, this._messageText, this.type, this.url, this.line, this.repeatCount, this._parameters, this._stackTrace, this._request, this._isOutdated);
    717719    }
    718720}
  • trunk/Source/WebCore/inspector/front-end/ConsoleModel.js

    r113863 r125284  
    5454            ConsoleAgent.setMonitoringXHREnabled(true);
    5555
    56         ConsoleAgent.enable();
     56        this._enablingConsole = true;
     57        function callback()
     58        {
     59            delete this._enablingConsole;
     60        }
     61        ConsoleAgent.enable(callback.bind(this));
     62    },
     63
     64    /**
     65     * @return {boolean}
     66     */
     67    enablingConsole: function()
     68    {
     69        return !!this._enablingConsole;
    5770    },
    5871
     
    191204 * @param {ConsoleAgent.StackTrace=} stackTrace
    192205 * @param {WebInspector.NetworkRequest=} request
    193  *
     206 * @param {boolean=} isOutdated
    194207 * @return {WebInspector.ConsoleMessage}
    195208 */
    196 WebInspector.ConsoleMessage.create = function(source, level, message, type, url, line, repeatCount, parameters, stackTrace, request)
     209WebInspector.ConsoleMessage.create = function(source, level, message, type, url, line, repeatCount, parameters, stackTrace, request, isOutdated)
    197210{
    198211}
     
    255268            payload.parameters,
    256269            payload.stackTrace,
    257             payload.networkRequestId ? WebInspector.networkRequestById(payload.networkRequestId) : undefined);
     270            payload.networkRequestId ? WebInspector.networkRequestById(payload.networkRequestId) : undefined,
     271            this._console._enablingConsole);
    258272        this._console.addMessage(consoleMessage);
    259273    },
  • trunk/Source/WebCore/inspector/front-end/ConsoleView.js

    r124867 r125284  
    955955WebInspector.consoleView = null;
    956956
    957 WebInspector.ConsoleMessage.create = function(source, level, message, type, url, line, repeatCount, parameters, stackTrace, request)
     957WebInspector.ConsoleMessage.create = function(source, level, message, type, url, line, repeatCount, parameters, stackTrace, request, isOutdated)
    958958{
    959     return new WebInspector.ConsoleMessageImpl(source, level, message, WebInspector.consoleView._linkifier, type, url, line, repeatCount, parameters, stackTrace, request);
     959    return new WebInspector.ConsoleMessageImpl(source, level, message, WebInspector.consoleView._linkifier, type, url, line, repeatCount, parameters, stackTrace, request, isOutdated);
    960960}
Note: See TracChangeset for help on using the changeset viewer.