Bug 1440322 - Use async/await instead of Task.jsm on devtools/shared/fronts/css-properties.js. r=?
MozReview-Commit-ID: 3NM90kIzqgd
--- a/devtools/shared/fronts/css-properties.js
+++ b/devtools/shared/fronts/css-properties.js
@@ -6,17 +6,16 @@
loader.lazyRequireGetter(this, "CSS_PROPERTIES_DB",
"devtools/shared/css/properties-db", true);
loader.lazyRequireGetter(this, "cssColors",
"devtools/shared/css/color-db", true);
const { FrontClassWithSpec, Front } = require("devtools/shared/protocol");
const { cssPropertiesSpec } = require("devtools/shared/specs/css-properties");
-const { Task } = require("devtools/shared/task");
/**
* Build up a regular expression that matches a CSS variable token. This is an
* ident token that starts with two dashes "--".
*
* https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
*/
var NON_ASCII = "[^\\x00-\\x7F]";
@@ -223,38 +222,38 @@ CssProperties.prototype = {
* is potentially async and should be handled up-front when the tool is created.
*
* The front is returned only with this function so that it can be destroyed
* once the toolbox is destroyed.
*
* @param {Toolbox} The current toolbox.
* @returns {Promise} Resolves to {cssProperties, cssPropertiesFront}.
*/
-const initCssProperties = Task.async(function* (toolbox) {
+const initCssProperties = async function (toolbox) {
const client = toolbox.target.client;
if (cachedCssProperties.has(client)) {
return cachedCssProperties.get(client);
}
let db, front;
// Get the list dynamically if the cssProperties actor exists.
if (toolbox.target.hasActor("cssProperties")) {
front = CssPropertiesFront(client, toolbox.target.form);
- db = yield front.getCSSDatabase();
+ db = await front.getCSSDatabase();
} else {
// The target does not support this actor, so require a static list of supported
// properties.
db = CSS_PROPERTIES_DB;
}
const cssProperties = new CssProperties(normalizeCssData(db));
cachedCssProperties.set(client, {cssProperties, front});
return {cssProperties, front};
-});
+}
/**
* Synchronously get a cached and initialized CssProperties.
*
* @param {Toolbox} The current toolbox.
* @returns {CssProperties}
*/
function getCssProperties(toolbox) {