| OLD | NEW |
| 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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 */ | 761 */ |
| 762 doSetObjectPropertyValue: function(result, name, callback) | 762 doSetObjectPropertyValue: function(result, name, callback) |
| 763 { | 763 { |
| 764 // This assignment may be for a regular (data) property, and for an acce
ssor property (with getter/setter). | 764 // This assignment may be for a regular (data) property, and for an acce
ssor property (with getter/setter). |
| 765 // Note the sensitive matter about accessor property: the property may b
e physically defined in some proto object, | 765 // Note the sensitive matter about accessor property: the property may b
e physically defined in some proto object, |
| 766 // but logically it is bound to the object in question. JavaScript passe
s this object to getters/setters, not the object | 766 // but logically it is bound to the object in question. JavaScript passe
s this object to getters/setters, not the object |
| 767 // where property was defined; so do we. | 767 // where property was defined; so do we. |
| 768 var setPropertyValueFunction = "function(a, b) { this[a] = b; }"; | 768 var setPropertyValueFunction = "function(a, b) { this[a] = b; }"; |
| 769 | 769 |
| 770 var argv = [name, WebInspector.RemoteObject.toCallArgument(result)]; | 770 var argv = [name, WebInspector.RemoteObject.toCallArgument(result)]; |
| 771 this._runtimeAgent.callFunctionOn(this._objectId, setPropertyValueFuncti
on, argv, true, undefined, undefined, propertySetCallback); | 771 this._runtimeAgent.callFunctionOn(this._objectId, setPropertyValueFuncti
on, argv, true, undefined, undefined, undefined, propertySetCallback); |
| 772 | 772 |
| 773 /** | 773 /** |
| 774 * @param {?Protocol.Error} error | 774 * @param {?Protocol.Error} error |
| 775 * @param {!RuntimeAgent.RemoteObject} result | 775 * @param {!RuntimeAgent.RemoteObject} result |
| 776 * @param {boolean=} wasThrown | 776 * @param {boolean=} wasThrown |
| 777 */ | 777 */ |
| 778 function propertySetCallback(error, result, wasThrown) | 778 function propertySetCallback(error, result, wasThrown) |
| 779 { | 779 { |
| 780 if (error || wasThrown) { | 780 if (error || wasThrown) { |
| 781 callback(error || result.description); | 781 callback(error || result.description); |
| 782 return; | 782 return; |
| 783 } | 783 } |
| 784 callback(); | 784 callback(); |
| 785 } | 785 } |
| 786 }, | 786 }, |
| 787 | 787 |
| 788 /** | 788 /** |
| 789 * @override | 789 * @override |
| 790 * @param {!RuntimeAgent.CallArgument} name | 790 * @param {!RuntimeAgent.CallArgument} name |
| 791 * @param {function(string=)} callback | 791 * @param {function(string=)} callback |
| 792 */ | 792 */ |
| 793 deleteProperty: function(name, callback) | 793 deleteProperty: function(name, callback) |
| 794 { | 794 { |
| 795 if (!this._objectId) { | 795 if (!this._objectId) { |
| 796 callback("Can't delete a property of non-object."); | 796 callback("Can't delete a property of non-object."); |
| 797 return; | 797 return; |
| 798 } | 798 } |
| 799 | 799 |
| 800 var deletePropertyFunction = "function(a) { delete this[a]; return !(a i
n this); }"; | 800 var deletePropertyFunction = "function(a) { delete this[a]; return !(a i
n this); }"; |
| 801 this._runtimeAgent.callFunctionOn(this._objectId, deletePropertyFunction
, [name], true, undefined, undefined, deletePropertyCallback); | 801 this._runtimeAgent.callFunctionOn(this._objectId, deletePropertyFunction
, [name], true, undefined, undefined, undefined, deletePropertyCallback); |
| 802 | 802 |
| 803 /** | 803 /** |
| 804 * @param {?Protocol.Error} error | 804 * @param {?Protocol.Error} error |
| 805 * @param {!RuntimeAgent.RemoteObject} result | 805 * @param {!RuntimeAgent.RemoteObject} result |
| 806 * @param {boolean=} wasThrown | 806 * @param {boolean=} wasThrown |
| 807 */ | 807 */ |
| 808 function deletePropertyCallback(error, result, wasThrown) | 808 function deletePropertyCallback(error, result, wasThrown) |
| 809 { | 809 { |
| 810 if (error || wasThrown) { | 810 if (error || wasThrown) { |
| 811 callback(error || result.description); | 811 callback(error || result.description); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 835 function mycallback(error, result, wasThrown) | 835 function mycallback(error, result, wasThrown) |
| 836 { | 836 { |
| 837 if (!callback) | 837 if (!callback) |
| 838 return; | 838 return; |
| 839 if (error) | 839 if (error) |
| 840 callback(null, false); | 840 callback(null, false); |
| 841 else | 841 else |
| 842 callback(this.target().runtimeModel.createRemoteObject(result),
wasThrown); | 842 callback(this.target().runtimeModel.createRemoteObject(result),
wasThrown); |
| 843 } | 843 } |
| 844 | 844 |
| 845 this._runtimeAgent.callFunctionOn(this._objectId, functionDeclaration.to
String(), args, true, undefined, undefined, mycallback.bind(this)); | 845 this._runtimeAgent.callFunctionOn(this._objectId, functionDeclaration.to
String(), args, true, undefined, undefined, undefined, mycallback.bind(this)); |
| 846 }, | 846 }, |
| 847 | 847 |
| 848 /** | 848 /** |
| 849 * @override | 849 * @override |
| 850 * @param {function(this:Object)} functionDeclaration | 850 * @param {function(this:Object)} functionDeclaration |
| 851 * @param {!Array.<!RuntimeAgent.CallArgument>|undefined} args | 851 * @param {!Array.<!RuntimeAgent.CallArgument>|undefined} args |
| 852 * @param {function(*)} callback | 852 * @param {function(*)} callback |
| 853 */ | 853 */ |
| 854 callFunctionJSON: function(functionDeclaration, args, callback) | 854 callFunctionJSON: function(functionDeclaration, args, callback) |
| 855 { | 855 { |
| 856 /** | 856 /** |
| 857 * @param {?Protocol.Error} error | 857 * @param {?Protocol.Error} error |
| 858 * @param {!RuntimeAgent.RemoteObject} result | 858 * @param {!RuntimeAgent.RemoteObject} result |
| 859 * @param {boolean=} wasThrown | 859 * @param {boolean=} wasThrown |
| 860 */ | 860 */ |
| 861 function mycallback(error, result, wasThrown) | 861 function mycallback(error, result, wasThrown) |
| 862 { | 862 { |
| 863 callback((error || wasThrown) ? null : result.value); | 863 callback((error || wasThrown) ? null : result.value); |
| 864 } | 864 } |
| 865 | 865 |
| 866 this._runtimeAgent.callFunctionOn(this._objectId, functionDeclaration.to
String(), args, true, true, false, mycallback); | 866 this._runtimeAgent.callFunctionOn(this._objectId, functionDeclaration.to
String(), args, true, true, false, undefined, mycallback); |
| 867 }, | 867 }, |
| 868 | 868 |
| 869 release: function() | 869 release: function() |
| 870 { | 870 { |
| 871 if (!this._objectId) | 871 if (!this._objectId) |
| 872 return; | 872 return; |
| 873 this._runtimeAgent.releaseObject(this._objectId); | 873 this._runtimeAgent.releaseObject(this._objectId); |
| 874 }, | 874 }, |
| 875 | 875 |
| 876 /** | 876 /** |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1627 { | 1627 { |
| 1628 if (!this._cachedDescription) { | 1628 if (!this._cachedDescription) { |
| 1629 var children = this._children(); | 1629 var children = this._children(); |
| 1630 this._cachedDescription = "{" + this._formatValue(children[0].value)
+ " => " + this._formatValue(children[1].value) + "}"; | 1630 this._cachedDescription = "{" + this._formatValue(children[0].value)
+ " => " + this._formatValue(children[1].value) + "}"; |
| 1631 } | 1631 } |
| 1632 return this._cachedDescription; | 1632 return this._cachedDescription; |
| 1633 }, | 1633 }, |
| 1634 | 1634 |
| 1635 __proto__: WebInspector.LocalJSONObject.prototype | 1635 __proto__: WebInspector.LocalJSONObject.prototype |
| 1636 } | 1636 } |
| OLD | NEW |