Bug 728810 - Port bug 553092 - Initialise the permissions manager only on startup. r=mbanner
authoraceman <acelists@atlas.sk>
Sun, 26 Feb 2012 15:27:23 -0500
changeset 10944 8adfa5fe33fa533520810be2617eff29e7bd7f6b
parent 10943 e1f2344bacb9269d140473202da6934f8b0f6c5e
child 10945 892d4207a0dd153e5c7e4254ddf257396e5d3edb
push id463
push userbugzilla@standard8.plus.com
push dateTue, 24 Apr 2012 17:34:51 +0000
treeherdercomm-beta@e53588e8f7b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbanner
bugs728810, 553092
Bug 728810 - Port bug 553092 - Initialise the permissions manager only on startup. r=mbanner
mail/base/content/msgMail3PaneWindow.js
mail/components/preferences/permissions.js
--- a/mail/base/content/msgMail3PaneWindow.js
+++ b/mail/base/content/msgMail3PaneWindow.js
@@ -1565,31 +1565,16 @@ var LightWeightThemeWebInstaller = {
 
     this._manager.resetPreview();
   },
 
   _isAllowed: function (node) {
     let pm = Components.classes["@mozilla.org/permissionmanager;1"]
       .getService(Components.interfaces.nsIPermissionManager);
 
-    let prefs = [["xpinstall.whitelist.add", pm.ALLOW_ACTION],
-                 ["xpinstall.whitelist.add.36", pm.ALLOW_ACTION],
-                 ["xpinstall.blacklist.add", pm.DENY_ACTION]];
-
-    prefs.forEach(function ([pref, permission]) {
-      let hosts = Application.prefs.getValue(pref, "");
-      if (hosts) {
-        hosts.split(",").forEach(function (host) {
-          pm.add(makeURI("http://" + host.trim()), "install", permission);
-        });
-
-        Application.prefs.setValue(pref, "");
-      }
-    });
-
     let uri = node.ownerDocument.documentURIObject;
     return pm.testPermission(uri, "install") == pm.ALLOW_ACTION;
   },
 
   _getNotificationBox: function () {
     // Try and get the notification box for the selected tab.
     let browser = document.getElementById('tabmail').getBrowserForSelectedTab();
     // The messagepane doesn't have a notification bar yet.
--- a/mail/components/preferences/permissions.js
+++ b/mail/components/preferences/permissions.js
@@ -202,22 +202,16 @@ var gPermissionManager = {
 
     var urlLabel = document.getElementById("urlLabel");
     urlLabel.hidden = !urlFieldVisible;
 
     var os = Components.classes["@mozilla.org/observer-service;1"]
                        .getService(Components.interfaces.nsIObserverService);
     os.addObserver(this, "perm-changed", false);
 
-    if (this._type == "install") {
-      var enumerator = this._pm.enumerator;
-      if (!enumerator.hasMoreElements())
-        this._updatePermissions();
-    }
-
     this._loadPermissions();
 
     urlField.focus();
 
     this._ltrAtom = Components.classes["@mozilla.org/atom-service;1"]
                               .getService(Components.interfaces.nsIAtomService)
                               .getAtom("ltr");
   },
@@ -357,37 +351,16 @@ var gPermissionManager = {
                              (host.charAt(0) == ".") ? host.substring(1,host.length) : host,
                              aPermission.type,
                              capabilityString,
                              aPermission.capability);
       this._permissions.push(p);
     }
   },
 
-  _updatePermissions: function ()
-  {
-    var ioService = Components.classes["@mozilla.org/network/io-service;1"]
-                              .getService(Components.interfaces.nsIIOService);
-    var prefList = [["xpinstall.whitelist.add", this._pm.ALLOW_ACTION],
-                    ["xpinstall.whitelist.add.36", this._pm.ALLOW_ACTION],
-                    ["xpinstall.blacklist.add", this._pm.DENY_ACTION]];
-
-    prefList.forEach(function ([pref, permission]) {
-      var hosts = Application.prefs.getValue();
-      if (hosts) {
-        hosts.split(",").forEach(function (host) {
-          this._pm.add(ioService.newURI("http://" + host.trim(), null, null),
-                       "install", permission);
-        });
-
-        Application.prefs.setValue(pref, "");
-      }
-    });
-  },
-
   setHost: function (aHost)
   {
     document.getElementById("url").value = aHost;
   }
 };
 
 function setHost(aHost)
 {