1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-26 12:22:50 +01:00
This commit is contained in:
gorhill 2015-06-01 15:03:22 -04:00
parent ce9781791e
commit 14371b5d92
8 changed files with 71 additions and 7 deletions

View File

@ -42,13 +42,6 @@ var noopFunc = function(){};
/******************************************************************************/ /******************************************************************************/
// https://github.com/gorhill/uMatrix/issues/234
// https://developer.chrome.com/extensions/privacy#property-network
chrome.privacy.network.networkPredictionEnabled.set({ value: false });
/******************************************************************************/
vAPI.app = { vAPI.app = {
name: manifest.name, name: manifest.name,
version: manifest.version version: manifest.version
@ -68,6 +61,37 @@ vAPI.storage = chrome.storage.local;
/******************************************************************************/ /******************************************************************************/
// https://github.com/gorhill/uMatrix/issues/234
// https://developer.chrome.com/extensions/privacy#property-network
chrome.privacy.network.networkPredictionEnabled.set({
value: false,
scope: 'regular'
});
vAPI.browserSettings = {
set: function(details) {
for ( var setting in details ) {
if ( details.hasOwnProperty(setting) === false ) {
continue;
}
switch ( setting ) {
case 'prefetching':
chrome.privacy.network.networkPredictionEnabled.set({
value: !!details[setting],
scope: 'regular'
});
break;
default:
break;
}
}
}
};
/******************************************************************************/
vAPI.tabs = {}; vAPI.tabs = {};
/******************************************************************************/ /******************************************************************************/

View File

@ -97,6 +97,26 @@ window.addEventListener('unload', function() {
/******************************************************************************/ /******************************************************************************/
vAPI.browserSettings = {
set: function(details) {
for ( var setting in details ) {
if ( details.hasOwnProperty(setting) === false ) {
continue;
}
switch ( setting ) {
case 'prefetching':
// noop until I find what to use in Firefox
break;
default:
break;
}
}
}
};
/******************************************************************************/
// API matches that of chrome.storage.local: // API matches that of chrome.storage.local:
// https://developer.chrome.com/extensions/storage // https://developer.chrome.com/extensions/storage
@ -404,6 +424,7 @@ vAPI.tabs.registerListeners = function() {
/******************************************************************************/ /******************************************************************************/
// Firefox: // Firefox:
// https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Tabbed_browser
// //
// browser --> ownerDocument --> defaultView --> gBrowser --> browsers --+ // browser --> ownerDocument --> defaultView --> gBrowser --> browsers --+
// ^ | // ^ |

View File

@ -171,6 +171,10 @@
"message":"I am an advanced user (<a href='https:\/\/github.com\/gorhill\/uBlock\/wiki\/Advanced-user-features'>Required reading<\/a>)", "message":"I am an advanced user (<a href='https:\/\/github.com\/gorhill\/uBlock\/wiki\/Advanced-user-features'>Required reading<\/a>)",
"description":"English: " "description":"English: "
}, },
"settingsPrefetchingDisabledPrompt":{
"message":"Disable pre-fetching (to prevent any connection for blocked network requests)",
"description":"English: "
},
"settingsExperimentalPrompt":{ "settingsExperimentalPrompt":{
"message":"Enable experimental features (<a href='https:\/\/github.com\/gorhill\/uBlock\/wiki\/Experimental-features'>About<\/a>)", "message":"Enable experimental features (<a href='https:\/\/github.com\/gorhill\/uBlock\/wiki\/Experimental-features'>About<\/a>)",
"description":"English: Enable experimental features" "description":"English: Enable experimental features"

View File

@ -63,6 +63,7 @@ return {
externalLists: defaultExternalLists, externalLists: defaultExternalLists,
firewallPaneMinimized: true, firewallPaneMinimized: true,
parseAllABPHideFilters: true, parseAllABPHideFilters: true,
prefetchingDisabled: true,
requestLogMaxEntries: 1000, requestLogMaxEntries: 1000,
showIconBadge: true showIconBadge: true
}, },

View File

@ -186,6 +186,12 @@ var onUserSettingsReceived = function(details) {
changeUserSettings('colorBlindFriendly', this.checked); changeUserSettings('colorBlindFriendly', this.checked);
}); });
uDom('#prefetching-disabled')
.prop('checked', details.prefetchingDisabled === true)
.on('change', function(){
changeUserSettings('prefetchingDisabled', this.checked);
});
uDom('#advanced-user-enabled') uDom('#advanced-user-enabled')
.prop('checked', details.advancedUserEnabled === true) .prop('checked', details.advancedUserEnabled === true)
.on('change', function(){ .on('change', function(){

View File

@ -144,6 +144,8 @@ var onUserSettingsReady = function(fetched) {
userSettings.experimentalEnabled = false; userSettings.experimentalEnabled = false;
µb.contextMenu.toggle(userSettings.contextMenuEnabled); µb.contextMenu.toggle(userSettings.contextMenuEnabled);
vAPI.browserSettings.set({ 'prefetching': !userSettings.prefetchingDisabled });
µb.permanentFirewall.fromString(fetched.dynamicFilteringString); µb.permanentFirewall.fromString(fetched.dynamicFilteringString);
µb.sessionFirewall.assign(µb.permanentFirewall); µb.sessionFirewall.assign(µb.permanentFirewall);
µb.permanentURLFiltering.fromString(fetched.urlFilteringString); µb.permanentURLFiltering.fromString(fetched.urlFilteringString);

View File

@ -273,6 +273,11 @@ var matchWhitelistDirective = function(url, hostname, directive) {
break; break;
case 'experimentalEnabled': case 'experimentalEnabled':
break; break;
case 'prefetchingDisabled':
vAPI.browserSettings.set({
'prefetching': !value
});
break;
default: default:
break; break;
} }

View File

@ -17,6 +17,7 @@
<li><input id="color-blind-friendly" type="checkbox"><label data-i18n="settingsColorBlindPrompt" for="color-blind-friendly"></label> <li><input id="color-blind-friendly" type="checkbox"><label data-i18n="settingsColorBlindPrompt" for="color-blind-friendly"></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" disabled><label data-i18n="settingsExperimentalPrompt" for="experimental-enabled"></label> --> <!-- <li><input id="experimental-enabled" type="checkbox" disabled><label data-i18n="settingsExperimentalPrompt" for="experimental-enabled"></label> -->
<li><input id="prefetching-disabled" type="checkbox"><label data-i18n="settingsPrefetchingDisabledPrompt" for="prefetching-disabled"></label>
</ul> </ul>
<div id="localData" style="margin: 0 1em;"> <div id="localData" style="margin: 0 1em;">