mirror of https://github.com/gorhill/uBlock.git
this fixes #384; more reading required for a long-term solution--if any
This commit is contained in:
parent
6294dea81d
commit
be082cb666
|
@ -308,6 +308,7 @@ PageStore.prototype.init = function(tabId, pageURL) {
|
|||
this.netFilteringReadTime = 0;
|
||||
this.perLoadBlockedRequestCount = 0;
|
||||
this.perLoadAllowedRequestCount = 0;
|
||||
this.skipLocalMirroring = false;
|
||||
|
||||
this.netFilteringCache = NetFilteringResultCache.factory();
|
||||
if ( µb.userSettings.logRequests ) {
|
||||
|
|
|
@ -102,19 +102,28 @@ var onBeforeRequest = function(details) {
|
|||
}
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/351
|
||||
// Bypass experimental features when disabled for a site
|
||||
if ( µb.userSettings.experimentalEnabled && pageStore.getNetFilteringSwitch() ) {
|
||||
// https://code.google.com/p/chromium/issues/detail?id=387198
|
||||
// Not all redirects will succeed, until bug above is fixed.
|
||||
var redirectURL = µb.mirrors.toURL(requestURL, true);
|
||||
if ( redirectURL !== '' ) {
|
||||
pageStore.setRequestFlags(requestURL, 0x01, 0x01);
|
||||
//console.debug('"%s" redirected to "%s..."', requestURL.slice(0, 50), redirectURL.slice(0, 50));
|
||||
return { redirectUrl: redirectURL };
|
||||
}
|
||||
// Bypass experimental features when uBlock is disabled for a site
|
||||
if ( !pageStore.getNetFilteringSwitch() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !µb.userSettings.experimentalEnabled ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( pageStore.skipLocalMirroring ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// https://code.google.com/p/chromium/issues/detail?id=387198
|
||||
// Not all redirects will succeed, until bug above is fixed.
|
||||
var redirectURL = µb.mirrors.toURL(requestURL, true);
|
||||
if ( redirectURL !== '' ) {
|
||||
pageStore.setRequestFlags(requestURL, 0x01, 0x01);
|
||||
//console.debug('"%s" redirected to "%s..."', requestURL.slice(0, 50), redirectURL.slice(0, 50));
|
||||
return { redirectUrl: redirectURL };
|
||||
}
|
||||
|
||||
//console.debug('µBlock> onBeforeRequest()> ALLOW "%s" (%o)', details.url, details);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -236,6 +245,9 @@ var onHeadersReceived = function(details) {
|
|||
return;
|
||||
}
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/384
|
||||
pageStore.skipLocalMirroring = headerValue(details.responseHeaders, 'content-security-policy');
|
||||
|
||||
var result = '';
|
||||
if ( pageStore.getNetFilteringSwitch() ) {
|
||||
result = µb.netFilteringEngine.matchStringExactType(pageStore, details.url, 'inline-script');
|
||||
|
|
Loading…
Reference in New Issue