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}}', autoCommentFilterTemplate: '{{date}} {{origin}}',
autoUpdateAssetFetchPeriod: 120, autoUpdateAssetFetchPeriod: 120,
autoUpdatePeriod: 7, autoUpdatePeriod: 7,
cacheStorageAPI: 'unset',
cacheStorageCompression: true, cacheStorageCompression: true,
cacheControlForFirefox1376932: 'no-cache, no-store, must-revalidate', cacheControlForFirefox1376932: 'no-cache, no-store, must-revalidate',
debugScriptlets: false, debugScriptlets: false,

View File

@ -48,9 +48,12 @@
// https://github.com/uBlockOrigin/uBlock-issues/issues/328 // https://github.com/uBlockOrigin/uBlock-issues/issues/328
// Use IndexedDB for Chromium as well, to take advantage of LZ4 // Use IndexedDB for Chromium as well, to take advantage of LZ4
// compression. // compression.
// https://github.com/uBlockOrigin/uBlock-issues/issues/399
// Revert Chromium support of IndexedDB, use advanced setting to force
// IndexedDB.
if ( if (
vAPI.webextFlavor.soup.has('firefox') === false && 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. // In case IndexedDB was used as cache storage, remove it.
indexedDB.deleteDatabase(STORAGE_NAME); indexedDB.deleteDatabase(STORAGE_NAME);

View File

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