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.autoUpdate = userSettings.autoUpdate;
µ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.contextMenu.toggle(userSettings.contextMenuEnabled);
µ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
// Not all redirects will succeed, until bug above is fixed.
var redirectURL = pageStore.toMirrorURL(requestURL);
if ( redirectURL !== '' ) {
pageStore.logBuffer.writeOne(requestContext, 'ma:');
// https://github.com/gorhill/uBlock/issues/540
// Disabling local mirroring for the time being
//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));
return { redirectUrl: redirectURL };
}
// return { redirectUrl: redirectURL };
//}
pageStore.logBuffer.writeOne(requestContext, result);
@ -251,9 +252,11 @@ var onHeadersReceived = function(details) {
}
// https://github.com/gorhill/uBlock/issues/384
if ( details.parentFrameId === -1 ) {
pageStore.skipLocalMirroring = headerValue(details.responseHeaders, 'content-security-policy');
}
// https://github.com/gorhill/uBlock/issues/540
// Disabling local mirroring for the time being
//if ( details.parentFrameId === -1 ) {
// pageStore.skipLocalMirroring = headerStartWith(details.responseHeaders, 'content-security-policy') !== '';
//}
var requestURL = details.url;
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 = {
urls: [
'http://*/*',

View File

@ -267,7 +267,9 @@ var matchWhitelistDirective = function(url, hostname, directive) {
break;
case 'experimentalEnabled':
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;
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="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>
<div style="margin:3em 0;border-top:1px solid #ccc;"></div>