[Pkg-mozext-commits] [requestpolicy] 06/12: ensure auto-import of RP 0.5.x rules

David Prévot taffit at moszumanska.debian.org
Sat May 23 01:32:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository requestpolicy.

commit f34d43e36818ce6fa6c314e1d36598a0a5838374
Author: Martin Kimmerle <dev at 256k.de>
Date:   Fri May 22 04:33:39 2015 +0200

    ensure auto-import of RP 0.5.x rules
    
    Ensure that RP 0.5.x rules are imported automatically when the
    setup tab is being showed.
    
    This commit also fixes another issue: when the user upgrades from
    RP 0.5.x, the default policy is set to "deny".
---
 src/content/settings/common.js |  1 +
 src/content/settings/setup.js  | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/content/settings/common.js b/src/content/settings/common.js
index 41b7020..bb62ce4 100644
--- a/src/content/settings/common.js
+++ b/src/content/settings/common.js
@@ -9,6 +9,7 @@ Cu.import("chrome://requestpolicy/content/lib/script-loader.jsm");
 ScriptLoader.importModules([
   "lib/utils/constants",
   "lib/utils/strings",
+  "lib/utils",
   "lib/prefs",
   "lib/utils/domains",
   "lib/logger",
diff --git a/src/content/settings/setup.js b/src/content/settings/setup.js
index dd6ad4c..0100de6 100644
--- a/src/content/settings/setup.js
+++ b/src/content/settings/setup.js
@@ -96,7 +96,10 @@ function getArguments(args) {
 }*/
 
 function onload() {
-  var lastRPVersion = rpPrefBranch.getCharPref("lastVersion");
+  // To retrieve the last RP version, `Utils` needs to be used,
+  // because the pref "extensions.requestpolicy.lastVersion" has
+  // already been updated.
+  var lastRPVersion = Utils.info.lastRPVersion;
 
   // 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
@@ -111,9 +114,12 @@ function onload() {
     } else {
       var identLevel = 1;
     }
+
     $id("defaultdeny").checked = true;
-    $('#allowsamedomainblock').css('display', 'block');
+    handleDefaultPolicyChange();
+
     $id("allowsamedomain").checked = identLevel == 1;
+    handleAllowSameDomainChange();
 
     // If the user doesn't have any new-style rules, automatically do an import
     // of the old rules. We check for new-style rules just in case the user has
@@ -134,6 +140,7 @@ function onload() {
 
     // Skip the welcome screen.
     showConfigure();
+
   } else {
     var defaultAllow = rpPrefBranch.getBoolPref('defaultPolicy.allow');
     $id("defaultallow").checked = !!defaultAllow;
@@ -141,6 +148,7 @@ function onload() {
     if (!defaultAllow) {
       $('#allowsamedomainblock').css('display', 'block');
     }
+
     $id("allowsamedomain").checked =
         rpPrefBranch.getBoolPref('defaultPolicy.allowSameDomain');
     // Subscriptions are only simple here if we assume the user won't open the

-- 
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