Index: Source/core/inspector/InjectedScriptSource.js |
diff --git a/Source/core/inspector/InjectedScriptSource.js b/Source/core/inspector/InjectedScriptSource.js |
index 408f5a2066dfa0311240aea9ec4c52ab90d9c72e..a5a3aaec95e1447bfef1883cf649815a14e90100 100644 |
--- a/Source/core/inspector/InjectedScriptSource.js |
+++ b/Source/core/inspector/InjectedScriptSource.js |
@@ -64,6 +64,17 @@ function toString(obj) |
} |
/** |
+ * @param {*} obj |
+ * @return {string} |
+ */ |
+function toStringDescription(obj) |
+{ |
+ if (typeof obj === "number" && obj === 0 && 1 / obj < 0) |
+ return "-0"; // Negative zero. |
+ return "" + obj; |
+} |
+ |
+/** |
* Please use this bind, not the one from Function.prototype |
* @param {function(...)} func |
* @param {Object} thisObject |
@@ -539,10 +550,10 @@ InjectedScript.prototype = { |
throw "Could not find object with given id"; |
return resolvedArg; |
- } else if ("value" in callArgumentJson) |
+ } else if ("value" in callArgumentJson) { |
return callArgumentJson.value; |
- else |
- return undefined; |
+ } |
+ return undefined; |
}, |
/** |
@@ -574,10 +585,9 @@ InjectedScript.prototype = { |
{ |
var remoteObject = this._wrapObject(value, objectGroup); |
try { |
- remoteObject.description = toString(value); |
+ remoteObject.description = toStringDescription(value); |
} catch (e) {} |
- return { wasThrown: true, |
- result: remoteObject }; |
+ return { wasThrown: true, result: remoteObject }; |
}, |
/** |
@@ -931,7 +941,7 @@ InjectedScript.RemoteObject = function(object, objectGroupName, forceValueType, |
// Provide user-friendly number values. |
if (this.type === "number") |
- this.description = toString(object); |
+ this.description = toStringDescription(object); |
return; |
} |
@@ -1031,7 +1041,7 @@ InjectedScript.RemoteObject.prototype = { |
value = this._abbreviateString(value, maxLength, true); |
preview.lossless = false; |
} |
- this._appendPropertyPreview(preview, { name: name, type: type, value: toString(value) }, propertiesThreshold); |
+ this._appendPropertyPreview(preview, { name: name, type: type, value: toStringDescription(value) }, propertiesThreshold); |
continue; |
} |