Index: Source/devtools/front_end/RemoteObject.js |
diff --git a/Source/devtools/front_end/RemoteObject.js b/Source/devtools/front_end/RemoteObject.js |
index 916d4d9fd6ff82edd880cc70f5a420db3000fa61..556fd8803c7a785db5db35f1add250abe2d29e97 100644 |
--- a/Source/devtools/front_end/RemoteObject.js |
+++ b/Source/devtools/front_end/RemoteObject.js |
@@ -179,6 +179,34 @@ WebInspector.RemoteObject.type = function(remoteObject) |
} |
/** |
+ * @param {!RuntimeAgent.RemoteObject|!WebInspector.RemoteObject} remoteObject |
+ * @return {!RuntimeAgent.CallArgument} |
+ */ |
+WebInspector.RemoteObject.toCallArgument = function(remoteObject) |
+{ |
+ var type = /** @type {!RuntimeAgent.CallArgumentType.<string>} */ (remoteObject.type); |
+ var value = remoteObject.value; |
+ |
+ // Handle special numbers: NaN, Infinity, -Infinity, -0. |
+ if (type === "number") { |
+ switch (remoteObject.description) { |
+ case "NaN": |
+ case "Infinity": |
+ case "-Infinity": |
+ case "-0": |
+ value = remoteObject.description; |
+ break; |
+ } |
+ } |
+ |
+ return { |
+ value: value, |
+ objectId: remoteObject.objectId, |
+ type: type |
+ }; |
+} |
+ |
+/** |
* @constructor |
* @extends {WebInspector.RemoteObject} |
* @param {!WebInspector.Target|undefined} target |
@@ -389,7 +417,7 @@ WebInspector.RemoteObjectImpl.prototype = { |
// where property was defined; so do we. |
var setPropertyValueFunction = "function(a, b) { this[a] = b; }"; |
- var argv = [{ value: name }, this._toCallArgument(result)] |
+ var argv = [{ value: name }, WebInspector.RemoteObject.toCallArgument(result)] |
this._runtimeAgent.callFunctionOn(this._objectId, setPropertyValueFunction, argv, true, undefined, undefined, propertySetCallback); |
/** |
@@ -408,15 +436,6 @@ WebInspector.RemoteObjectImpl.prototype = { |
}, |
/** |
- * @param {!RuntimeAgent.RemoteObject} object |
- * @return {!RuntimeAgent.CallArgument} |
- */ |
- _toCallArgument: function(object) |
- { |
- return { value: object.value, objectId: object.objectId, type: /** @type {!RuntimeAgent.CallArgumentType.<string>} */ (object.type) }; |
- }, |
- |
- /** |
* @param {function(?DOMAgent.NodeId)} callback |
*/ |
pushNodeToFrontend: function(callback) |
@@ -654,7 +673,7 @@ WebInspector.ScopeRemoteObject.prototype = { |
*/ |
doSetObjectPropertyValue: function(result, name, callback) |
{ |
- this._debuggerAgent.setVariableValue(this._scopeRef.number, name, this._toCallArgument(result), this._scopeRef.callFrameId, this._scopeRef.functionId, setVariableValueCallback.bind(this)); |
+ this._debuggerAgent.setVariableValue(this._scopeRef.number, name, WebInspector.RemoteObject.toCallArgument(result), this._scopeRef.callFrameId, this._scopeRef.functionId, setVariableValueCallback.bind(this)); |
/** |
* @param {?Protocol.Error} error |