From a026e9ae548bf4ac46edceb743a8ceb5bbfee1af Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 25 Jan 2019 18:49:30 -0500 Subject: [PATCH] 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`. --- src/js/background.js | 1 + src/js/cachestorage.js | 5 ++++- src/js/storage.js | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/js/background.js b/src/js/background.js index 8f4a70a93..37dff9d9f 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -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, diff --git a/src/js/cachestorage.js b/src/js/cachestorage.js index 64fa9287c..6e333af5c 100644 --- a/src/js/cachestorage.js +++ b/src/js/cachestorage.js @@ -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); diff --git a/src/js/storage.js b/src/js/storage.js index c02bf557e..52b3eef6f 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -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, }) ); };