Bug 1304804 - Don't set a default cropLimit for reps;r=Honza
authorBrian Grinstead <bgrinstead@mozilla.com>
Mon, 26 Sep 2016 11:49:54 -0700
changeset 315350 c5d6e4be64b0da45b32832f7df6f8eeac4a75eed
parent 315349 bf002e13d8072fe5c81289e02c8344455d6ce406
child 315351 6b5f059a85ad581fe9078941c80a8e22869f8149
push id30748
push usercbook@mozilla.com
push dateWed, 28 Sep 2016 13:53:19 +0000
treeherdermozilla-central@8c84b7618840 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersHonza
bugs1304804
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1304804 - Don't set a default cropLimit for reps;r=Honza MozReview-Commit-ID: HVHqkomVrLW
devtools/client/dom/content/components/dom-tree.js
devtools/client/jsonview/components/json-panel.js
devtools/client/shared/components/reps/rep-utils.js
devtools/client/shared/components/test/mochitest/test_reps_string.html
devtools/client/webconsole/net/components/post-tab.js
devtools/client/webconsole/net/components/response-tab.js
--- a/devtools/client/dom/content/components/dom-tree.js
+++ b/devtools/client/dom/content/components/dom-tree.js
@@ -56,16 +56,17 @@ var DomTree = React.createClass({
     }];
 
     // This is the integration point with Reps. The DomTree is using
     // Reps to render all values. The code also specifies default rep
     // used for data types that don't have its own specific template.
     let renderValue = props => {
       return Rep(Object.assign({}, props, {
         defaultRep: Grip,
+        cropLimit: 50,
       }));
     };
 
     return (
       TreeView({
         object: this.props.object,
         provider: new GripProvider(this.props.grips, this.props.dispatch),
         decorator: new DomDecorator(),
--- a/devtools/client/jsonview/components/json-panel.js
+++ b/devtools/client/jsonview/components/json-panel.js
@@ -88,17 +88,19 @@ define(function (require, exports, modul
       let member = props.member;
 
       // Hide object summary when object is expanded (bug 1244912).
       if (typeof member.value == "object" && member.open) {
         return null;
       }
 
       // Render the value (summary) using Reps library.
-      return Rep(props);
+      return Rep(Object.assign({}, props, {
+        cropLimit: 50,
+      }));
     },
 
     renderTree: function () {
       // Append custom column for displaying values. This column
       // Take all available horizontal space.
       let columns = [{
         id: "value",
         width: "100%"
--- a/devtools/client/shared/components/reps/rep-utils.js
+++ b/devtools/client/shared/components/reps/rep-utils.js
@@ -43,23 +43,18 @@ define(function (require, exports, modul
   function cropString(text, limit, alternativeText) {
     if (!alternativeText) {
       alternativeText = "\u2026";
     }
 
     // Make sure it's a string.
     text = text + "";
 
-    // Use default limit if necessary.
-    if (!limit) {
-      limit = 50;
-    }
-
     // Crop the string only if a limit is actually specified.
-    if (limit <= 0) {
+    if (!limit || limit <= 0) {
       return text;
     }
 
     // Set the limit at least to the length of the alternative text
     // plus one character of the original text.
     if (limit <= alternativeText.length) {
       limit = alternativeText.length + 1;
     }
--- a/devtools/client/shared/components/test/mochitest/test_reps_string.html
+++ b/devtools/client/shared/components/test/mochitest/test_reps_string.html
@@ -31,17 +31,17 @@ window.onload = Task.async(function* () 
   } catch(e) {
     ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
   } finally {
     SimpleTest.finish();
   }
 
   function testMultiline() {
     const renderedComponent = renderComponent(StringRep.rep, { object: getGripStub("testMultiline") });
-    is(renderedComponent.textContent, "\"aaaaaaaaaaaaaaaaaaaaa\\nbbb…bbbbbb\\ncccccccccccccccc\\n\"", "String rep has expected text content for multiline string");
+    is(renderedComponent.textContent, "\"aaaaaaaaaaaaaaaaaaaaa\\nbbbbbbbbbbbbbbbbbbb\\ncccccccccccccccc\\n\"", "String rep has expected text content for multiline string");
   }
 
   function testMultilineLimit() {
     const renderedComponent = renderComponent(StringRep.rep, { object: getGripStub("testMultiline"), cropLimit: 20 });
     is(renderedComponent.textContent, "\"aaaaaaaaaa…cccccccc\\n\"", "String rep has expected text content for multiline string with specified number of characters");
   }
 
   function testMultilineOpen() {
--- a/devtools/client/webconsole/net/components/post-tab.js
+++ b/devtools/client/webconsole/net/components/post-tab.js
@@ -72,17 +72,19 @@ var PostTab = React.createClass({
     }
 
     return {
       key: "json",
       content: TreeView({
         columns: [{id: "value"}],
         object: json,
         mode: "tiny",
-        renderValue: props => Rep(props)
+        renderValue: props => Rep(Object.assign({}, props, {
+          cropLimit: 50,
+        })),
       }),
       name: Locale.$STR("jsonScopeName")
     };
   },
 
   parseXml(file) {
     let text = file.request.postData.text;
     if (isLongString(text)) {
--- a/devtools/client/webconsole/net/components/response-tab.js
+++ b/devtools/client/webconsole/net/components/response-tab.js
@@ -100,17 +100,19 @@ var ResponseTab = React.createClass({
     }
 
     return {
       key: "json",
       content: TreeView({
         columns: [{id: "value"}],
         object: json,
         mode: "tiny",
-        renderValue: props => Rep(props)
+        renderValue: props => Rep(Object.assign({}, props, {
+          cropLimit: 50,
+        })),
       }),
       name: Locale.$STR("jsonScopeName")
     };
   },
 
   renderImage(file) {
     let content = file.response.content;
     if (!this.isImage(content)) {