Support disabling advanced setting `cacheControlForFirefox1376932`

Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/229#issuecomment-520810161

Setting `cacheControlForFirefox1376932` to `unset` will
prevent modification of the `Cache-Control` header.
This commit is contained in:
Raymond Hill 2019-08-13 08:49:37 -04:00
parent 970164e78d
commit 52925ba2f9
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 8 additions and 6 deletions

View File

@ -483,8 +483,9 @@ const onHeadersReceived = function(details) {
// Use `no-cache` instead of `no-cache, no-store, must-revalidate`, this // Use `no-cache` instead of `no-cache, no-store, must-revalidate`, this
// allows Firefox's offline mode to work as expected. // allows Firefox's offline mode to work as expected.
if ( (filteredHTML || modifiedHeaders) && dontCacheResponseHeaders ) { if ( (filteredHTML || modifiedHeaders) && dontCacheResponseHeaders ) {
let i = headerIndexFromName('cache-control', responseHeaders);
let cacheControl = µb.hiddenSettings.cacheControlForFirefox1376932; let cacheControl = µb.hiddenSettings.cacheControlForFirefox1376932;
if ( cacheControl !== 'unset' ) {
let i = headerIndexFromName('cache-control', responseHeaders);
if ( i !== -1 ) { if ( i !== -1 ) {
responseHeaders[i].value = cacheControl; responseHeaders[i].value = cacheControl;
} else { } else {
@ -492,6 +493,7 @@ const onHeadersReceived = function(details) {
} }
modifiedHeaders = true; modifiedHeaders = true;
} }
}
if ( modifiedHeaders ) { if ( modifiedHeaders ) {
return { responseHeaders: responseHeaders }; return { responseHeaders: responseHeaders };