<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[181612] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/181612">181612</a></dd>
<dt>Author</dt> <dd>joepeck@webkit.org</dd>
<dt>Date</dt> <dd>2015-03-16 21:41:31 -0700 (Mon, 16 Mar 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: Better Console Previews for Arrays / Small Objects
https://bugs.webkit.org/show_bug.cgi?id=142322
Reviewed by Timothy Hatcher.
Source/JavaScriptCore:
* inspector/InjectedScriptSource.js:
Create deep valuePreviews for simple previewable objects,
such as arrays with 5 values, or basic objects with
3 properties.
Source/WebInspectorUI:
* UserInterface/Views/ObjectPreviewView.js:
If there is a sub-preview, show the sub-preview.
* UserInterface/Views/ObjectTreeView.js:
(WebInspector.ObjectTreeView):
For an ObjectTree that is not a root (e.g. one inside of
an array/set/map property tree element) allow it to be
expanded even if the preview is lossless.
LayoutTests:
* inspector/model/remote-object-expected.txt:
* inspector/model/remote-object.html:
Include a test with cyclic values, and update
results which now have sub-previews.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectormodelremoteobjectexpectedtxt">trunk/LayoutTests/inspector/model/remote-object-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectormodelremoteobjecthtml">trunk/LayoutTests/inspector/model/remote-object.html</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorInjectedScriptSourcejs">trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsObjectPreviewViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsObjectTreeViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (181611 => 181612)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-03-17 04:02:52 UTC (rev 181611)
+++ trunk/LayoutTests/ChangeLog        2015-03-17 04:41:31 UTC (rev 181612)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-03-16 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Better Console Previews for Arrays / Small Objects
+ https://bugs.webkit.org/show_bug.cgi?id=142322
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/model/remote-object-expected.txt:
+ * inspector/model/remote-object.html:
+ Include a test with cyclic values, and update
+ results which now have sub-previews.
+
</ins><span class="cx"> 2015-03-16 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> Implement default constructor
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelremoteobjectexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/remote-object-expected.txt (181611 => 181612)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/remote-object-expected.txt        2015-03-17 04:02:52 UTC (rev 181611)
+++ trunk/LayoutTests/inspector/model/remote-object-expected.txt        2015-03-17 04:41:31 UTC (rev 181612)
</span><span class="lines">@@ -592,7 +592,7 @@
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "array",
</span><span class="cx"> "_description": "Array",
</span><del>- "_lossless": false,
</del><ins>+ "_lossless": true,
</ins><span class="cx"> "_overflow": false,
</span><span class="cx"> "_size": 3,
</span><span class="cx"> "_properties": [
</span><span class="lines">@@ -600,19 +600,64 @@
</span><span class="cx"> "_name": "0",
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "array",
</span><del>- "_value": "Array"
</del><ins>+ "_valuePreview": {
+ "_type": "object",
+ "_subtype": "array",
+ "_description": "Array",
+ "_lossless": true,
+ "_overflow": false,
+ "_size": 1,
+ "_properties": [
+ {
+ "_name": "0",
+ "_type": "number",
+ "_value": "1"
+ }
+ ],
+ "_entries": null
+ }
</ins><span class="cx"> },
</span><span class="cx"> {
</span><span class="cx"> "_name": "1",
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "array",
</span><del>- "_value": "Array"
</del><ins>+ "_valuePreview": {
+ "_type": "object",
+ "_subtype": "array",
+ "_description": "Array",
+ "_lossless": true,
+ "_overflow": false,
+ "_size": 1,
+ "_properties": [
+ {
+ "_name": "0",
+ "_type": "number",
+ "_value": "2"
+ }
+ ],
+ "_entries": null
+ }
</ins><span class="cx"> },
</span><span class="cx"> {
</span><span class="cx"> "_name": "2",
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "array",
</span><del>- "_value": "Array"
</del><ins>+ "_valuePreview": {
+ "_type": "object",
+ "_subtype": "array",
+ "_description": "Array",
+ "_lossless": true,
+ "_overflow": false,
+ "_size": 1,
+ "_properties": [
+ {
+ "_name": "0",
+ "_type": "number",
+ "_value": "3"
+ }
+ ],
+ "_entries": null
+ }
</ins><span class="cx"> }
</span><span class="cx"> ],
</span><span class="cx"> "_entries": null
</span><span class="lines">@@ -678,24 +723,63 @@
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "array",
</span><span class="cx"> "_description": "Array",
</span><del>- "_lossless": false,
</del><ins>+ "_lossless": true,
</ins><span class="cx"> "_overflow": false,
</span><span class="cx"> "_size": 3,
</span><span class="cx"> "_properties": [
</span><span class="cx"> {
</span><span class="cx"> "_name": "0",
</span><span class="cx"> "_type": "object",
</span><del>- "_value": "Object"
</del><ins>+ "_valuePreview": {
+ "_type": "object",
+ "_description": "Object",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": [
+ {
+ "_name": "a",
+ "_type": "number",
+ "_value": "1"
+ }
+ ],
+ "_entries": null
+ }
</ins><span class="cx"> },
</span><span class="cx"> {
</span><span class="cx"> "_name": "1",
</span><span class="cx"> "_type": "object",
</span><del>- "_value": "Object"
</del><ins>+ "_valuePreview": {
+ "_type": "object",
+ "_description": "Object",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": [
+ {
+ "_name": "b",
+ "_type": "number",
+ "_value": "2"
+ }
+ ],
+ "_entries": null
+ }
</ins><span class="cx"> },
</span><span class="cx"> {
</span><span class="cx"> "_name": "2",
</span><span class="cx"> "_type": "object",
</span><del>- "_value": "Object"
</del><ins>+ "_valuePreview": {
+ "_type": "object",
+ "_description": "Object",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": [
+ {
+ "_name": "c",
+ "_type": "number",
+ "_value": "2"
+ }
+ ],
+ "_entries": null
+ }
</ins><span class="cx"> }
</span><span class="cx"> ],
</span><span class="cx"> "_entries": null
</span><span class="lines">@@ -714,7 +798,7 @@
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "array",
</span><span class="cx"> "_description": "Array",
</span><del>- "_lossless": false,
</del><ins>+ "_lossless": true,
</ins><span class="cx"> "_overflow": false,
</span><span class="cx"> "_size": 1,
</span><span class="cx"> "_properties": [
</span><span class="lines">@@ -722,7 +806,71 @@
</span><span class="cx"> "_name": "0",
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "array",
</span><del>- "_value": "Array"
</del><ins>+ "_valuePreview": {
+ "_type": "object",
+ "_subtype": "array",
+ "_description": "Array",
+ "_lossless": true,
+ "_overflow": false,
+ "_size": 3,
+ "_properties": [
+ {
+ "_name": "0",
+ "_type": "object",
+ "_valuePreview": {
+ "_type": "object",
+ "_description": "Object",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": [
+ {
+ "_name": "a",
+ "_type": "number",
+ "_value": "1"
+ }
+ ],
+ "_entries": null
+ }
+ },
+ {
+ "_name": "1",
+ "_type": "object",
+ "_valuePreview": {
+ "_type": "object",
+ "_description": "Object",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": [
+ {
+ "_name": "b",
+ "_type": "number",
+ "_value": "2"
+ }
+ ],
+ "_entries": null
+ }
+ },
+ {
+ "_name": "2",
+ "_type": "object",
+ "_valuePreview": {
+ "_type": "object",
+ "_description": "Object",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": [
+ {
+ "_name": "c",
+ "_type": "number",
+ "_value": "2"
+ }
+ ],
+ "_entries": null
+ }
+ }
+ ],
+ "_entries": null
+ }
</ins><span class="cx"> }
</span><span class="cx"> ],
</span><span class="cx"> "_entries": null
</span><span class="lines">@@ -1554,6 +1702,33 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> -----------------------------------------------------
</span><ins>+EXPRESSION: o = {a:1}; o.b = o; o
+{
+ "_type": "object",
+ "_objectId": "<filtered>",
+ "_description": "Object",
+ "_preview": {
+ "_type": "object",
+ "_description": "Object",
+ "_lossless": false,
+ "_overflow": false,
+ "_properties": [
+ {
+ "_name": "a",
+ "_type": "number",
+ "_value": "1"
+ },
+ {
+ "_name": "b",
+ "_type": "object",
+ "_value": "Object"
+ }
+ ],
+ "_entries": null
+ }
+}
+
+-----------------------------------------------------
</ins><span class="cx"> EXPRESSION: ({a:function a(){}, b:function b(){}, get getter(){}, set setter(v){}})
</span><span class="cx"> {
</span><span class="cx"> "_type": "object",
</span><span class="lines">@@ -2948,14 +3123,23 @@
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "iterator",
</span><span class="cx"> "_description": "ArrayIterator",
</span><del>- "_lossless": false,
</del><ins>+ "_lossless": true,
</ins><span class="cx"> "_overflow": false,
</span><span class="cx"> "_properties": [
</span><span class="cx"> {
</span><span class="cx"> "_name": "array",
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "array",
</span><del>- "_value": "Array",
</del><ins>+ "_valuePreview": {
+ "_type": "object",
+ "_subtype": "array",
+ "_description": "Array",
+ "_lossless": true,
+ "_overflow": false,
+ "_size": 0,
+ "_properties": [],
+ "_entries": null
+ },
</ins><span class="cx"> "_internal": true
</span><span class="cx"> },
</span><span class="cx"> {
</span><span class="lines">@@ -2980,14 +3164,29 @@
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "iterator",
</span><span class="cx"> "_description": "ArrayIterator",
</span><del>- "_lossless": false,
</del><ins>+ "_lossless": true,
</ins><span class="cx"> "_overflow": false,
</span><span class="cx"> "_properties": [
</span><span class="cx"> {
</span><span class="cx"> "_name": "array",
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "array",
</span><del>- "_value": "Array",
</del><ins>+ "_valuePreview": {
+ "_type": "object",
+ "_subtype": "array",
+ "_description": "Array",
+ "_lossless": true,
+ "_overflow": false,
+ "_size": 1,
+ "_properties": [
+ {
+ "_name": "0",
+ "_type": "number",
+ "_value": "1"
+ }
+ ],
+ "_entries": null
+ },
</ins><span class="cx"> "_internal": true
</span><span class="cx"> },
</span><span class="cx"> {
</span><span class="lines">@@ -3684,14 +3883,34 @@
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "iterator",
</span><span class="cx"> "_description": "ArgumentsIterator",
</span><del>- "_lossless": false,
</del><ins>+ "_lossless": true,
</ins><span class="cx"> "_overflow": false,
</span><span class="cx"> "_properties": [
</span><span class="cx"> {
</span><span class="cx"> "_name": "arguments",
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "array",
</span><del>- "_value": "Arguments",
</del><ins>+ "_valuePreview": {
+ "_type": "object",
+ "_subtype": "array",
+ "_description": "Arguments",
+ "_lossless": true,
+ "_overflow": false,
+ "_size": 2,
+ "_properties": [
+ {
+ "_name": "0",
+ "_type": "number",
+ "_value": "1"
+ },
+ {
+ "_name": "1",
+ "_type": "string",
+ "_value": "two"
+ }
+ ],
+ "_entries": null
+ },
</ins><span class="cx"> "_internal": true
</span><span class="cx"> }
</span><span class="cx"> ],
</span><span class="lines">@@ -3839,7 +4058,7 @@
</span><span class="cx"> "_preview": {
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_description": "Promise",
</span><del>- "_lossless": false,
</del><ins>+ "_lossless": true,
</ins><span class="cx"> "_overflow": false,
</span><span class="cx"> "_properties": [
</span><span class="cx"> {
</span><span class="lines">@@ -3851,7 +4070,20 @@
</span><span class="cx"> {
</span><span class="cx"> "_name": "result",
</span><span class="cx"> "_type": "object",
</span><del>- "_value": "Object",
</del><ins>+ "_valuePreview": {
+ "_type": "object",
+ "_description": "Object",
+ "_lossless": true,
+ "_overflow": false,
+ "_properties": [
+ {
+ "_name": "result",
+ "_type": "number",
+ "_value": "1"
+ }
+ ],
+ "_entries": null
+ },
</ins><span class="cx"> "_internal": true
</span><span class="cx"> }
</span><span class="cx"> ],
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelremoteobjecthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/remote-object.html (181611 => 181612)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/remote-object.html        2015-03-17 04:02:52 UTC (rev 181611)
+++ trunk/LayoutTests/inspector/model/remote-object.html        2015-03-17 04:41:31 UTC (rev 181612)
</span><span class="lines">@@ -91,6 +91,7 @@
</span><span class="cx"> {expression: "({a: 1})"},
</span><span class="cx"> {expression: "({a: 1, b: 0, c: -0})"},
</span><span class="cx"> {expression: "({a: 1, b: \"string\", c: /regex/, d: Symbol('sym')})"},
</span><ins>+ {expression: "o = {a:1}; o.b = o; o"}, // Cyclic.
</ins><span class="cx"> {expression: "({a:function a(){}, b:function b(){}, get getter(){}, set setter(v){}})"},
</span><span class="cx"> {expression: "function Foo() {}; new Foo"},
</span><span class="cx"> {expression: "var Foo2 = function() {}; new Foo2"},
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (181611 => 181612)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-03-17 04:02:52 UTC (rev 181611)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-03-17 04:41:31 UTC (rev 181612)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-03-16 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Better Console Previews for Arrays / Small Objects
+ https://bugs.webkit.org/show_bug.cgi?id=142322
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/InjectedScriptSource.js:
+ Create deep valuePreviews for simple previewable objects,
+ such as arrays with 5 values, or basic objects with
+ 3 properties.
+
</ins><span class="cx"> 2015-03-16 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> Add support for default constructor
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorInjectedScriptSourcejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js (181611 => 181612)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js        2015-03-17 04:02:52 UTC (rev 181611)
+++ trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js        2015-03-17 04:41:31 UTC (rev 181612)
</span><span class="lines">@@ -990,13 +990,14 @@
</span><span class="cx"> return preview;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (preview.entries)
+ return preview;
+
</ins><span class="cx"> // Properties.
</span><span class="cx"> var descriptors = injectedScript._propertyDescriptors(object, InjectedScript.CollectionMode.AllProperties);
</span><span class="cx"> this._appendPropertyPreviews(preview, descriptors, false, propertiesThreshold, firstLevelKeys, secondLevelKeys);
</span><span class="cx"> if (propertiesThreshold.indexes < 0 || propertiesThreshold.properties < 0)
</span><span class="cx"> return preview;
</span><del>-
- // FIXME: Iterator entries.
</del><span class="cx"> } catch (e) {
</span><span class="cx"> preview.lossless = false;
</span><span class="cx"> }
</span><span class="lines">@@ -1093,6 +1094,13 @@
</span><span class="cx"> preview.lossless = false;
</span><span class="cx"> if (subPreview.overflow)
</span><span class="cx"> preview.overflow = true;
</span><ins>+ } else if (this._isPreviewableObject(value)) {
+ var subPreview = this._createObjectPreviewForValue(value);
+ property.valuePreview = subPreview;
+ if (!subPreview.lossless)
+ preview.lossless = false;
+ if (subPreview.overflow)
+ preview.overflow = true;
</ins><span class="cx"> } else {
</span><span class="cx"> var description = "";
</span><span class="cx"> if (type !== "function")
</span><span class="lines">@@ -1145,6 +1153,57 @@
</span><span class="cx"> }, this);
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ _isPreviewableObject: function(object)
+ {
+ return this._isPreviewableObjectInternal(object, new Set, 1);
+ },
+
+ _isPreviewableObjectInternal: function(object, knownObjects, depth)
+ {
+ // Deep object.
+ if (depth > 3)
+ return false;
+
+ // Primitive.
+ if (injectedScript.isPrimitiveValue(object) || isSymbol(object))
+ return true;
+
+ // Cyclic objects.
+ if (knownObjects.has(object))
+ return false;
+
+ ++depth;
+ knownObjects.add(object);
+
+ // Arrays are simple if they have 5 or less simple objects.
+ var subtype = injectedScript._subtype(object);
+ if (subtype === "array") {
+ var length = object.length;
+ if (length > 5)
+ return false;
+ for (var i = 0; i < length; ++i) {
+ if (!this._isPreviewableObjectInternal(object[i], knownObjects, depth))
+ return false;
+ }
+ return true;
+ }
+
+ // Not a basic object.
+ if (object.__proto__ && object.__proto__.__proto__)
+ return false;
+
+ // Objects are simple if they have 3 or less simple properties.
+ var ownPropertyNames = Object.getOwnPropertyNames(object);
+ if (ownPropertyNames.length > 3)
+ return false;
+ for (var propertyName of ownPropertyNames) {
+ if (!this._isPreviewableObjectInternal(object[propertyName], knownObjects, depth))
+ return false;
+ }
+
+ return true;
+ },
+
</ins><span class="cx"> _abbreviateString: function(string, maxLength, middle)
</span><span class="cx"> {
</span><span class="cx"> if (string.length <= maxLength)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (181611 => 181612)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-03-17 04:02:52 UTC (rev 181611)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-03-17 04:41:31 UTC (rev 181612)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2015-03-16 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Better Console Previews for Arrays / Small Objects
+ https://bugs.webkit.org/show_bug.cgi?id=142322
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Views/ObjectPreviewView.js:
+ If there is a sub-preview, show the sub-preview.
+
+ * UserInterface/Views/ObjectTreeView.js:
+ (WebInspector.ObjectTreeView):
+ For an ObjectTree that is not a root (e.g. one inside of
+ an array/set/map property tree element) allow it to be
+ expanded even if the preview is lossless.
+
</ins><span class="cx"> 2015-03-16 Nikita Vasilyev <nvasilyev@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: Rename ConsoleMessage and ConsoleMessageImpl to LegacyConsoleMessage and LegacyConsoleMessageImpl respectively
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsObjectPreviewViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js (181611 => 181612)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js        2015-03-17 04:02:52 UTC (rev 181611)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPreviewView.js        2015-03-17 04:41:31 UTC (rev 181612)
</span><span class="lines">@@ -211,7 +211,10 @@
</span><span class="cx"> element.appendChild(document.createTextNode(": "));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- element.appendChild(WebInspector.FormattedValue.createElementForPropertyPreview(property));
</del><ins>+ if (property.valuePreview)
+ this._appendPreview(element, property.valuePreview);
+ else
+ element.appendChild(WebInspector.FormattedValue.createElementForPropertyPreview(property));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (preview.overflow)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsObjectTreeViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js (181611 => 181612)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js        2015-03-17 04:02:52 UTC (rev 181611)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js        2015-03-17 04:41:31 UTC (rev 181612)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx"> this._previewView.element.addEventListener("click", this._handlePreviewOrTitleElementClick.bind(this));
</span><span class="cx"> this._element.appendChild(this._previewView.element);
</span><span class="cx">
</span><del>- if (this._previewView.lossless && !forceExpanding) {
</del><ins>+ if (this._previewView.lossless && !this._propertyPath.parent && !forceExpanding) {
</ins><span class="cx"> this._hasLosslessPreview = true;
</span><span class="cx"> this.element.classList.add("lossless-preview");
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>