Bug 1427184 - devtools-reps v0.18.0: update reps bundle from GitHub;r=Honza.
MozReview-Commit-ID: 86gvJSI7grM
--- 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;