Title: [210910] trunk
Revision
210910
Author
[email protected]
Date
2017-01-18 21:06:10 -0800 (Wed, 18 Jan 2017)

Log 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 <[email protected]> on 2017-01-18
Reviewed by Timothy Hatcher.

Source/_javascript_Core:

* 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.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (210909 => 210910)


--- trunk/LayoutTests/ChangeLog	2017-01-19 03:19:37 UTC (rev 210909)
+++ trunk/LayoutTests/ChangeLog	2017-01-19 05:06:10 UTC (rev 210910)
@@ -1,3 +1,14 @@
+2017-01-18  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: console.table only works for the first 5 properties
+        https://bugs.webkit.org/show_bug.cgi?id=167175
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/console/console-table-expected.txt:
+        * inspector/console/console-table.html:
+        Include a test that we get values beyond the first 5 properties.
+
 2017-01-18  Ryan Haddad  <[email protected]>
 
         Moving flaky expectation for fast/images/animated-gif-restored-from-bfcache.html to mac TestExpectations file.

Modified: trunk/LayoutTests/inspector/console/console-table-expected.txt (210909 => 210910)


--- trunk/LayoutTests/inspector/console/console-table-expected.txt	2017-01-19 03:19:37 UTC (rev 210909)
+++ trunk/LayoutTests/inspector/console/console-table-expected.txt	2017-01-19 05:06:10 UTC (rev 210910)
@@ -5,6 +5,7 @@
 CONSOLE MESSAGE: line 3: John,Smith,Jane,Doe,Emily,Jones
 CONSOLE MESSAGE: line 3: [object Object],[object Object],[object Object]
 CONSOLE MESSAGE: line 3: [object Object],[object Object],[object Object]
+CONSOLE MESSAGE: line 3: [object Object],[object Object]
 
 STEP: console.table([])
 {
@@ -524,3 +525,153 @@
   "_request": null
 }
 
+STEP: console.table([manyProperties, manyProperties], ['five', 'six'])
+{
+  "_source": "console-api",
+  "_level": "log",
+  "_messageText": "[object Object],[object Object]",
+  "_type": "table",
+  "_url": null,
+  "_line": 3,
+  "_column": 14,
+  "_repeatCount": 1,
+  "_parameters": [
+    {
+      "_type": "object",
+      "_subtype": "array",
+      "_objectId": "<filtered>",
+      "_description": "Array",
+      "_hasChildren": true,
+      "_size": 2,
+      "_preview": {
+        "_type": "object",
+        "_subtype": "array",
+        "_description": "Array",
+        "_lossless": true,
+        "_overflow": false,
+        "_size": 2,
+        "_properties": [
+          {
+            "_name": "0",
+            "_type": "object",
+            "_valuePreview": {
+              "_type": "object",
+              "_description": "Object",
+              "_lossless": true,
+              "_overflow": false,
+              "_properties": [
+                {
+                  "_name": "one",
+                  "_type": "number",
+                  "_value": "1"
+                },
+                {
+                  "_name": "two",
+                  "_type": "number",
+                  "_value": "2"
+                },
+                {
+                  "_name": "three",
+                  "_type": "number",
+                  "_value": "3"
+                },
+                {
+                  "_name": "four",
+                  "_type": "number",
+                  "_value": "4"
+                },
+                {
+                  "_name": "five",
+                  "_type": "number",
+                  "_value": "5"
+                },
+                {
+                  "_name": "six",
+                  "_type": "number",
+                  "_value": "6"
+                }
+              ],
+              "_entries": null
+            }
+          },
+          {
+            "_name": "1",
+            "_type": "object",
+            "_valuePreview": {
+              "_type": "object",
+              "_description": "Object",
+              "_lossless": true,
+              "_overflow": false,
+              "_properties": [
+                {
+                  "_name": "one",
+                  "_type": "number",
+                  "_value": "1"
+                },
+                {
+                  "_name": "two",
+                  "_type": "number",
+                  "_value": "2"
+                },
+                {
+                  "_name": "three",
+                  "_type": "number",
+                  "_value": "3"
+                },
+                {
+                  "_name": "four",
+                  "_type": "number",
+                  "_value": "4"
+                },
+                {
+                  "_name": "five",
+                  "_type": "number",
+                  "_value": "5"
+                },
+                {
+                  "_name": "six",
+                  "_type": "number",
+                  "_value": "6"
+                }
+              ],
+              "_entries": null
+            }
+          }
+        ],
+        "_entries": null
+      }
+    },
+    {
+      "_type": "object",
+      "_subtype": "array",
+      "_objectId": "<filtered>",
+      "_description": "Array",
+      "_hasChildren": true,
+      "_size": 2,
+      "_preview": {
+        "_type": "object",
+        "_subtype": "array",
+        "_description": "Array",
+        "_lossless": true,
+        "_overflow": false,
+        "_size": 2,
+        "_properties": [
+          {
+            "_name": "0",
+            "_type": "string",
+            "_value": "five"
+          },
+          {
+            "_name": "1",
+            "_type": "string",
+            "_value": "six"
+          }
+        ],
+        "_entries": null
+      }
+    }
+  ],
+  "_stackTrace": "<filtered>",
+  "_request": null
+}
+

