Changeset 210910 in webkit


Ignore:
Timestamp:
Jan 18, 2017 9:06:10 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: console.table only works for the first 5 properties
https://bugs.webkit.org/show_bug.cgi?id=167175

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2017-01-18
Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

  • inspector/InjectedScriptSource.js:

(InjectedScript.prototype.wrapTable):
(InjectedScript.RemoteObject.createObjectPreviewForValue):
(InjectedScript.RemoteObject.prototype._appendPropertyPreviews):
Pass through secondLevelKeys. Though the keys are themselves ignored, the
existence is a signal that we should send more than the first 5 properties.

Source/WebInspectorUI:

  • UserInterface/Views/ConsoleMessageView.js:

(WebInspector.ConsoleMessageView.prototype._formatParameterAsTable):
Allow a max of 15 columns instead of 10.

LayoutTests:

  • inspector/console/console-table-expected.txt:
  • inspector/console/console-table.html:

Include a test that we get values beyond the first 5 properties.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r210903 r210910  
     12017-01-18  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: console.table only works for the first 5 properties
     4        https://bugs.webkit.org/show_bug.cgi?id=167175
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        * inspector/console/console-table-expected.txt:
     9        * inspector/console/console-table.html:
     10        Include a test that we get values beyond the first 5 properties.
     11
    1122017-01-18  Ryan Haddad  <ryanhaddad@apple.com>
    213
  • trunk/LayoutTests/inspector/console/console-table-expected.txt

    r208009 r210910  
    66CONSOLE MESSAGE: line 3: [object Object],[object Object],[object Object]
    77CONSOLE MESSAGE: line 3: [object Object],[object Object],[object Object]
     8CONSOLE MESSAGE: line 3: [object Object],[object Object]
    89
    910STEP: console.table([])
     
    525526}
    526527
     528STEP: console.table([manyProperties, manyProperties], ['five', 'six'])
     529{
     530  "_source": "console-api",
     531  "_level": "log",
     532  "_messageText": "[object Object],[object Object]",
     533  "_type": "table",
     534  "_url": null,
     535  "_line": 3,
     536  "_column": 14,
     537  "_repeatCount": 1,
     538  "_parameters": [
     539    {
     540      "_type": "object",
     541      "_subtype": "array",
     542      "_objectId": "<filtered>",
     543      "_description": "Array",
     544      "_hasChildren": true,
     545      "_size": 2,
     546      "_preview": {
     547        "_type": "object",
     548        "_subtype": "array",
     549        "_description": "Array",
     550        "_lossless": true,
     551        "_overflow": false,
     552        "_size": 2,
     553        "_properties": [
     554          {
     555            "_name": "0",
     556            "_type": "object",
     557            "_valuePreview": {
     558              "_type": "object",
     559              "_description": "Object",
     560              "_lossless": true,
     561              "_overflow": false,
     562              "_properties": [
     563                {
     564                  "_name": "one",
     565                  "_type": "number",
     566                  "_value": "1"
     567                },
     568                {
     569                  "_name": "two",
     570                  "_type": "number",
     571                  "_value": "2"
     572                },
     573                {
     574                  "_name": "three",
     575                  "_type": "number",
     576                  "_value": "3"
     577                },
     578                {
     579                  "_name": "four",
     580                  "_type": "number",
     581                  "_value": "4"
     582                },
     583                {
     584                  "_name": "five",
     585                  "_type": "number",
     586                  "_value": "5"
     587                },
     588                {
     589                  "_name": "six",
     590                  "_type": "number",
     591                  "_value": "6"
     592                }
     593              ],
     594              "_entries": null
     595            }
     596          },
     597          {
     598            "_name": "1",
     599            "_type": "object",
     600            "_valuePreview": {
     601              "_type": "object",
     602              "_description": "Object",
     603              "_lossless": true,
     604              "_overflow": false,
     605              "_properties": [
     606                {
     607                  "_name": "one",
     608                  "_type": "number",
     609                  "_value": "1"
     610                },
     611                {
     612                  "_name": "two",
     613                  "_type": "number",
     614                  "_value": "2"
     615                },
     616                {
     617                  "_name": "three",
     618                  "_type": "number",
     619                  "_value": "3"
     620                },
     621                {
     622                  "_name": "four",
     623                  "_type": "number",
     624                  "_value": "4"
     625                },
     626                {
     627                  "_name": "five",
     628                  "_type": "number",
     629                  "_value": "5"
     630                },
     631                {
     632                  "_name": "six",
     633                  "_type": "number",
     634                  "_value": "6"
     635                }
     636              ],
     637              "_entries": null
     638            }
     639          }
     640        ],
     641        "_entries": null
     642      }
     643    },
     644    {
     645      "_type": "object",
     646      "_subtype": "array",
     647      "_objectId": "<filtered>",
     648      "_description": "Array",
     649      "_hasChildren": true,
     650      "_size": 2,
     651      "_preview": {
     652        "_type": "object",
     653        "_subtype": "array",
     654        "_description": "Array",
     655        "_lossless": true,
     656        "_overflow": false,
     657        "_size": 2,
     658        "_properties": [
     659          {
     660            "_name": "0",
     661            "_type": "string",
     662            "_value": "five"
     663          },
     664          {
     665            "_name": "1",
     666            "_type": "string",
     667            "_value": "six"
     668          }
     669        ],
     670        "_entries": null
     671      }
     672    }
     673  ],
     674  "_stackTrace": "<filtered>",
     675  "_request": null
     676}
     677
  • trunk/LayoutTests/inspector/console/console-table.html

    r208009 r210910  
    1313var jane = new Person("Jane", "Doe");
    1414var emily = new Person("Emily", "Jones");
     15var manyProperties = {one:1, two:2, three:3, four:4, five:5, six:6};
    1516
    1617function test()
     
    2526        "console.table([john, jane, emily])", // Index, firstName, lastName
    2627        "console.table([john, jane, emily], ['firstName'])", // Index, firstName (at least).
     28        `console.table([manyProperties, manyProperties], ['five', 'six'])`, // Index, five, size (at least)
    2729    ];
    2830
     
    5153</script>
    5254</head>
    53 <body onload="runTest();">
     55<body onload="runTest()">
    5456</body>
    5557</html>
  • trunk/Source/JavaScriptCore/ChangeLog

    r210891 r210910  
     12017-01-18  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: console.table only works for the first 5 properties
     4        https://bugs.webkit.org/show_bug.cgi?id=167175
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        * inspector/InjectedScriptSource.js:
     9        (InjectedScript.prototype.wrapTable):
     10        (InjectedScript.RemoteObject.createObjectPreviewForValue):
     11        (InjectedScript.RemoteObject.prototype._appendPropertyPreviews):
     12        Pass through secondLevelKeys. Though the keys are themselves ignored, the
     13        existence is a signal that we should send more than the first 5 properties.
     14
    1152017-01-18  Antti Koivisto  <antti@apple.com>
    216
  • trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js

    r209958 r210910  
    164164        // FIXME: Currently columns are ignored. Instead, the frontend filters all
    165165        // properties based on the provided column names and in the provided order.
    166         // Should we filter here too?
     166        // We could filter here to avoid sending very large preview objects.
    167167
    168168        var columnNames = null;
     
    972972};
    973973
    974 InjectedScript.RemoteObject.createObjectPreviewForValue = function(value, generatePreview)
     974InjectedScript.RemoteObject.createObjectPreviewForValue = function(value, generatePreview, columnNames)
    975975{
    976     var remoteObject = new InjectedScript.RemoteObject(value, undefined, false, generatePreview, undefined);
     976    var remoteObject = new InjectedScript.RemoteObject(value, undefined, false, generatePreview, columnNames);
    977977    if (remoteObject.objectId)
    978978        injectedScript.releaseObject(remoteObject.objectId);
     
    11561156            if ((secondLevelKeys === null || secondLevelKeys) || this._isPreviewableObject(value, object)) {
    11571157                // FIXME: If we want secondLevelKeys filter to continue we would need some refactoring.
    1158                 var subPreview = InjectedScript.RemoteObject.createObjectPreviewForValue(value, value !== object);
     1158                var subPreview = InjectedScript.RemoteObject.createObjectPreviewForValue(value, value !== object, secondLevelKeys);
    11591159                property.valuePreview = subPreview;
    11601160                if (!subPreview.lossless)
  • trunk/Source/WebInspectorUI/ChangeLog

    r210793 r210910  
     12017-01-18  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: console.table only works for the first 5 properties
     4        https://bugs.webkit.org/show_bug.cgi?id=167175
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        * UserInterface/Views/ConsoleMessageView.js:
     9        (WebInspector.ConsoleMessageView.prototype._formatParameterAsTable):
     10        Allow a max of 15 columns instead of 10.
     11
    1122017-01-16  Devin Rousso  <dcrousso+webkit@gmail.com>
    213
  • trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js

    r208304 r210910  
    760760
    761761                var rowValue = {};
    762                 var maxColumnsToRender = 10;
     762                var maxColumnsToRender = 15;
    763763                for (var j = 0; j < rowPreview.propertyPreviews.length; ++j) {
    764764                    var cellProperty = rowPreview.propertyPreviews[j];
Note: See TracChangeset for help on using the changeset viewer.