From fc53bed3de2ff3704609a40d8e736de7b8de6d18 Mon Sep 17 00:00:00 2001 From: eight Date: Sun, 14 Oct 2018 00:56:04 +0800 Subject: [PATCH] Fix: doo many indents --- background/update.js | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/background/update.js b/background/update.js index 15256fc2..c2ba9e5c 100644 --- a/background/update.js +++ b/background/update.js @@ -153,27 +153,25 @@ function maybeUpdateUsercss() { // TODO: when sourceCode is > 100kB use http range request(s) for version check - 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))) { - case 0: - // re-install is invalid in a soft upgrade - if (!ignoreDigest) { - const sameCode = text === style.sourceCode; - return Promise.reject(sameCode ? STATES.SAME_CODE : STATES.SAME_VERSION); - } - break; - case 1: - // downgrade is always invalid - return Promise.reject(STATES.ERROR_VERSION); + 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))) { + case 0: + // re-install is invalid in a soft upgrade + if (!ignoreDigest) { + const sameCode = text === style.sourceCode; + return Promise.reject(sameCode ? STATES.SAME_CODE : STATES.SAME_VERSION); } - return usercss.buildCode(json); - }) - ); + break; + case 1: + // downgrade is always invalid + return Promise.reject(STATES.ERROR_VERSION); + } + return usercss.buildCode(json); + }) + ); } function maybeSave(json = {}) {