Importing settings file with an older storage version did not work properly

This commit is contained in:
kkapsner 2020-01-01 16:04:44 +01:00
parent 85c88ad3d8
commit b361733c73
2 changed files with 10 additions and 4 deletions

View File

@ -110,10 +110,13 @@
});
input.click();
});
let json = JSON.parse(text);
const json = JSON.parse(text);
while (settingsMigration.transitions.hasOwnProperty(json.storageVersion)){
let oldVersion = json.storageVersion;
json = settingsMigration.transitions[json.storageVersion](json);
const oldVersion = json.storageVersion;
const modifiedData = settingsMigration.transitions[json.storageVersion](json);
Object.keys(modifiedData).forEach(function(key){
json[key] = modifiedData[key];
});
if (oldVersion === json.storageVersion){
break;
}
@ -129,7 +132,9 @@
}
});
keys.forEach(function(key){
settings[key] = json[key];
if (key !== "storageVersion"){
settings[key] = json[key];
}
});
},
resetSettings: async function(){

View File

@ -17,6 +17,7 @@ Version 1.0:
- added window.open protection
- cross origin DOM manipulations
- window.name protection was detectable
- importing settings file with an older storage version did not work properly
known issues:
- if a data URL is blocked the page action button does not appear