[Pkg-mozext-commits] [requestpolicy] 208/257: [fix] RP upgrade: don't set prefs on Setup page
David Prévot
taffit at moszumanska.debian.org
Thu Jan 28 03:20:14 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository requestpolicy.
commit 898da074a53ada0495535813f172bb24a89135a2
Author: Martin Kimmerle <dev at 256k.de>
Date: Sun Dec 6 21:06:09 2015 +0100
[fix] RP upgrade: don't set prefs on Setup page
Don't automatically set "default policy" and "allow same domain"
preferences on the Setup page. Instead, do it in the background,
so that it doesn't happen twice, that is, when the Setup page is
visited again.
---
src/content/main/requestpolicy-service.jsm | 13 ++++++++
src/content/settings/setup.js | 48 +++++++++++-------------------
2 files changed, 31 insertions(+), 30 deletions(-)
diff --git a/src/content/main/requestpolicy-service.jsm b/src/content/main/requestpolicy-service.jsm
index 321b21d..c03a1f4 100644
--- a/src/content/main/requestpolicy-service.jsm
+++ b/src/content/main/requestpolicy-service.jsm
@@ -40,6 +40,7 @@ let {UserSubscriptions, SUBSCRIPTION_UPDATED_TOPIC, SUBSCRIPTION_ADDED_TOPIC,
let {C} = importModule("lib/utils/constants");
let {Environment, ProcessEnvironment} = importModule("lib/environment");
let {WindowUtils} = importModule("lib/utils/windows");
+let {Info} = importModule("lib/utils/info");
//==============================================================================
// rpService
@@ -106,6 +107,18 @@ var rpService = (function() {
return;
}
+ if (Info.isRPUpgrade) {
+ // If the use has just upgraded from an 0.x version, set the
+ // default-policy preferences based on the old preferences.
+ rpPrefBranch.setBoolPref("defaultPolicy.allow", false);
+ if (rpPrefBranch.prefHasUserValue("uriIdentificationLevel")) {
+ let identLevel = rpPrefBranch.getIntPref("uriIdentificationLevel");
+ rpPrefBranch.setBoolPref("defaultPolicy.allowSameDomain",
+ identLevel === 1);
+ }
+ Services.prefs.savePrefFile(null);
+ }
+
tabbrowser.selectedTab = tabbrowser.addTab(url);
rpPrefBranch.setBoolPref("welcomeWindowShown", true);
diff --git a/src/content/settings/setup.js b/src/content/settings/setup.js
index d5df2b0..c23e783 100644
--- a/src/content/settings/setup.js
+++ b/src/content/settings/setup.js
@@ -112,43 +112,31 @@
}*/
window.onload = function() {
- // Populate the form values based on the user's current settings.
- // If the use has just upgrade from an 0.x version, populate based on the old
- // preferences and also do a rule import based on the old strictness settings.
if (Info.isRPUpgrade) {
- var identLevel;
- if (rpPrefBranch.prefHasUserValue("uriIdentificationLevel")) {
- identLevel = rpPrefBranch.getIntPref("uriIdentificationLevel");
- } else {
- identLevel = 1;
- }
-
- $id("defaultdeny").checked = true;
- handleDefaultPolicyChange();
-
- $id("allowsamedomain").checked = identLevel === 1;
- handleAllowSameDomainChange();
-
// Skip the welcome screen.
showConfigure();
+ }
- } else {
- var defaultAllow = rpPrefBranch.getBoolPref("defaultPolicy.allow");
- $id("defaultallow").checked = !!defaultAllow;
- $id("defaultdeny").checked = !defaultAllow;
- if (!defaultAllow) {
- $("#allowsamedomainblock").css("display", "block");
- }
+ // Populate the form values based on the user's current settings.
- $id("allowsamedomain").checked =
- rpPrefBranch.getBoolPref("defaultPolicy.allowSameDomain");
- // Subscriptions are only simple here if we assume the user won't open the
- // setup window again after changing their individual subscriptions through
- // the preferences. So, let's assume that as the worst case is that the setup
- // page shows such a setup-page-revisiting user the subscriptions as being
- // enabled when they really aren't.
+ let defaultAllow = rpPrefBranch.getBoolPref("defaultPolicy.allow");
+ $id("defaultallow").checked = defaultAllow;
+ $id("defaultdeny").checked = !defaultAllow;
+ if (!defaultAllow) {
+ $("#allowsamedomainblock").css("display", "block");
}
+ $id("allowsamedomain").checked =
+ rpPrefBranch.getBoolPref("defaultPolicy.allowSameDomain");
+
+ // FIXME: Add a pref to disable subscriptions globally; issue #713
+ // Subscriptions are only simple here if we assume the user
+ // won't open the setup window again after changing their
+ // individual subscriptions through the preferences.
+ // So, let's assume that as the worst case is that the setup
+ // page shows such a setup-page-revisiting user the subscriptions
+ // as being enabled when they really aren't.
+
$("#showconfigure").click(showConfigure);
$("input[name=defaultpolicy]").change(handleDefaultPolicyChange);
$("input[name=subscriptions]").change(handleSubscriptionsChange);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git
More information about the Pkg-mozext-commits
mailing list