Fix: buildMeta now returns a promise

This commit is contained in:
eight 2018-09-25 21:11:09 +08:00
parent a004bc3c7d
commit 5d07a8cd4e

View File

@ -145,8 +145,10 @@ global API_METHODS
function maybeUpdateUsercss() {
// TODO: when sourceCode is > 100kB use http range request(s) for version check
return download(style.updateUrl).then(text => {
const json = usercss.buildMeta(text);
return download(style.updateUrl)
.then(text =>
usercss.buildMeta(text)
.then(json => {
const {usercssData: {version}} = style;
const {usercssData: {version: newVersion}} = json;
switch (Math.sign(semverCompare(version, newVersion))) {
@ -162,7 +164,8 @@ global API_METHODS
return Promise.reject(STATES.ERROR_VERSION);
}
return usercss.buildCode(json);
});
})
);
}
function maybeSave(json = {}) {