diff --git a/backup/fileSaveLoad.js b/backup/fileSaveLoad.js index 23ab0de5..501c1aa0 100644 --- a/backup/fileSaveLoad.js +++ b/backup/fileSaveLoad.js @@ -102,7 +102,8 @@ function importFromString(jsonString) { item.name = item.name.trim(); const byId = BG.cachedStyles.byId.get(item.id); const byName = oldStylesByName.get(item.name); - const oldStyle = byId && byId.name.trim() == item.name || !byName ? byId : byName; + const oldStyle = byId && sameStyle(byId, item) ? byId : byName; + oldStylesByName.delete(item.name); if (oldStyle == byName && byName) { item.id = byName.id; } @@ -119,6 +120,12 @@ function importFromString(jsonString) { return {oldStyle, metaEqual, codeEqual}; } + function sameStyle(oldStyle, newStyle) { + return oldStyle.name.trim() === newStyle.name.trim() || + ['updateUrl', 'originalMd5', 'originalDigest'] + .some(field => oldStyle[field] && oldStyle[field] == newStyle[field]); + } + function account({style, info, resolve}) { renderQueue.push(style); if (performance.now() - lastRenderTime > RENDER_NAP_TIME_MAX