| 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..e444f2d37f2e30bb4fc2e9c9787dcd0ea7200885 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,15 @@ Protocol.InspectorBackend._AgentPrototype = class {
|
| }
|
| var userCallback = (args.length && typeof args.peekLast() === 'function') ? args.pop() : null;
|
| var params = this._prepareParameters(method, signature, args, !userCallback, onError);
|
| - if (errorMessage)
|
| - return Promise.reject(new Error(errorMessage));
|
| - else
|
| - return new Promise(promiseAction.bind(this));
|
| + var responseArguments;
|
| + if (errorMessage) {
|
| + responseArguments = [errorMessage];
|
| + return Promise.resolve().then(runUserCallback);
|
| + }
|
| + return new Promise(promiseAction.bind(this)).then(runUserCallback);
|
|
|
| /**
|
| - * @param {function(?)} resolve
|
| + * @param {function()} resolve
|
| * @param {function(!Error)} reject
|
| * @this {Protocol.InspectorBackend._AgentPrototype}
|
| */
|
| @@ -614,11 +616,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() {
|
| + return userCallback ? userCallback.apply(null, responseArguments) : undefined;
|
| + }
|
| }
|
|
|
| /**
|
|
|