1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 11:22:38 +01:00

Re. #540: disabling local mirroring for the time being

This commit is contained in:
gorhill 2015-01-18 19:17:36 -05:00
parent ee1f861deb
commit de88721132
4 changed files with 34 additions and 11 deletions

View File

@ -658,7 +658,12 @@
µb.assets.allowRemoteFetch = false; µb.assets.allowRemoteFetch = false;
µb.assets.autoUpdate = userSettings.autoUpdate; µb.assets.autoUpdate = userSettings.autoUpdate;
µb.fromSelfie(onSelfieReady); µb.fromSelfie(onSelfieReady);
// https://github.com/gorhill/uBlock/issues/540
// Disabling local mirroring for the time being
userSettings.experimentalEnabled = false;
µb.mirrors.toggle(userSettings.experimentalEnabled); µb.mirrors.toggle(userSettings.experimentalEnabled);
µb.contextMenu.toggle(userSettings.contextMenuEnabled); µb.contextMenu.toggle(userSettings.contextMenuEnabled);
µb.dynamicNetFilteringEngine.fromString(userSettings.dynamicFilteringString); µb.dynamicNetFilteringEngine.fromString(userSettings.dynamicFilteringString);

View File

@ -120,13 +120,14 @@ var onBeforeRequest = function(details) {
// https://code.google.com/p/chromium/issues/detail?id=387198 // https://code.google.com/p/chromium/issues/detail?id=387198
// Not all redirects will succeed, until bug above is fixed. // Not all redirects will succeed, until bug above is fixed.
var redirectURL = pageStore.toMirrorURL(requestURL); // https://github.com/gorhill/uBlock/issues/540
if ( redirectURL !== '' ) { // Disabling local mirroring for the time being
pageStore.logBuffer.writeOne(requestContext, 'ma:'); //var redirectURL = pageStore.toMirrorURL(requestURL);
//if ( redirectURL !== '' ) {
// pageStore.logBuffer.writeOne(requestContext, 'ma:');
//console.debug('"%s" redirected to "%s..."', requestURL.slice(0, 50), redirectURL.slice(0, 50)); //console.debug('"%s" redirected to "%s..."', requestURL.slice(0, 50), redirectURL.slice(0, 50));
return { redirectUrl: redirectURL }; // return { redirectUrl: redirectURL };
} //}
pageStore.logBuffer.writeOne(requestContext, result); pageStore.logBuffer.writeOne(requestContext, result);
@ -251,9 +252,11 @@ var onHeadersReceived = function(details) {
} }
// https://github.com/gorhill/uBlock/issues/384 // https://github.com/gorhill/uBlock/issues/384
if ( details.parentFrameId === -1 ) { // https://github.com/gorhill/uBlock/issues/540
pageStore.skipLocalMirroring = headerValue(details.responseHeaders, 'content-security-policy'); // Disabling local mirroring for the time being
} //if ( details.parentFrameId === -1 ) {
// pageStore.skipLocalMirroring = headerStartWith(details.responseHeaders, 'content-security-policy') !== '';
//}
var requestURL = details.url; var requestURL = details.url;
var requestHostname = µb.URI.hostnameFromURI(requestURL); var requestHostname = µb.URI.hostnameFromURI(requestURL);
@ -321,6 +324,19 @@ var headerValue = function(headers, name) {
/******************************************************************************/ /******************************************************************************/
var headerStartWith = function(headers, prefix) {
var prefixLen = prefix.length;
var i = headers.length;
while ( i-- ) {
if ( headers[i].name.slice(0, prefixLen).toLowerCase() === prefix ) {
return headers[i].value;
}
}
return '';
};
/******************************************************************************/
vAPI.net.onBeforeRequest = { vAPI.net.onBeforeRequest = {
urls: [ urls: [
'http://*/*', 'http://*/*',

View File

@ -267,7 +267,9 @@ var matchWhitelistDirective = function(url, hostname, directive) {
break; break;
case 'experimentalEnabled': case 'experimentalEnabled':
if ( typeof this.mirrors === 'object' ) { if ( typeof this.mirrors === 'object' ) {
this.mirrors.toggle(value); // https://github.com/gorhill/uBlock/issues/540
// Disabling local mirroring for the time being
this.mirrors.toggle(false /* value */);
} }
break; break;
default: default:

View File

@ -24,7 +24,7 @@ ul {
<li><input id="context-menu-enabled" type="checkbox"><label data-i18n="settingsContextMenuPrompt" for="context-menu-enabled"></label> <li><input id="context-menu-enabled" type="checkbox"><label data-i18n="settingsContextMenuPrompt" for="context-menu-enabled"></label>
<li><input id="advanced-user-enabled" type="checkbox"><label data-i18n="settingsAdvancedUserPrompt" for="advanced-user-enabled"></label> <li><input id="advanced-user-enabled" type="checkbox"><label data-i18n="settingsAdvancedUserPrompt" for="advanced-user-enabled"></label>
<li><input id="experimental-enabled" type="checkbox"><label data-i18n="settingsExperimentalPrompt" for="experimental-enabled"></label> <!-- <li><input id="experimental-enabled" type="checkbox" disabled><label data-i18n="settingsExperimentalPrompt" for="experimental-enabled"></label> -->
</ul> </ul>
<div style="margin:3em 0;border-top:1px solid #ccc;"></div> <div style="margin:3em 0;border-top:1px solid #ccc;"></div>