Safari: seamless transfer of settings to proper storage

This commit is contained in:
Chris 2015-03-14 18:13:00 -06:00
parent 441c1dd822
commit 2d30b04973
1 changed files with 10 additions and 0 deletions

View File

@ -105,6 +105,16 @@
size: storageQuota,
storeName: "keyvaluepairs"
});
var oldSettings = safari.extension.settings; // To smoothly transition users
if(oldSettings.hasOwnProperty("version")) { // Old 'storage'!
for(var key in oldSettings) {
if(!oldSettings.hasOwnProperty(key) || key === "open_prefs") {
continue;
}
localforage.setItem(key, oldSettings[key]);
}
oldSettings.clear();
}
vAPI.storage = {
QUOTA_BYTES: storageQuota, // copied from Info.plist