Log Message
Web Inspector: Slightly better node previews in arrays https://bugs.webkit.org/show_bug.cgi?id=145188
Patch by Joseph Pecoraro <[email protected]> on 2015-05-20 Reviewed by Timothy Hatcher. Source/_javascript_Core: * 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:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (184634 => 184635)
--- trunk/LayoutTests/ChangeLog 2015-05-20 10:25:39 UTC (rev 184634)
+++ trunk/LayoutTests/ChangeLog 2015-05-20 15:46:04 UTC (rev 184635)
@@ -1,3 +1,13 @@
+2015-05-20 Joseph Pecoraro <[email protected]>
+
+ 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:
+
2015-05-17 Sam Weinig <[email protected]>
Organize event handlers a bit
Modified: trunk/LayoutTests/inspector/model/remote-object-expected.txt (184634 => 184635)
--- 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)
@@ -2191,11 +2191,55 @@
}
-----------------------------------------------------
-_expression_: document.createTextNode('text')
+_expression_: input = document.createElement('input'); input.type = 'password'; input
{
"_type": "object",
"_subtype": "node",
"_objectId": "<filtered>",
+ "_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>",
"_description": "#text",
"_preview": {
"_type": "object",
@@ -2207,7 +2251,7 @@
{
"_name": "wholeText",
"_type": "string",
- "_value": "text"
+ "_value": "text content"
},
{
"_name": "splitText",
@@ -2222,12 +2266,12 @@
{
"_name": "data",
"_type": "string",
- "_value": "text"
+ "_value": "text content"
},
{
"_name": "length",
"_type": "number",
- "_value": "4"
+ "_value": "12"
}
],
"_entries": null
@@ -2235,6 +2279,109 @@
}
-----------------------------------------------------
+_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
+ }
+}
+
+-----------------------------------------------------
_expression_: document.head.children
{
"_type": "object",
@@ -2254,19 +2401,19 @@
"_name": "0",
"_type": "object",
"_subtype": "node",
- "_value": "meta"
+ "_value": "<meta>"
},
{
"_name": "1",
"_type": "object",
"_subtype": "node",
- "_value": "script"
+ "_value": "<script>"
},
{
"_name": "2",
"_type": "object",
"_subtype": "node",
- "_value": "script"
+ "_value": "<script>"
}
],
"_entries": null
@@ -2293,19 +2440,19 @@
"_name": "0",
"_type": "object",
"_subtype": "node",
- "_value": "p.my-test"
+ "_value": "<p class=\"my-test\">"
},
{
"_name": "1",
"_type": "object",
"_subtype": "node",
- "_value": "p.my-test"
+ "_value": "<p class=\"my-test\">"
},
{
"_name": "2",
"_type": "object",
"_subtype": "node",
- "_value": "p.my-test"
+ "_value": "<p class=\"my-test\">"
}
],
"_entries": null
@@ -2332,19 +2479,19 @@
"_name": "0",
"_type": "object",
"_subtype": "node",
- "_value": "p.my-test"
+ "_value": "<p class=\"my-test\">"
},
{
"_name": "1",
"_type": "object",
"_subtype": "node",
- "_value": "p.my-test"
+ "_value": "<p class=\"my-test\">"
},
{
"_name": "2",
"_type": "object",
"_subtype": "node",
- "_value": "p.my-test"
+ "_value": "<p class=\"my-test\">"
}
],
"_entries": null
Modified: trunk/LayoutTests/inspector/model/remote-object.html (184634 => 184635)
--- 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)
@@ -109,7 +109,10 @@
{_expression_: "document.body"},
{_expression_: "div = document.createElement('div'); div.className = 'foo bar'; div"},
{_expression_: "span = document.createElement('span'); span.id = 'foo'; span"},
- {_expression_: "document.createTextNode('text')"},
+ {_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]"},
// Node Collections (NodeLists / Collections)
{_expression_: "document.all", browserOnly: true}, // HTMLAllCollection
Modified: trunk/Source/_javascript_Core/ChangeLog (184634 => 184635)
--- trunk/Source/_javascript_Core/ChangeLog 2015-05-20 10:25:39 UTC (rev 184634)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-05-20 15:46:04 UTC (rev 184635)
@@ -1,3 +1,18 @@
+2015-05-20 Joseph Pecoraro <[email protected]>
+
+ 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.
+
2015-05-19 Commit Queue <[email protected]>
Unreviewed, rolling out r184613 and r184614.
Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js (184634 => 184635)
--- trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js 2015-05-20 10:25:39 UTC (rev 184634)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js 2015-05-20 15:46:04 UTC (rev 184635)
@@ -755,6 +755,53 @@
return null;
},
+ _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;
+ }
+ },
+
_describe: function(obj)
{
if (this.isPrimitiveValue(obj))
@@ -774,20 +821,8 @@
if (subtype === "error")
return toString(obj);
- 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;
- }
+ if (subtype === "node")
+ return this._nodeDescription(obj);
var className = InjectedScriptHost.internalConstructorName(obj);
if (subtype === "array")
@@ -1133,8 +1168,10 @@
preview.overflow = true;
} else {
var description = "";
- if (type !== "function" || subtype === "class")
- description = this._abbreviateString(injectedScript._describe(value), maxLength, subtype === "regexp");
+ if (type !== "function" || subtype === "class") {
+ var fullDescription = subtype === "node" ? injectedScript._nodePreview(value) : injectedScript._describe(value);
+ description = this._abbreviateString(fullDescription, maxLength, subtype === "regexp");
+ }
property.value = description;
preview.lossless = false;
}
_______________________________________________ webkit-changes mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-changes
