Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/protocol/InspectorBackend.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/protocol/InspectorBackend.js b/third_party/WebKit/Source/devtools/front_end/protocol/InspectorBackend.js |
| index b1266f916a64ca073a29d0d11c8132e620885d19..c906e02ef7604ab967a46a1a388e783c5d2701ae 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/protocol/InspectorBackend.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/protocol/InspectorBackend.js |
| @@ -599,13 +599,14 @@ Protocol.InspectorBackend._AgentPrototype = class { |
| } |
| var userCallback = (args.length && typeof args.peekLast() === 'function') ? args.pop() : null; |
| var params = this._prepareParameters(method, signature, args, !userCallback, onError); |
| + var responseArguments; |
| if (errorMessage) |
| return Promise.reject(new Error(errorMessage)); |
|
pfeldman
2017/02/16 22:43:02
You aren't calling it here, are you?
|
| else |
| - return new Promise(promiseAction.bind(this)); |
| + return new Promise(promiseAction.bind(this)).then(runUserCallback); |
| /** |
| - * @param {function(?)} resolve |
| + * @param {function()} resolve |
| * @param {function(!Error)} reject |
| * @this {Protocol.InspectorBackend._AgentPrototype} |
| */ |
| @@ -614,11 +615,15 @@ Protocol.InspectorBackend._AgentPrototype = class { |
| * @param {...*} vararg |
| */ |
| function callback(vararg) { |
| - var result = userCallback ? userCallback.apply(null, arguments) : undefined; |
| - resolve(result); |
| + responseArguments = arguments; |
| + resolve(); |
| } |
| this._target._wrapCallbackAndSendMessageObject(this._domain, method, params, callback); |
| } |
| + |
| + function runUserCallback() { |
|
pfeldman
2017/02/16 22:43:02
You are changing the order of callback and promise
|
| + return userCallback ? userCallback.apply(null, responseArguments) : undefined; |
| + } |
| } |
| /** |