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

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

Issue 323423002: DevTools: Deleting object property in console would just assign it to undefined. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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
Index: Source/devtools/front_end/sdk/RemoteObject.js
diff --git a/Source/devtools/front_end/sdk/RemoteObject.js b/Source/devtools/front_end/sdk/RemoteObject.js
index aadeb95b8730d9fc33b45723f9fbe5162c520746..f0d6140c278f37d202a619bfd085f05f1884782f 100644
--- a/Source/devtools/front_end/sdk/RemoteObject.js
+++ b/Source/devtools/front_end/sdk/RemoteObject.js
@@ -86,6 +86,15 @@ WebInspector.RemoteObject.prototype = {
},
/**
+ * @param {string} name
+ * @param {function(string=)} callback
+ */
+ deleteProperty: function(name, callback)
+ {
+ throw "Not implemented";
+ },
+
+ /**
* @param {function(this:Object, ...)} functionDeclaration
* @param {!Array.<!RuntimeAgent.CallArgument>=} args
* @param {function(?WebInspector.RemoteObject, boolean=)=} callback
@@ -428,6 +437,38 @@ WebInspector.RemoteObjectImpl.prototype = {
},
/**
+ * @param {string} name
+ * @param {function(string=)} callback
+ */
+ deleteProperty: function(name, callback)
+ {
+ if (!this._objectId) {
+ callback("Can't delete a property of non-object.");
+ return;
+ }
+
+ var deletePropertyFunction = "function(a) { delete this[a]; return !(a in this); }";
+ this._runtimeAgent.callFunctionOn(this._objectId, deletePropertyFunction, [{ value: name }], true, undefined, undefined, deletePropertyCallback);
+
+ /**
+ * @param {?Protocol.Error} error
+ * @param {!RuntimeAgent.RemoteObject} result
+ * @param {boolean=} wasThrown
+ */
+ function deletePropertyCallback(error, result, wasThrown)
+ {
+ if (error || wasThrown) {
+ callback(error || result.description);
+ return;
+ }
+ if (!result.value)
+ callback("Failed to delete property.");
+ else
+ callback();
+ }
+ },
+
+ /**
* @param {function(?WebInspector.DOMNode)} callback
*/
pushNodeToFrontend: function(callback)

Powered by Google App Engine
This is Rietveld 408576698