mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
change of heart on how to migrate legacy storage
This commit is contained in:
parent
1b1e982835
commit
419fad084e
2 changed files with 11 additions and 8 deletions
10
platform/webext/bootstrap.js
vendored
10
platform/webext/bootstrap.js
vendored
|
|
@ -46,6 +46,9 @@ function startup({ webExtension }) {
|
|||
});
|
||||
return true;
|
||||
}
|
||||
if ( message.what === 'webext:storageMigrateDone' ) {
|
||||
browser.runtime.onMessage.removeListener(onMessage);
|
||||
}
|
||||
if ( typeof callback === 'function' ) {
|
||||
callback();
|
||||
}
|
||||
|
|
@ -262,13 +265,6 @@ var getStorageMigrator = function() {
|
|||
|
||||
let markAsDone = function() {
|
||||
close();
|
||||
let { Services } = Components.utils.import('resource://gre/modules/Services.jsm', null),
|
||||
path = Services.dirsvc.get('ProfD', Components.interfaces.nsIFile);
|
||||
path.append('extension-data');
|
||||
path.append(hostName + '.sqlite');
|
||||
if ( path.exists() && path.isFile() ) {
|
||||
path.renameTo(null, hostName + '.migrated.sqlite');
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,14 @@
|
|||
});
|
||||
};
|
||||
|
||||
migrateNext();
|
||||
self.browser.storage.local.get('legacyStorageMigrated', bin => {
|
||||
if ( bin && bin.legacyStorageMigrated ) {
|
||||
self.browser.runtime.sendMessage({ what: 'webext:storageMigrateDone' });
|
||||
return callback();
|
||||
}
|
||||
self.browser.storage.local.set({ legacyStorageMigrated: true });
|
||||
migrateNext();
|
||||
});
|
||||
};
|
||||
|
||||
µb.onBeforeStartQueue.push(migrateAll);
|
||||
|
|
|
|||
Loading…
Reference in a new issue