Bug 1427184 - devtools-reps v0.18.0: update reps bundle from GitHub;r=Honza.
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Thu, 04 Jan 2018 09:02:55 +0100
changeset 397843 ffa32f67d08eb463d3dc3eac98f52d03a9a08473
parent 397842 e4f2f93a78f096d8cd99ecba8c33c42a1b1711f3
child 397844 6ae11d8f8f770b655990e098ae836f7ec0b9d7ab
push id33193
push usertoros@mozilla.com
push dateFri, 05 Jan 2018 09:57:05 +0000
treeherdermozilla-central@df1519b33fe0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersHonza
bugs1427184
milestone59.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 1427184 - devtools-reps v0.18.0: update reps bundle from GitHub;r=Honza. MozReview-Commit-ID: 86gvJSI7grM
devtools/client/shared/components/reps/reps.js
--- a/devtools/client/shared/components/reps/reps.js
+++ b/devtools/client/shared/components/reps/reps.js
@@ -409,28 +409,23 @@ function getGripPreviewItems(grip) {
 /**
  * Get the type of an object.
  *
  * @param {Object} Grip from which we want the type.
  * @param {boolean} noGrip true if the object is not a grip.
  * @return {boolean}
  */
 function getGripType(object, noGrip) {
-  let type = typeof object;
-  if (type == "object" && object instanceof String) {
-    type = "string";
-  } else if (object && type == "object" && object.type && noGrip !== true) {
-    type = object.type;
-  }
-
-  if (isGrip(object)) {
-    type = object.class;
-  }
-
-  return type;
+  if (noGrip || Object(object) !== object) {
+    return typeof object;
+  }
+  if (object.type === "object") {
+    return object.class;
+  }
+  return object.type;
 }
 
 /**
  * Determines whether a grip is a string containing a URL.
  *
  * @param string grip
  *        The grip, which may contain a URL.
  * @return boolean
@@ -809,17 +804,17 @@ function StringRep(props) {
   }
 
   if (useQuotes) {
     text = escapeString(text, escapeWhitespace);
   } else {
     text = sanitizeString(text);
   }
 
-  const shouldCrop = (!member || !member.open) && cropLimit;
+  const shouldCrop = (!member || !member.open) && cropLimit && text.length > cropLimit;
   if (!containsURL(text)) {
     if (shouldCrop) {
       text = rawCropString(text, cropLimit);
     }
     return span(config, text);
   }
 
   return span(config, ...getLinkifiedElements(text, shouldCrop && cropLimit, omitLinkHref, openLink));
@@ -3235,17 +3230,20 @@ SymbolRep.propTypes = {
 
 function SymbolRep(props) {
   let {
     className = "objectBox objectBox-symbol",
     object
   } = props;
   let { name } = object;
 
-  return span({ className }, `Symbol(${name || ""})`);
+  return span({
+    className,
+    "data-link-actor-id": object.actor
+  }, `Symbol(${name || ""})`);
 }
 
 function supportsObject(object, noGrip = false) {
   return getGripType(object, noGrip) == "symbol";
 }
 
 // Exports from this module
 module.exports = {
@@ -3804,29 +3802,41 @@ function getTitle(grip, props) {
 // Decodes an anonymous naming scheme that
 // spider monkey implements based on "Naming Anonymous JavaScript Functions"
 // http://johnjbarton.github.io/nonymous/index.html
 const objectProperty = /([\w\d]+)$/;
 const arrayProperty = /\[(.*?)\]$/;
 const functionProperty = /([\w\d]+)[\/\.<]*?$/;
 const annonymousProperty = /([\w\d]+)\(\^\)$/;
 
-function getFunctionName(grip, props) {
-  let name = grip.userDisplayName || grip.displayName || grip.name || props.functionName || "";
-
-  const scenarios = [objectProperty, arrayProperty, functionProperty, annonymousProperty];
-
-  scenarios.some(reg => {
-    const match = reg.exec(name);
-    if (match) {
-      name = match[1];
-      return true;
-    }
-    return false;
-  });
+function getFunctionName(grip, props = {}) {
+  let { functionName } = props;
+  let name;
+
+  if (functionName) {
+    let end = functionName.length - 1;
+    functionName = functionName.startsWith('"') && functionName.endsWith('"') ? functionName.substring(1, end) : functionName;
+  }
+
+  if (grip.displayName != undefined && functionName != undefined && grip.displayName != functionName) {
+    name = functionName + ":" + grip.displayName;
+  } else {
+    name = grip.userDisplayName || grip.displayName || grip.name || props.functionName || "";
+
+    const scenarios = [objectProperty, arrayProperty, functionProperty, annonymousProperty];
+
+    scenarios.some(reg => {
+      const match = reg.exec(name);
+      if (match) {
+        name = match[1];
+        return true;
+      }
+      return false;
+    });
+  }
 
   return cropString(name, 100);
 }
 
 function renderParams(props) {
   const {
     parameterNames = []
   } = props;