1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-06 01:27:12 +02:00
This commit is contained in:
gorhill 2015-11-06 10:17:32 -05:00
parent 0949cc6ac7
commit 18a95a922c

View File

@ -192,11 +192,13 @@ vAPI.browserSettings = {
}, },
set: function(details) { set: function(details) {
var value; var settingVal;
var prefName, prefVal;
for ( var setting in details ) { for ( var setting in details ) {
if ( details.hasOwnProperty(setting) === false ) { if ( details.hasOwnProperty(setting) === false ) {
continue; continue;
} }
settingVal = !!details[setting];
switch ( setting ) { switch ( setting ) {
case 'prefetching': case 'prefetching':
this.rememberOriginalValue('network', 'prefetch-next'); this.rememberOriginalValue('network', 'prefetch-next');
@ -204,10 +206,9 @@ vAPI.browserSettings = {
// https://bugzilla.mozilla.org/show_bug.cgi?id=814169 // https://bugzilla.mozilla.org/show_bug.cgi?id=814169
// Sigh. // Sigh.
this.rememberOriginalValue('network.http', 'speculative-parallel-limit'); this.rememberOriginalValue('network.http', 'speculative-parallel-limit');
value = !!details[setting];
// https://github.com/gorhill/uBlock/issues/292 // https://github.com/gorhill/uBlock/issues/292
// "true" means "do not disable", i.e. leave entry alone // "true" means "do not disable", i.e. leave entry alone
if ( value === true ) { if ( settingVal ) {
this.clear('network', 'prefetch-next'); this.clear('network', 'prefetch-next');
this.clear('network.http', 'speculative-parallel-limit'); this.clear('network.http', 'speculative-parallel-limit');
} else { } else {
@ -219,10 +220,9 @@ vAPI.browserSettings = {
case 'hyperlinkAuditing': case 'hyperlinkAuditing':
this.rememberOriginalValue('browser', 'send_pings'); this.rememberOriginalValue('browser', 'send_pings');
this.rememberOriginalValue('beacon', 'enabled'); this.rememberOriginalValue('beacon', 'enabled');
value = !!details[setting];
// https://github.com/gorhill/uBlock/issues/292 // https://github.com/gorhill/uBlock/issues/292
// "true" means "do not disable", i.e. leave entry alone // "true" means "do not disable", i.e. leave entry alone
if ( value === true ) { if ( settingVal ) {
this.clear('browser', 'send_pings'); this.clear('browser', 'send_pings');
this.clear('beacon', 'enabled'); this.clear('beacon', 'enabled');
} else { } else {
@ -231,13 +231,24 @@ vAPI.browserSettings = {
} }
break; break;
// https://github.com/gorhill/uBlock/issues/894
// Do not disable completely WebRTC if it can be avoided. FF42+
// has a `media.peerconnection.ice.default_address_only` pref which
// purpose is to prevent local IP address leakage.
case 'webrtcIPAddress': case 'webrtcIPAddress':
this.rememberOriginalValue('media.peerconnection', 'enabled'); if ( this.getValue('media.peerconnection', 'ice.default_address_only') !== undefined ) {
value = !!details[setting]; prefName = 'ice.default_address_only';
if ( value === true ) { prefVal = true;
this.clear('media.peerconnection', 'enabled');
} else { } else {
this.setValue('media.peerconnection', 'enabled', false); prefName = 'enabled';
prefVal = false;
}
this.rememberOriginalValue('media.peerconnection', prefName);
if ( settingVal ) {
this.clear('media.peerconnection', prefName);
} else {
this.setValue('media.peerconnection', prefName, prefVal);
} }
break; break;