Bug 1335050 - Allow customization of object rep's title generation. r=Honza
authorYura Zenevich <yzenevich@mozilla.com>
Tue, 07 Feb 2017 23:46:09 -0500
changeset 390465 fb66941fca4727647218e98faef001e57d632338
parent 390464 ed323d0cd933f9c14bf0fe2e7c60e1651689483a
child 390466 6a43afeeced35151314142528d28e33f5f9aa657
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersHonza
bugs1335050
milestone54.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 1335050 - Allow customization of object rep's title generation. r=Honza MozReview-Commit-ID: G3SLHv8Kvyb
devtools/client/shared/components/reps/object.js
git
--- a/devtools/client/shared/components/reps/object.js
+++ b/devtools/client/shared/components/reps/object.js
@@ -21,30 +21,31 @@ define(function (require, exports, modul
   /**
    * Renders an object. An object is represented by a list of its
    * properties enclosed in curly brackets.
    */
   const Obj = React.createClass({
     displayName: "Obj",
 
     propTypes: {
-      object: React.PropTypes.object,
+      object: React.PropTypes.object.isRequired,
       // @TODO Change this to Object.values once it's supported in Node's version of V8
       mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])),
       objectLink: React.PropTypes.func,
+      title: React.PropTypes.string,
     },
 
     getTitle: function (object) {
-      let className = object && object.class ? object.class : "Object";
+      let title = this.props.title || object.class || "Object";
       if (this.props.objectLink) {
         return this.props.objectLink({
           object: object
-        }, className);
+        }, title);
       }
-      return className;
+      return title;
     },
 
     safePropIterator: function (object, max) {
       max = (typeof max === "undefined") ? 3 : max;
       try {
         return this.propIterator(object, max);
       } catch (err) {
         console.error(err);
new file mode 100644