| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 return this._removeFunction; | 803 return this._removeFunction; |
| 804 }, | 804 }, |
| 805 | 805 |
| 806 /** | 806 /** |
| 807 * @return {!Promise<undefined>} | 807 * @return {!Promise<undefined>} |
| 808 */ | 808 */ |
| 809 remove: function() | 809 remove: function() |
| 810 { | 810 { |
| 811 if (!this._removeFunction) | 811 if (!this._removeFunction) |
| 812 return Promise.resolve(); | 812 return Promise.resolve(); |
| 813 return new Promise(promiseConstructor.bind(this)); | 813 return this._removeFunction.callFunctionPromise(callCustomRemove, [ |
| 814 | |
| 815 /** | |
| 816 * @param {function()} success | |
| 817 * @this {WebInspector.EventListener} | |
| 818 */ | |
| 819 function promiseConstructor(success) | |
| 820 { | |
| 821 this._removeFunction.callFunction(callCustomRemove, [ | |
| 822 WebInspector.RemoteObject.toCallArgument(this._removeFunction), | |
| 823 WebInspector.RemoteObject.toCallArgument(this._type), | 814 WebInspector.RemoteObject.toCallArgument(this._type), |
| 824 WebInspector.RemoteObject.toCallArgument(this._originalHandler), | 815 WebInspector.RemoteObject.toCallArgument(this._originalHandler), |
| 825 WebInspector.RemoteObject.toCallArgument(this._useCapture), | 816 WebInspector.RemoteObject.toCallArgument(this._useCapture), |
| 826 WebInspector.RemoteObject.toCallArgument(this._passive), | 817 WebInspector.RemoteObject.toCallArgument(this._passive), |
| 827 ], success); | 818 ]).then(() => undefined); |
| 828 | 819 |
| 829 /** | 820 /** |
| 830 * @param {function(string, function(), boolean, boolean)} func | 821 * @param {string} type |
| 831 * @param {string} type | 822 * @param {function()} listener |
| 832 * @param {function()} listener | 823 * @param {boolean} useCapture |
| 833 * @param {boolean} useCapture | 824 * @param {boolean} passive |
| 834 * @param {boolean} passive | 825 * @this {Function} |
| 835 */ | 826 * @suppressReceiverCheck |
| 836 function callCustomRemove(func, type, listener, useCapture, passive) | 827 */ |
| 837 { | 828 function callCustomRemove(type, listener, useCapture, passive) |
| 838 func.call(null, type, listener, useCapture, passive); | 829 { |
| 839 } | 830 this.call(null, type, listener, useCapture, passive); |
| 840 } | 831 } |
| 841 }, | 832 }, |
| 842 | 833 |
| 843 /** | 834 /** |
| 844 * @return {string} | 835 * @return {string} |
| 845 */ | 836 */ |
| 846 listenerType: function() | 837 listenerType: function() |
| 847 { | 838 { |
| 848 return this._listenerType; | 839 return this._listenerType; |
| 849 }, | 840 }, |
| 850 | 841 |
| 851 /** | 842 /** |
| 852 * @param {string} listenerType | 843 * @param {string} listenerType |
| 853 */ | 844 */ |
| 854 setListenerType: function(listenerType) | 845 setListenerType: function(listenerType) |
| 855 { | 846 { |
| 856 this._listenerType = listenerType; | 847 this._listenerType = listenerType; |
| 857 }, | 848 }, |
| 858 | 849 |
| 859 __proto__: WebInspector.SDKObject.prototype | 850 __proto__: WebInspector.SDKObject.prototype |
| 860 } | 851 } |
| OLD | NEW |