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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 /** 79 /**
80 * @param {boolean} accessorPropertiesOnly 80 * @param {boolean} accessorPropertiesOnly
81 * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!We bInspector.RemoteObjectProperty>)} callback 81 * @param {function(?Array.<!WebInspector.RemoteObjectProperty>, ?Array.<!We bInspector.RemoteObjectProperty>)} callback
82 */ 82 */
83 getAllProperties: function(accessorPropertiesOnly, callback) 83 getAllProperties: function(accessorPropertiesOnly, callback)
84 { 84 {
85 throw "Not implemented"; 85 throw "Not implemented";
86 }, 86 },
87 87
88 /** 88 /**
89 * @param {string} name
90 * @param {function(string=)} callback
91 */
92 deleteProperty: function(name, callback)
93 {
94 throw "Not implemented";
95 },
96
97 /**
89 * @param {function(this:Object, ...)} functionDeclaration 98 * @param {function(this:Object, ...)} functionDeclaration
90 * @param {!Array.<!RuntimeAgent.CallArgument>=} args 99 * @param {!Array.<!RuntimeAgent.CallArgument>=} args
91 * @param {function(?WebInspector.RemoteObject, boolean=)=} callback 100 * @param {function(?WebInspector.RemoteObject, boolean=)=} callback
92 */ 101 */
93 callFunction: function(functionDeclaration, args, callback) 102 callFunction: function(functionDeclaration, args, callback)
94 { 103 {
95 throw "Not implemented"; 104 throw "Not implemented";
96 }, 105 },
97 106
98 /** 107 /**
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 { 430 {
422 if (error || wasThrown) { 431 if (error || wasThrown) {
423 callback(error || result.description); 432 callback(error || result.description);
424 return; 433 return;
425 } 434 }
426 callback(); 435 callback();
427 } 436 }
428 }, 437 },
429 438
430 /** 439 /**
440 * @param {string} name
441 * @param {function(string=)} callback
442 */
443 deleteProperty: function(name, callback)
444 {
445 if (!this._objectId) {
446 callback("Can't delete a property of non-object.");
447 return;
448 }
449
450 var deletePropertyFunction = "function(a) { delete this[a]; return !(a i n this); }";
451 this._runtimeAgent.callFunctionOn(this._objectId, deletePropertyFunction , [{ value: name }], true, undefined, undefined, deletePropertyCallback);
452
453 /**
454 * @param {?Protocol.Error} error
455 * @param {!RuntimeAgent.RemoteObject} result
456 * @param {boolean=} wasThrown
457 */
458 function deletePropertyCallback(error, result, wasThrown)
459 {
460 if (error || wasThrown) {
461 callback(error || result.description);
462 return;
463 }
464 if (!result.value)
465 callback("Failed to delete property.");
466 else
467 callback();
468 }
469 },
470
471 /**
431 * @param {function(?WebInspector.DOMNode)} callback 472 * @param {function(?WebInspector.DOMNode)} callback
432 */ 473 */
433 pushNodeToFrontend: function(callback) 474 pushNodeToFrontend: function(callback)
434 { 475 {
435 if (this.isNode()) 476 if (this.isNode())
436 this._domModel.pushNodeToFrontend(this._objectId, callback); 477 this._domModel.pushNodeToFrontend(this._objectId, callback);
437 else 478 else
438 callback(null); 479 callback(null);
439 }, 480 },
440 481
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 result = functionDeclaration.apply(target, rawArgs); 1007 result = functionDeclaration.apply(target, rawArgs);
967 } catch (e) { 1008 } catch (e) {
968 result = null; 1009 result = null;
969 } 1010 }
970 1011
971 callback(result); 1012 callback(result);
972 }, 1013 },
973 1014
974 __proto__: WebInspector.RemoteObject.prototype 1015 __proto__: WebInspector.RemoteObject.prototype
975 } 1016 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698