Modified: trunk/LayoutTests/inspector/console/console-table.html (210909 => 210910)


--- trunk/LayoutTests/inspector/console/console-table.html	2017-01-19 03:19:37 UTC (rev 210909)
+++ trunk/LayoutTests/inspector/console/console-table.html	2017-01-19 05:06:10 UTC (rev 210910)
@@ -12,6 +12,7 @@
 var john = new Person("John", "Smith");
 var jane = new Person("Jane", "Doe");
 var emily = new Person("Emily", "Jones");
+var manyProperties = {one:1, two:2, three:3, four:4, five:5, six:6};
 
 function test()
 {
@@ -24,6 +25,7 @@
         "console.table([['John', 'Smith'], ['Jane', 'Doe'], ['Emily', 'Jones']])", // Index, 0, 1
         "console.table([john, jane, emily])", // Index, firstName, lastName
         "console.table([john, jane, emily], ['firstName'])", // Index, firstName (at least).
+        `console.table([manyProperties, manyProperties], ['five', 'six'])`, // Index, five, size (at least)
     ];
 
     function remoteObjectJSONFilter(key, value)
@@ -50,6 +52,6 @@
 }
 </script>
 </head>
-<body _onload_="runTest();">
+<body _onload_="runTest()">
 </body>
 </html>

Modified: trunk/Source/_javascript_Core/ChangeLog (210909 => 210910)


--- trunk/Source/_javascript_Core/ChangeLog	2017-01-19 03:19:37 UTC (rev 210909)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-01-19 05:06:10 UTC (rev 210910)
@@ -1,3 +1,17 @@
+2017-01-18  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: console.table only works for the first 5 properties
+        https://bugs.webkit.org/show_bug.cgi?id=167175
+
+        Reviewed by Timothy Hatcher.
+
+        * 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.
+
 2017-01-18  Antti Koivisto  <[email protected]>
 
         Only delete source provider caches on full collection

Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js (210909 => 210910)


--- trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js	2017-01-19 03:19:37 UTC (rev 210909)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js	2017-01-19 05:06:10 UTC (rev 210910)
@@ -163,7 +163,7 @@
 
         // FIXME: Currently columns are ignored. Instead, the frontend filters all
         // properties based on the provided column names and in the provided order.
-        // Should we filter here too?
+        // We could filter here to avoid sending very large preview objects.
 
         var columnNames = null;
         if (typeof columns === "string")
@@ -971,9 +971,9 @@
     }
 };
 
-InjectedScript.RemoteObject.createObjectPreviewForValue = function(value, generatePreview)
+InjectedScript.RemoteObject.createObjectPreviewForValue = function(value, generatePreview, columnNames)
 {
-    var remoteObject = new InjectedScript.RemoteObject(value, undefined, false, generatePreview, undefined);
+    var remoteObject = new InjectedScript.RemoteObject(value, undefined, false, generatePreview, columnNames);
     if (remoteObject.objectId)
         injectedScript.releaseObject(remoteObject.objectId);
     if (remoteObject.classPrototype && remoteObject.classPrototype.objectId)
@@ -1155,7 +1155,7 @@
             // Second level.
             if ((secondLevelKeys === null || secondLevelKeys) || this._isPreviewableObject(value, object)) {
                 // FIXME: If we want secondLevelKeys filter to continue we would need some refactoring.
-                var subPreview = InjectedScript.RemoteObject.createObjectPreviewForValue(value, value !== object);
+                var subPreview = InjectedScript.RemoteObject.createObjectPreviewForValue(value, value !== object, secondLevelKeys);
                 property.valuePreview = subPreview;
                 if (!subPreview.lossless)
                     preview.lossless = false;

Modified: trunk/Source/WebInspectorUI/ChangeLog (210909 => 210910)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-01-19 03:19:37 UTC (rev 210909)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-01-19 05:06:10 UTC (rev 210910)
@@ -1,3 +1,14 @@
+2017-01-18  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: console.table only works for the first 5 properties
+        https://bugs.webkit.org/show_bug.cgi?id=167175
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/ConsoleMessageView.js:
+        (WebInspector.ConsoleMessageView.prototype._formatParameterAsTable):
+        Allow a max of 15 columns instead of 10.
+
 2017-01-16  Devin Rousso  <[email protected]>
 
         Web Inspector: add "Persist Logs on Navigation" to settings screen

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js (210909 => 210910)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js	2017-01-19 03:19:37 UTC (rev 210909)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js	2017-01-19 05:06:10 UTC (rev 210910)
@@ -759,7 +759,7 @@
                     continue;
 
                 var rowValue = {};
-                var maxColumnsToRender = 10;
+                var maxColumnsToRender = 15;
                 for (var j = 0; j < rowPreview.propertyPreviews.length; ++j) {
                     var cellProperty = rowPreview.propertyPreviews[j];
                     var columnRendered = columnNames.includes(cellProperty.name);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to