Fix reverting use of IndexedDB as default cache storage on Chromium

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/399

The advanced setting `cacheStorageAPI` has been added to allow
a user to force the use of IndexedDB as cache storage. Set to
`IndexedDB` to force use of IndexedDB. Default to `unset`.
This commit is contained in:
Raymond Hill 2019-01-25 18:49:30 -05:00
parent 185ebf0d7d
commit a026e9ae54
No known key found for this signature in database
GPG key ID: 25E1490B761470C2
3 changed files with 7 additions and 2 deletions

View file

@ -43,6 +43,7 @@ const µBlock = (function() { // jshint ignore:line
autoCommentFilterTemplate: '{{date}} {{origin}}',
autoUpdateAssetFetchPeriod: 120,
autoUpdatePeriod: 7,
cacheStorageAPI: 'unset',
cacheStorageCompression: true,
cacheControlForFirefox1376932: 'no-cache, no-store, must-revalidate',
debugScriptlets: false,

View file

@ -48,9 +48,12 @@
// https://github.com/uBlockOrigin/uBlock-issues/issues/328
// Use IndexedDB for Chromium as well, to take advantage of LZ4
// compression.
// https://github.com/uBlockOrigin/uBlock-issues/issues/399
// Revert Chromium support of IndexedDB, use advanced setting to force
// IndexedDB.
if (
vAPI.webextFlavor.soup.has('firefox') === false &&
vAPI.webextFlavor.soup.has('chromium') === false
µBlock.hiddenSettings.cacheStorageAPI.toLowerCase() !== 'indexeddb'
) {
// In case IndexedDB was used as cache storage, remove it.
indexedDB.deleteDatabase(STORAGE_NAME);

View file

@ -186,9 +186,10 @@
vAPI.localStorage.setItem(
'immediateHiddenSettings',
JSON.stringify({
cacheStorageAPI: this.hiddenSettings.cacheStorageAPI,
disableWebAssembly: this.hiddenSettings.disableWebAssembly,
suspendTabsUntilReady: this.hiddenSettings.suspendTabsUntilReady,
userResourcesLocation: this.hiddenSettings.userResourcesLocation
userResourcesLocation: this.hiddenSettings.userResourcesLocation,
})
);
};