From 2cb1f423355920ea8c22c148918ac41f8f4702fc Mon Sep 17 00:00:00 2001 From: gorhill Date: Tue, 2 Jun 2015 08:59:25 -0400 Subject: [PATCH] Firefox support for browser settings --- platform/chromium/vapi-background.js | 5 ----- platform/firefox/vapi-background.js | 14 ++++++++++++-- src/js/start.js | 1 + 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/platform/chromium/vapi-background.js b/platform/chromium/vapi-background.js index 872443964..8dc54c842 100644 --- a/platform/chromium/vapi-background.js +++ b/platform/chromium/vapi-background.js @@ -64,11 +64,6 @@ 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 ) { diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index 6d58fbe20..bf4639177 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -98,6 +98,16 @@ window.addEventListener('unload', function() { /******************************************************************************/ vAPI.browserSettings = { + + setBool: function(branch, setting, value) { + try { + Services.prefs + .getBranch(branch + '.') + .setBoolPref(setting, value); + } catch (ex) { + } + }, + set: function(details) { for ( var setting in details ) { if ( details.hasOwnProperty(setting) === false ) { @@ -105,11 +115,11 @@ vAPI.browserSettings = { } switch ( setting ) { case 'prefetching': - // noop until I find what to use in Firefox + this.setBool('network', 'prefetch-next', !!details[setting]); break; case 'hyperlinkAuditing': - // noop until I find what to use in Firefox + this.setBool('browser', 'send_pings', !!details[setting]); break; default: diff --git a/src/js/start.js b/src/js/start.js index 2a6ecdaba..09e1299cc 100644 --- a/src/js/start.js +++ b/src/js/start.js @@ -145,6 +145,7 @@ var onUserSettingsReady = function(fetched) { µb.contextMenu.toggle(userSettings.contextMenuEnabled); vAPI.browserSettings.set({ 'prefetching': !userSettings.prefetchingDisabled }); + vAPI.browserSettings.set({ 'hyperlinkAuditing': !userSettings.hyperlinkAuditingDisabled }); µb.permanentFirewall.fromString(fetched.dynamicFilteringString); µb.sessionFirewall.assign(µb.permanentFirewall);