Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3804)

Unified Diff: Source/devtools/front_end/RemoteObject.js

Issue 200423008: DevTools: Extend Runtime.CallArgument to pass numbers that can not be JSON-stringified. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/InjectedScriptSource.js ('k') | Source/devtools/protocol.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/RemoteObject.js
diff --git a/Source/devtools/front_end/RemoteObject.js b/Source/devtools/front_end/RemoteObject.js
index 3e49d096292971d32438fd6e4a5df103a8d8e4f9..4779c0566e103de58af12555b88ffafb4a6bd0bc 100644
--- a/Source/devtools/front_end/RemoteObject.js
+++ b/Source/devtools/front_end/RemoteObject.js
@@ -214,7 +214,11 @@ WebInspector.RemoteObjectImpl = function(target, objectId, type, subtype, value,
console.assert(type !== "object" || value === null);
this._description = description || (value + "");
this._hasChildren = false;
- this.value = value;
+ // Handle special numbers: NaN, Infinity, -Infinity, -0.
+ if (type === "number" && typeof value !== "number")
+ this.value = Number(value);
+ else
+ this.value = value;
}
}
@@ -385,12 +389,8 @@ WebInspector.RemoteObjectImpl.prototype = {
// where property was defined; so do we.
var setPropertyValueFunction = "function(a, b) { this[a] = b; }";
- // Special case for NaN, Infinity, -Infinity, -0.
- if (result.type === "number" && String(result.value) !== result.description)
- setPropertyValueFunction = "function(a) { this[a] = " + result.description + "; }";
-
- delete result.description; // Optimize on traffic.
- this._runtimeAgent.callFunctionOn(this._objectId, setPropertyValueFunction, [{ value:name }, result], true, undefined, undefined, propertySetCallback.bind(this));
+ var argv = [{ value: name }, this._toCallArgument(result)]
+ this._runtimeAgent.callFunctionOn(this._objectId, setPropertyValueFunction, argv, true, undefined, undefined, propertySetCallback.bind(this));
/**
* @param {?Protocol.Error} error
@@ -408,6 +408,15 @@ 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)
@@ -645,21 +654,7 @@ WebInspector.ScopeRemoteObject.prototype = {
*/
doSetObjectPropertyValue: function(result, name, callback)
{
- var newValue;
-
- switch (result.type) {
- case "undefined":
- newValue = {};
- break;
- case "object":
- case "function":
- newValue = { objectId: result.objectId };
- break;
- default:
- newValue = { value: result.value };
- }
-
- this._debuggerAgent.setVariableValue(this._scopeRef.number, name, newValue, this._scopeRef.callFrameId, this._scopeRef.functionId, setVariableValueCallback.bind(this));
+ this._debuggerAgent.setVariableValue(this._scopeRef.number, name, this._toCallArgument(result), this._scopeRef.callFrameId, this._scopeRef.functionId, setVariableValueCallback.bind(this));
/**
* @param {?Protocol.Error} error
« no previous file with comments | « Source/core/inspector/InjectedScriptSource.js ('k') | Source/devtools/protocol.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698