RequestPolicy/requestpolicy — Issue #84: [patch] allow user to keep prefetch enabled
Author: jsamuel
Created: 2011-12-22 18:51:23+00:00
State: open
Labels: extension

imported trac ticket
created: 2010-03-11 03:50:26
reporter: admin

Provide a pref (available in about:config) to stop RequestPolicy from disabling prefetch.
The warning should still be displayed if the setting is on (so the user remembers what he set)

Perhaps a patch like this?

--- requestpolicyService.js	2010-03-11 13:48:19.000000000 +0200
+++ requestpolicyService.js.mod	2010-03-11 13:50:16.000000000 +0200
@@ -271,20 +271,23 @@

this._blockingDisabled = this.prefs.getBoolPref("startWithAllowAllEnabled");

- // Disable prefetch.
- if (this._rootPrefs.getBoolPref("network.prefetch-next")) {
- this._rootPrefs.setBoolPref("network.prefetch-next", false);
- requestpolicy.mod.Logger.info(requestpolicy.mod.Logger.TYPE_INTERNAL,
- "Disabled prefetch.");
- }
- // network.dns.disablePrefetch only exists starting in Firefox 3.1 (and it
- // doesn't have a default value, at least in 3.1b2, but if and when it
- // does have a default it will be false).
- if (!this._rootPrefs.prefHasUserValue("network.dns.disablePrefetch")) {
- this._rootPrefs.setBoolPref("network.dns.disablePrefetch", true);
- requestpolicy.mod.Logger.info(requestpolicy.mod.Logger.TYPE_INTERNAL,
- "Disabled DNS prefetch.");
- }
+ if (!this.prefs.getBoolPref("keepUserPrefetch")
+	{
+	// Disable prefetch.
+	if (this._rootPrefs.getBoolPref("network.prefetch-next")) {
+	this._rootPrefs.setBoolPref("network.prefetch-next", false);
+	requestpolicy.mod.Logger.info(requestpolicy.mod.Logger.TYPE_INTERNAL,
+	"Disabled prefetch.");
+	}
+	// network.dns.disablePrefetch only exists starting in Firefox 3.1 (and it
+	// doesn't have a default value, at least in 3.1b2, but if and when it
+	// does have a default it will be false).
+	if (!this._rootPrefs.prefHasUserValue("network.dns.disablePrefetch")) {
+	this._rootPrefs.setBoolPref("network.dns.disablePrefetch", true);
+	requestpolicy.mod.Logger.info(requestpolicy.mod.Logger.TYPE_INTERNAL,
+	"Disabled DNS prefetch.");
+	}
+	}

// Clean up old, unused prefs (removed in 0.2.0).
deletePrefs = ["temporarilyAllowedOrigins",