Bug 1237428 - Don't cap number of attributes on DOM nodes in console;r=jryans
--- a/devtools/client/webconsole/test/browser_webconsole_output_dom_elements_01.js
+++ b/devtools/client/webconsole/test/browser_webconsole_output_dom_elements_01.js
@@ -51,17 +51,17 @@ var inputTests = [
inspectable: true,
noClick: true,
inspectorIcon: true
},
{
input: "testNodeList()",
output: "NodeList [ <html>, <head>, <meta>, <title>, " +
- "<body#body-id.body-class>, <p>, <iframe>, " +
+ "<body#body-id.body-class>, <p>, <p#lots-of-attributes>, <iframe>, " +
"<div.some.classname.here.with.more.classnames.here>, <script> ]",
printOutput: "[object NodeList]",
inspectable: true,
noClick: true,
inspectorIcon: true
},
{
@@ -93,16 +93,25 @@ var inputTests = [
{
input: "testUnattachedNode()",
output: '<p class="such-class" data-data="such-data">',
printOutput: "[object HTMLParagraphElement]",
inspectable: true,
noClick: true,
inspectorIcon: false
+ },
+
+ {
+ input: "testLotsOfAttributes()",
+ output: '<p n="" m="" l="" k="" j="" i="" h="" g="" f="" e="" d="" c="" b="" a="" id="lots-of-attributes">',
+ printOutput: "[object HTMLParagraphElement]",
+ inspectable: true,
+ noClick: true,
+ inspectorIcon: true
}
];
function test() {
requestLongerTimeout(2);
Task.spawn(function*() {
let {tab} = yield loadTab(TEST_URI);
let hud = yield openConsole(tab);
--- a/devtools/client/webconsole/test/test-console-output-dom-elements.html
+++ b/devtools/client/webconsole/test/test-console-output-dom-elements.html
@@ -5,27 +5,32 @@
<title>Test the web console output - 05</title>
<!--
- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/
-->
</head>
<body class="body-class" id="body-id">
<p some-attribute="some-value">hello world!</p>
+ <p id="lots-of-attributes" a b c d e f g h i j k l m n></p>
<iframe src="data:text/html,<p>hello from iframe</p>"></iframe>
<div class="some classname here with more classnames here"></div>
<script type="text/javascript">
function testBodyNode() {
return document.body;
}
function testDocumentElement() {
return document.documentElement;
}
+function testLotsOfAttributes() {
+ return document.querySelector("#lots-of-attributes");
+}
+
function testDocument() {
return document;
}
function testNode() {
return document.querySelector("p");
}
--- a/devtools/server/actors/object.js
+++ b/devtools/server/actors/object.js
@@ -1491,19 +1491,16 @@ DebuggerServer.ObjectActorPreviewers.Obj
preview.nodeName = preview.nodeName.toLowerCase();
}
let i = 0;
preview.attributes = {};
preview.attributesLength = rawObj.attributes.length;
for (let attr of rawObj.attributes) {
preview.attributes[attr.nodeName] = hooks.createValueGrip(attr.value);
- if (++i == OBJECT_PREVIEW_MAX_ITEMS) {
- break;
- }
}
} else if (rawObj instanceof Ci.nsIDOMAttr) {
preview.value = hooks.createValueGrip(rawObj.value);
} else if (rawObj instanceof Ci.nsIDOMText ||
rawObj instanceof Ci.nsIDOMComment) {
preview.textContent = hooks.createValueGrip(rawObj.textContent);
}