diff --git a/background/usercss-helper.js b/background/usercss-helper.js index c2f2fe84..32525b28 100644 --- a/background/usercss-helper.js +++ b/background/usercss-helper.js @@ -40,14 +40,13 @@ if (style.usercssData) { return Promise.resolve(style); } - try { - const {sourceCode} = style; - // allow sourceCode to be normalized - delete style.sourceCode; - return Promise.resolve(Object.assign(usercss.buildMeta(sourceCode), style)); - } catch (e) { - return Promise.reject(e); - } + + // allow sourceCode to be normalized + const {sourceCode} = style; + delete style.sourceCode; + + return usercss.buildMeta(sourceCode) + .then(newStyle => Object.assign(newStyle, style)); } function assignVars(style) { @@ -59,7 +58,8 @@ style.id = dup.id; if (style.reason !== 'config') { // preserve style.vars during update - usercss.assignVars(style, dup); + return usercss.assignVars(style, dup) + .then(() => style); } } return style;