<!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>[184635] 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/184635">184635</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-05-20 08:46:04 -0700 (Wed, 20 May 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: Slightly better node previews in arrays
https://bugs.webkit.org/show_bug.cgi?id=145188
Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-05-20
Reviewed by Timothy Hatcher.
Source/JavaScriptCore:
* inspector/InjectedScriptSource.js:
(InjectedScript.prototype._nodeDescription):
(InjectedScript.prototype._nodePreview):
Different stringified representations for a basic object description or in a preview.
(InjectedScript.RemoteObject.prototype._appendPropertyPreviews):
Use the node preview string representation inside previews.
LayoutTests:
* inspector/model/remote-object-expected.txt:
* inspector/model/remote-object.html:</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>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (184634 => 184635)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-05-20 10:25:39 UTC (rev 184634)
+++ trunk/LayoutTests/ChangeLog        2015-05-20 15:46:04 UTC (rev 184635)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-05-20 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Slightly better node previews in arrays
+ https://bugs.webkit.org/show_bug.cgi?id=145188
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/model/remote-object-expected.txt:
+ * inspector/model/remote-object.html:
+
</ins><span class="cx"> 2015-05-17 Sam Weinig <sam@webkit.org>
</span><span class="cx">
</span><span class="cx"> Organize event handlers a bit
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelremoteobjectexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/remote-object-expected.txt (184634 => 184635)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/remote-object-expected.txt        2015-05-20 10:25:39 UTC (rev 184634)
+++ trunk/LayoutTests/inspector/model/remote-object-expected.txt        2015-05-20 15:46:04 UTC (rev 184635)
</span><span class="lines">@@ -2191,11 +2191,55 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> -----------------------------------------------------
</span><del>-EXPRESSION: document.createTextNode('text')
</del><ins>+EXPRESSION: input = document.createElement('input'); input.type = 'password'; input
</ins><span class="cx"> {
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "node",
</span><span class="cx"> "_objectId": "<filtered>",
</span><ins>+ "_description": "input",
+ "_preview": {
+ "_type": "object",
+ "_subtype": "node",
+ "_description": "input",
+ "_lossless": false,
+ "_overflow": true,
+ "_properties": [
+ {
+ "_name": "selectionStart",
+ "_type": "number",
+ "_value": "0"
+ },
+ {
+ "_name": "selectionEnd",
+ "_type": "number",
+ "_value": "0"
+ },
+ {
+ "_name": "selectionDirection",
+ "_type": "string",
+ "_value": "none"
+ },
+ {
+ "_name": "accept",
+ "_type": "string",
+ "_value": ""
+ },
+ {
+ "_name": "alt",
+ "_type": "string",
+ "_value": ""
+ }
+ ],
+ "_entries": null
+ }
+}
+
+-----------------------------------------------------
+EXPRESSION: text = document.createTextNode('text content'); text
+{
+ "_type": "object",
+ "_subtype": "node",
+ "_objectId": "<filtered>",
</ins><span class="cx"> "_description": "#text",
</span><span class="cx"> "_preview": {
</span><span class="cx"> "_type": "object",
</span><span class="lines">@@ -2207,7 +2251,7 @@
</span><span class="cx"> {
</span><span class="cx"> "_name": "wholeText",
</span><span class="cx"> "_type": "string",
</span><del>- "_value": "text"
</del><ins>+ "_value": "text content"
</ins><span class="cx"> },
</span><span class="cx"> {
</span><span class="cx"> "_name": "splitText",
</span><span class="lines">@@ -2222,12 +2266,12 @@
</span><span class="cx"> {
</span><span class="cx"> "_name": "data",
</span><span class="cx"> "_type": "string",
</span><del>- "_value": "text"
</del><ins>+ "_value": "text content"
</ins><span class="cx"> },
</span><span class="cx"> {
</span><span class="cx"> "_name": "length",
</span><span class="cx"> "_type": "number",
</span><del>- "_value": "4"
</del><ins>+ "_value": "12"
</ins><span class="cx"> }
</span><span class="cx"> ],
</span><span class="cx"> "_entries": null
</span><span class="lines">@@ -2235,6 +2279,109 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> -----------------------------------------------------
</span><ins>+EXPRESSION: comment = document.createComment('comment content'); comment
+{
+ "_type": "object",
+ "_subtype": "node",
+ "_objectId": "<filtered>",
+ "_description": "#comment",
+ "_preview": {
+ "_type": "object",
+ "_subtype": "node",
+ "_description": "#comment",
+ "_lossless": false,
+ "_overflow": true,
+ "_properties": [
+ {
+ "_name": "data",
+ "_type": "string",
+ "_value": "comment content"
+ },
+ {
+ "_name": "length",
+ "_type": "number",
+ "_value": "15"
+ },
+ {
+ "_name": "previousElementSibling",
+ "_type": "object",
+ "_subtype": "null",
+ "_value": "null"
+ },
+ {
+ "_name": "nextElementSibling",
+ "_type": "object",
+ "_subtype": "null",
+ "_value": "null"
+ },
+ {
+ "_name": "substringData",
+ "_type": "function",
+ "_value": ""
+ }
+ ],
+ "_entries": null
+ }
+}
+
+-----------------------------------------------------
+EXPRESSION: [document.body, div, span, input, text, comment]
+{
+ "_type": "object",
+ "_subtype": "array",
+ "_objectId": "<filtered>",
+ "_description": "Array",
+ "_size": 6,
+ "_preview": {
+ "_type": "object",
+ "_subtype": "array",
+ "_description": "Array",
+ "_lossless": false,
+ "_overflow": false,
+ "_size": 6,
+ "_properties": [
+ {
+ "_name": "0",
+ "_type": "object",
+ "_subtype": "node",
+ "_value": "<body>"
+ },
+ {
+ "_name": "1",
+ "_type": "object",
+ "_subtype": "node",
+ "_value": "<div class=\"foo bar\">"
+ },
+ {
+ "_name": "2",
+ "_type": "object",
+ "_subtype": "node",
+ "_value": "<span id=\"foo\">"
+ },
+ {
+ "_name": "3",
+ "_type": "object",
+ "_subtype": "node",
+ "_value": "<input type=\"password\">"
+ },
+ {
+ "_name": "4",
+ "_type": "object",
+ "_subtype": "node",
+ "_value": "#text \"text content\""
+ },
+ {
+ "_name": "5",
+ "_type": "object",
+ "_subtype": "node",
+ "_value": "<!--comment content-->"
+ }
+ ],
+ "_entries": null
+ }
+}
+
+-----------------------------------------------------
</ins><span class="cx"> EXPRESSION: document.head.children
</span><span class="cx"> {
</span><span class="cx"> "_type": "object",
</span><span class="lines">@@ -2254,19 +2401,19 @@
</span><span class="cx"> "_name": "0",
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "node",
</span><del>- "_value": "meta"
</del><ins>+ "_value": "<meta>"
</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": "node",
</span><del>- "_value": "script"
</del><ins>+ "_value": "<script>"
</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": "node",
</span><del>- "_value": "script"
</del><ins>+ "_value": "<script>"
</ins><span class="cx"> }
</span><span class="cx"> ],
</span><span class="cx"> "_entries": null
</span><span class="lines">@@ -2293,19 +2440,19 @@
</span><span class="cx"> "_name": "0",
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "node",
</span><del>- "_value": "p.my-test"
</del><ins>+ "_value": "<p class=\"my-test\">"
</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": "node",
</span><del>- "_value": "p.my-test"
</del><ins>+ "_value": "<p class=\"my-test\">"
</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": "node",
</span><del>- "_value": "p.my-test"
</del><ins>+ "_value": "<p class=\"my-test\">"
</ins><span class="cx"> }
</span><span class="cx"> ],
</span><span class="cx"> "_entries": null
</span><span class="lines">@@ -2332,19 +2479,19 @@
</span><span class="cx"> "_name": "0",
</span><span class="cx"> "_type": "object",
</span><span class="cx"> "_subtype": "node",
</span><del>- "_value": "p.my-test"
</del><ins>+ "_value": "<p class=\"my-test\">"
</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": "node",
</span><del>- "_value": "p.my-test"
</del><ins>+ "_value": "<p class=\"my-test\">"
</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": "node",
</span><del>- "_value": "p.my-test"
</del><ins>+ "_value": "<p class=\"my-test\">"
</ins><span class="cx"> }
</span><span class="cx"> ],
</span><span class="cx"> "_entries": null
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelremoteobjecthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/remote-object.html (184634 => 184635)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/remote-object.html        2015-05-20 10:25:39 UTC (rev 184634)
+++ trunk/LayoutTests/inspector/model/remote-object.html        2015-05-20 15:46:04 UTC (rev 184635)
</span><span class="lines">@@ -109,7 +109,10 @@
</span><span class="cx"> {expression: "document.body"},
</span><span class="cx"> {expression: "div = document.createElement('div'); div.className = 'foo bar'; div"},
</span><span class="cx"> {expression: "span = document.createElement('span'); span.id = 'foo'; span"},
</span><del>- {expression: "document.createTextNode('text')"},
</del><ins>+ {expression: "input = document.createElement('input'); input.type = 'password'; input"},
+ {expression: "text = document.createTextNode('text content'); text"},
+ {expression: "comment = document.createComment('comment content'); comment"},
+ {expression: "[document.body, div, span, input, text, comment]"},
</ins><span class="cx">
</span><span class="cx"> // Node Collections (NodeLists / Collections)
</span><span class="cx"> {expression: "document.all", browserOnly: true}, // HTMLAllCollection
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (184634 => 184635)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-05-20 10:25:39 UTC (rev 184634)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-05-20 15:46:04 UTC (rev 184635)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-05-20 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Slightly better node previews in arrays
+ https://bugs.webkit.org/show_bug.cgi?id=145188
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/InjectedScriptSource.js:
+ (InjectedScript.prototype._nodeDescription):
+ (InjectedScript.prototype._nodePreview):
+ Different stringified representations for a basic object description or in a preview.
+
+ (InjectedScript.RemoteObject.prototype._appendPropertyPreviews):
+ Use the node preview string representation inside previews.
+
</ins><span class="cx"> 2015-05-19 Commit Queue <commit-queue@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r184613 and r184614.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorInjectedScriptSourcejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js (184634 => 184635)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js        2015-05-20 10:25:39 UTC (rev 184634)
+++ trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js        2015-05-20 15:46:04 UTC (rev 184635)
</span><span class="lines">@@ -755,6 +755,53 @@
</span><span class="cx"> return null;
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ _nodeDescription: function(node)
+ {
+ var isXMLDocument = node.ownerDocument && !!node.ownerDocument.xmlVersion;
+ var description = isXMLDocument ? node.nodeName : node.nodeName.toLowerCase();
+
+ switch (node.nodeType) {
+ case 1: // Node.ELEMENT_NODE
+ if (node.id)
+ description += "#" + node.id;
+ if (node.className)
+ description += "." + node.className.trim().replace(/\s+/g, ".");
+ return description;
+
+ default:
+ return description;
+ }
+ },
+
+ _nodePreview: function(node)
+ {
+ var isXMLDocument = node.ownerDocument && !!node.ownerDocument.xmlVersion;
+ var nodeName = isXMLDocument ? node.nodeName : node.nodeName.toLowerCase();
+
+ switch (node.nodeType) {
+ case 1: // Node.ELEMENT_NODE
+ if (node.id)
+ return "<" + nodeName + " id=\"" + node.id + "\">";
+ if (node.className)
+ return "<" + nodeName + " class=\"" + node.className + "\">";
+ if (nodeName === "input" && node.type)
+ return "<" + nodeName + " type=\"" + node.type + "\">";
+ return "<" + nodeName + ">";
+
+ case 3: // Node.TEXT_NODE
+ return nodeName + " \"" + node.nodeValue + "\"";
+
+ case 8: // Node.COMMENT_NODE
+ return "<!--" + node.nodeValue + "-->";
+
+ case 10: // Node.DOCUMENT_TYPE_NODE
+ return "<!DOCTYPE " + nodeName + ">";
+
+ default:
+ return nodeName;
+ }
+ },
+
</ins><span class="cx"> _describe: function(obj)
</span><span class="cx"> {
</span><span class="cx"> if (this.isPrimitiveValue(obj))
</span><span class="lines">@@ -774,20 +821,8 @@
</span><span class="cx"> if (subtype === "error")
</span><span class="cx"> return toString(obj);
</span><span class="cx">
</span><del>- if (subtype === "node") {
- var description = obj.nodeName.toLowerCase();
- switch (obj.nodeType) {
- case 1 /* Node.ELEMENT_NODE */:
- description += obj.id ? "#" + obj.id : "";
- var className = obj.className;
- description += (className && typeof className === "string") ? "." + className.trim().replace(/\s+/g, ".") : "";
- break;
- case 10 /*Node.DOCUMENT_TYPE_NODE */:
- description = "<!DOCTYPE " + description + ">";
- break;
- }
- return description;
- }
</del><ins>+ if (subtype === "node")
+ return this._nodeDescription(obj);
</ins><span class="cx">
</span><span class="cx"> var className = InjectedScriptHost.internalConstructorName(obj);
</span><span class="cx"> if (subtype === "array")
</span><span class="lines">@@ -1133,8 +1168,10 @@
</span><span class="cx"> preview.overflow = true;
</span><span class="cx"> } else {
</span><span class="cx"> var description = "";
</span><del>- if (type !== "function" || subtype === "class")
- description = this._abbreviateString(injectedScript._describe(value), maxLength, subtype === "regexp");
</del><ins>+ if (type !== "function" || subtype === "class") {
+ var fullDescription = subtype === "node" ? injectedScript._nodePreview(value) : injectedScript._describe(value);
+ description = this._abbreviateString(fullDescription, maxLength, subtype === "regexp");
+ }
</ins><span class="cx"> property.value = description;
</span><span class="cx"> preview.lossless = false;
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>