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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js

Issue 2206483002: [DevTools] Add awaitPromise flag for Runtime.callFunctionOn protocol method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-error-string-from-async
Patch Set: rebased Created 4 years, 4 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
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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 */ 687 */
688 doSetObjectPropertyValue: function(result, name, callback) 688 doSetObjectPropertyValue: function(result, name, callback)
689 { 689 {
690 // This assignment may be for a regular (data) property, and for an acce ssor property (with getter/setter). 690 // This assignment may be for a regular (data) property, and for an acce ssor property (with getter/setter).
691 // Note the sensitive matter about accessor property: the property may b e physically defined in some proto object, 691 // Note the sensitive matter about accessor property: the property may b e physically defined in some proto object,
692 // but logically it is bound to the object in question. JavaScript passe s this object to getters/setters, not the object 692 // but logically it is bound to the object in question. JavaScript passe s this object to getters/setters, not the object
693 // where property was defined; so do we. 693 // where property was defined; so do we.
694 var setPropertyValueFunction = "function(a, b) { this[a] = b; }"; 694 var setPropertyValueFunction = "function(a, b) { this[a] = b; }";
695 695
696 var argv = [name, WebInspector.RemoteObject.toCallArgument(result)]; 696 var argv = [name, WebInspector.RemoteObject.toCallArgument(result)];
697 this._runtimeAgent.callFunctionOn(this._objectId, setPropertyValueFuncti on, argv, true, undefined, undefined, undefined, propertySetCallback); 697 this._runtimeAgent.callFunctionOn(this._objectId, setPropertyValueFuncti on, argv, true, undefined, undefined, undefined, undefined, propertySetCallback) ;
698 698
699 /** 699 /**
700 * @param {?Protocol.Error} error 700 * @param {?Protocol.Error} error
701 * @param {!RuntimeAgent.RemoteObject} result 701 * @param {!RuntimeAgent.RemoteObject} result
702 * @param {boolean=} wasThrown 702 * @param {boolean=} wasThrown
703 */ 703 */
704 function propertySetCallback(error, result, wasThrown) 704 function propertySetCallback(error, result, wasThrown)
705 { 705 {
706 if (error || wasThrown) { 706 if (error || wasThrown) {
707 callback(error || result.description); 707 callback(error || result.description);
708 return; 708 return;
709 } 709 }
710 callback(); 710 callback();
711 } 711 }
712 }, 712 },
713 713
714 /** 714 /**
715 * @override 715 * @override
716 * @param {!RuntimeAgent.CallArgument} name 716 * @param {!RuntimeAgent.CallArgument} name
717 * @param {function(string=)} callback 717 * @param {function(string=)} callback
718 */ 718 */
719 deleteProperty: function(name, callback) 719 deleteProperty: function(name, callback)
720 { 720 {
721 if (!this._objectId) { 721 if (!this._objectId) {
722 callback("Can't delete a property of non-object."); 722 callback("Can't delete a property of non-object.");
723 return; 723 return;
724 } 724 }
725 725
726 var deletePropertyFunction = "function(a) { delete this[a]; return !(a i n this); }"; 726 var deletePropertyFunction = "function(a) { delete this[a]; return !(a i n this); }";
727 this._runtimeAgent.callFunctionOn(this._objectId, deletePropertyFunction , [name], true, undefined, undefined, undefined, deletePropertyCallback); 727 this._runtimeAgent.callFunctionOn(this._objectId, deletePropertyFunction , [name], true, undefined, undefined, undefined, undefined, deletePropertyCallba ck);
728 728
729 /** 729 /**
730 * @param {?Protocol.Error} error 730 * @param {?Protocol.Error} error
731 * @param {!RuntimeAgent.RemoteObject} result 731 * @param {!RuntimeAgent.RemoteObject} result
732 * @param {boolean=} wasThrown 732 * @param {boolean=} wasThrown
733 */ 733 */
734 function deletePropertyCallback(error, result, wasThrown) 734 function deletePropertyCallback(error, result, wasThrown)
735 { 735 {
736 if (error || wasThrown) { 736 if (error || wasThrown) {
737 callback(error || result.description); 737 callback(error || result.description);
(...skipping 23 matching lines...) Expand all
761 function mycallback(error, result, wasThrown) 761 function mycallback(error, result, wasThrown)
762 { 762 {
763 if (!callback) 763 if (!callback)
764 return; 764 return;
765 if (error) 765 if (error)
766 callback(null, false); 766 callback(null, false);
767 else 767 else
768 callback(this.target().runtimeModel.createRemoteObject(result), wasThrown); 768 callback(this.target().runtimeModel.createRemoteObject(result), wasThrown);
769 } 769 }
770 770
771 this._runtimeAgent.callFunctionOn(this._objectId, functionDeclaration.to String(), args, true, undefined, undefined, undefined, mycallback.bind(this)); 771 this._runtimeAgent.callFunctionOn(this._objectId, functionDeclaration.to String(), args, true, undefined, undefined, undefined, undefined, mycallback.bin d(this));
772 }, 772 },
773 773
774 /** 774 /**
775 * @override 775 * @override
776 * @param {function(this:Object)} functionDeclaration 776 * @param {function(this:Object)} functionDeclaration
777 * @param {!Array.<!RuntimeAgent.CallArgument>|undefined} args 777 * @param {!Array.<!RuntimeAgent.CallArgument>|undefined} args
778 * @param {function(*)} callback 778 * @param {function(*)} callback
779 */ 779 */
780 callFunctionJSON: function(functionDeclaration, args, callback) 780 callFunctionJSON: function(functionDeclaration, args, callback)
781 { 781 {
782 /** 782 /**
783 * @param {?Protocol.Error} error 783 * @param {?Protocol.Error} error
784 * @param {!RuntimeAgent.RemoteObject} result 784 * @param {!RuntimeAgent.RemoteObject} result
785 * @param {boolean=} wasThrown 785 * @param {boolean=} wasThrown
786 */ 786 */
787 function mycallback(error, result, wasThrown) 787 function mycallback(error, result, wasThrown)
788 { 788 {
789 callback((error || wasThrown) ? null : result.value); 789 callback((error || wasThrown) ? null : result.value);
790 } 790 }
791 791
792 this._runtimeAgent.callFunctionOn(this._objectId, functionDeclaration.to String(), args, true, true, false, undefined, mycallback); 792 this._runtimeAgent.callFunctionOn(this._objectId, functionDeclaration.to String(), args, true, true, false, undefined, undefined, mycallback);
793 }, 793 },
794 794
795 release: function() 795 release: function()
796 { 796 {
797 if (!this._objectId) 797 if (!this._objectId)
798 return; 798 return;
799 this._runtimeAgent.releaseObject(this._objectId); 799 this._runtimeAgent.releaseObject(this._objectId);
800 }, 800 },
801 801
802 /** 802 /**
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 }, 1509 },
1510 1510
1511 /** 1511 /**
1512 * @return {!WebInspector.RemoteObject} 1512 * @return {!WebInspector.RemoteObject}
1513 */ 1513 */
1514 object: function() 1514 object: function()
1515 { 1515 {
1516 return this._object; 1516 return this._object;
1517 } 1517 }
1518 } 1518 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698