mirror of https://github.com/gorhill/uBlock.git
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:
parent
87feb47b51
commit
b585518c00
|
@ -112,15 +112,16 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
select: function(backend) {
|
select: function(selectedBackend) {
|
||||||
if ( backend === undefined || backend === 'unset' ) {
|
let actualBackend = selectedBackend;
|
||||||
backend = vAPI.webextFlavor.soup.has('firefox')
|
if ( actualBackend === undefined || actualBackend === 'unset' ) {
|
||||||
|
actualBackend = vAPI.webextFlavor.soup.has('firefox')
|
||||||
? 'indexedDB'
|
? 'indexedDB'
|
||||||
: 'browser.storage.local';
|
: 'browser.storage.local';
|
||||||
}
|
}
|
||||||
if ( backend === 'indexedDB' ) {
|
if ( actualBackend === 'indexedDB' ) {
|
||||||
return selectIDB().then(success => {
|
return selectIDB().then(success => {
|
||||||
if ( success ) {
|
if ( success || selectedBackend === 'indexedDB' ) {
|
||||||
clearWebext();
|
clearWebext();
|
||||||
return 'indexedDB';
|
return 'indexedDB';
|
||||||
}
|
}
|
||||||
|
@ -128,7 +129,7 @@
|
||||||
return 'browser.storage.local';
|
return 'browser.storage.local';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ( backend === 'browser.storage.local' ) {
|
if ( actualBackend === 'browser.storage.local' ) {
|
||||||
clearIDB();
|
clearIDB();
|
||||||
}
|
}
|
||||||
return Promise.resolve('browser.storage.local');
|
return Promise.resolve('browser.storage.local');
|
||||||
|
|
Loading…
Reference in New Issue