Index: Source/core/inspector/InjectedScriptSource.js |
diff --git a/Source/core/inspector/InjectedScriptSource.js b/Source/core/inspector/InjectedScriptSource.js |
index 1ddcd7f02828f4d93aa8bf90d6c3c868f0905eba..8788757825f9908d079d0a5be1b12667f77f0f6a 100644 |
--- a/Source/core/inspector/InjectedScriptSource.js |
+++ b/Source/core/inspector/InjectedScriptSource.js |
@@ -87,6 +87,15 @@ function bind(func, thisObject, var_args) |
} |
/** |
+ * @param {number} x |
+ * @return {boolean} |
+ */ |
+function isNegativeZero(x) |
+{ |
+ return x === 0 && 1 / x < 0; |
+} |
+ |
+/** |
* @constructor |
*/ |
var InjectedScript = function() |
@@ -930,8 +939,12 @@ InjectedScript.RemoteObject = function(object, objectGroupName, forceValueType, |
this.subtype = "null"; |
// Provide user-friendly number values. |
- if (this.type === "number") |
- this.description = toString(object); |
+ if (this.type === "number") { |
+ if (isNegativeZero(/** @type {number} */ (object))) |
+ this.description = "-0"; |
+ else |
+ this.description = toString(object); |
+ } |
return; |
} |
@@ -1029,7 +1042,8 @@ InjectedScript.RemoteObject.prototype = { |
value = this._abbreviateString(value, maxLength, true); |
preview.lossless = false; |
} |
- this._appendPropertyPreview(preview, { name: name, type: type, value: toString(value) }, propertiesThreshold); |
+ var description = (type === "number" && isNegativeZero(value)) ? "-0" : toString(value); |
yurys
2013/11/22 18:00:09
The code for the number serialization repeats twic
|
+ this._appendPropertyPreview(preview, { name: name, type: type, value: description }, propertiesThreshold); |
continue; |
} |