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

Unified Diff: Source/devtools/front_end/sdk/InspectorBackend.js

Issue 1196193016: DevTools: [CSS] promisify CSS domain (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address comments Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/sdk/CSSStyleModel.js ('k') | Source/devtools/front_end/timeline/TimelineModel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/sdk/InspectorBackend.js
diff --git a/Source/devtools/front_end/sdk/InspectorBackend.js b/Source/devtools/front_end/sdk/InspectorBackend.js
index b5cc305d752858102fd593ee4b9afc5b9ac39b71..4d4e8de197932c455402d487159dddc7a9cac952 100644
--- a/Source/devtools/front_end/sdk/InspectorBackend.js
+++ b/Source/devtools/front_end/sdk/InspectorBackend.js
@@ -760,6 +760,7 @@ InspectorBackendClass.AgentPrototype = function(domain)
}
InspectorBackendClass.AgentPrototype.PromisifiedDomains = {
+ "CSS": true,
"Profiler": true
}
@@ -913,6 +914,7 @@ InspectorBackendClass.AgentPrototype.prototype = {
console.error(message)
errorMessage = message;
}
+ var userCallback = (args.length && typeof args.peekLast() === "function") ? args.pop() : null;
var params = this._prepareParameters(method, signature, args, false, onError);
if (errorMessage)
return Promise.reject(new Error(errorMessage));
@@ -927,17 +929,12 @@ InspectorBackendClass.AgentPrototype.prototype = {
function promiseAction(resolve, reject)
{
/**
- * @param {?Protocol.Error} error
- * @param {?Object} result
+ * @param {...*} vararg
*/
- function callback(error, result)
+ function callback(vararg)
{
- if (error) {
- console.error(error);
- resolve(null);
- return;
- }
- resolve(replyArgs.length ? result : undefined);
+ var result = userCallback ? userCallback.apply(null, arguments) : undefined;
+ resolve(result);
}
this._connection._wrapCallbackAndSendMessageObject(this._domain, method, params, callback);
}
@@ -965,11 +962,6 @@ InspectorBackendClass.AgentPrototype.prototype = {
console.error("Request with id = " + id + " failed. " + JSON.stringify(messageObject.error));
}
- if (this._promisified) {
- callback(messageObject.error && messageObject.error.message, messageObject.result);
- return;
- }
-
var argumentsArray = [];
argumentsArray[0] = messageObject.error ? messageObject.error.message: null;
@@ -1054,7 +1046,6 @@ InspectorBackendClass.DispatcherPrototype.prototype = {
if (InspectorBackendClass.Options.dumpInspectorTimeStats)
console.log("time-stats: " + messageObject.method + " = " + (Date.now() - processingStartTime));
}
-
}
InspectorBackendClass.Options = {
« no previous file with comments | « Source/devtools/front_end/sdk/CSSStyleModel.js ('k') | Source/devtools/front_end/timeline/TimelineModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698