1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 03:12:33 +01:00

Do not fall back to alternative cache backend if selected one fails

Default behavior is to fall back to an alternative backend
if the uBO-selected one is not available. However there will be
no fall back when the `cacheStorageAPI` is set to one specific
backend by the user.
This commit is contained in:
Raymond Hill 2019-02-20 07:05:45 -05:00
parent 87feb47b51
commit b585518c00
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -112,15 +112,16 @@
});
});
},
select: function(backend) {
if ( backend === undefined || backend === 'unset' ) {
backend = vAPI.webextFlavor.soup.has('firefox')
select: function(selectedBackend) {
let actualBackend = selectedBackend;
if ( actualBackend === undefined || actualBackend === 'unset' ) {
actualBackend = vAPI.webextFlavor.soup.has('firefox')
? 'indexedDB'
: 'browser.storage.local';
}
if ( backend === 'indexedDB' ) {
if ( actualBackend === 'indexedDB' ) {
return selectIDB().then(success => {
if ( success ) {
if ( success || selectedBackend === 'indexedDB' ) {
clearWebext();
return 'indexedDB';
}
@ -128,7 +129,7 @@
return 'browser.storage.local';
});
}
if ( backend === 'browser.storage.local' ) {
if ( actualBackend === 'browser.storage.local' ) {
clearIDB();
}
return Promise.resolve('browser.storage.local');