[Pkg-mozext-commits] [requestpolicy] 41/280: [refactoring] remove nsIRequestPolicy interface functions

David Prévot taffit at moszumanska.debian.org
Sat May 2 20:29:57 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 5a5265f7693fac966382b412a2ff1d2cc199ce87
Author: Martin Kimmerle <dev at 256k.de>
Date:   Tue Dec 2 23:21:55 2014 +0100

    [refactoring] remove nsIRequestPolicy interface functions
---
 src/content/lib/policy-manager.alias-functions.js |  98 ++++++++++++++
 src/content/lib/policy-manager.jsm                |  11 +-
 src/content/lib/prefs.jsm                         |  28 +++-
 src/content/lib/requestpolicy-service.jsm         | 151 +---------------------
 src/content/settings/common.js                    |   4 +-
 src/content/settings/oldrules.js                  |   2 +-
 src/content/settings/yourpolicy.js                |  14 +-
 src/content/ui/menu.js                            |  14 +-
 src/content/ui/overlay.js                         |  79 +++++------
 9 files changed, 174 insertions(+), 227 deletions(-)

diff --git a/src/content/lib/policy-manager.alias-functions.js b/src/content/lib/policy-manager.alias-functions.js
new file mode 100644
index 0000000..178390b
--- /dev/null
+++ b/src/content/lib/policy-manager.alias-functions.js
@@ -0,0 +1,98 @@
+/*
+ * ***** BEGIN LICENSE BLOCK *****
+ *
+ * RequestPolicy - A Firefox extension for control over cross-site requests.
+ * Copyright (c) 2008-2012 Justin Samuel
+ * Copyright (c) 2014 Martin Kimmerle
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * ***** END LICENSE BLOCK *****
+ */
+
+
+let PolicyManager = (function(self) {
+
+  self.addAllowRule = self.addRule.bind(this, RULE_ACTION_ALLOW);
+  self.addTemporaryAllowRule = self.addTemporaryRule.bind(this,
+                                                          RULE_ACTION_ALLOW);
+  self.removeAllowRule = self.removeRule.bind(this, RULE_ACTION_ALLOW);
+  self.addDenyRule = self.addRule.bind(this, RULE_ACTION_DENY);
+  self.addTemporaryDenyRule = self.addTemporaryRule.bind(this,
+                                                         RULE_ACTION_DENY);
+  self.removeDenyRule = self.removeRule.bind(this, RULE_ACTION_DENY);
+
+
+  function getRuleData(aOrigin, aDest) {
+    let ruleData = {};
+    if (aOrigin !== undefined) {
+      ruleData["o"] = {"h": aOrigin};
+    }
+    if (aDest !== undefined) {
+      ruleData["d"] = {"h": aDest};
+    }
+    return ruleData;
+  }
+
+
+  function allowOrigin(aOrigin, noStore) {
+    self.addAllowRule(getRuleData(aOrigin), noStore);
+  }
+  self.allowOrigin = function(aOrigin) {
+    allowOrigin(aOrigin, false);
+  };
+  self.allowOriginDelayStore = function(aOrigin) {
+    allowOrigin(aOrigin, true);
+  };
+
+
+  self.temporarilyAllowOrigin = function(aOrigin) {
+    PolicyManager.addTemporaryAllowRule(getRuleData(aOrigin));
+  };
+  self.temporarilyAllowDestination = function(aDest) {
+    self.addTemporaryAllowRule(getRuleData(undefined, aDest));
+  };
+
+
+  function allowDestination(aDest, noStore) {
+    self.addAllowRule(getRuleData(undefined, aDest), noStore);
+  }
+  self.allowDestination = function(aDest) {
+    allowDestination(aDest, false);
+  };
+  self.allowDestinationDelayStore = function(aDest) {
+    allowDestination(aDest, true);
+  };
+
+
+  function allowOriginToDestination(originIdentifier, destIdentifier, noStore) {
+    self.addAllowRule(getRuleData(originIdentifier, destIdentifier), noStore);
+  };
+  self.allowOriginToDestination = function(originIdentifier, destIdentifier) {
+    allowOriginToDestination(originIdentifier, destIdentifier, false);
+  };
+  self.allowOriginToDestinationDelayStore = function(originIdentifier,
+                                                     destIdentifier) {
+    allowOriginToDestination(originIdentifier, destIdentifier, true);
+  };
+
+
+  self.temporarilyAllowOriginToDestination = function(originIdentifier,
+                                                      destIdentifier) {
+    PolicyManager.addTemporaryAllowRule(getRuleData(originIdentifier,
+                                                    destIdentifier));
+  };
+
+  return self;
+}(PolicyManager || {}));
diff --git a/src/content/lib/policy-manager.jsm b/src/content/lib/policy-manager.jsm
index 4c1e4ec..a6b6daf 100644
--- a/src/content/lib/policy-manager.jsm
+++ b/src/content/lib/policy-manager.jsm
@@ -79,8 +79,7 @@ function notifyRulesChanged() {
  * Provides a simplified interface to handling multiple
  * rulesets, checking requests against multiple rulesets, etc.
  */
-let PolicyManager = (function() {
-  let self = {};
+let PolicyManager = (function(self) {
 
 
   let userRulesets = {};
@@ -343,7 +342,11 @@ let PolicyManager = (function() {
       }
     }
     return result;
-  }
+  };
 
   return self;
-}());
+}(PolicyManager || {}));
+
+
+Services.scriptloader.loadSubScript(
+    "chrome://requestpolicy/content/lib/policy-manager.alias-functions.js");
diff --git a/src/content/lib/prefs.jsm b/src/content/lib/prefs.jsm
index 603852a..8b62bfd 100644
--- a/src/content/lib/prefs.jsm
+++ b/src/content/lib/prefs.jsm
@@ -112,6 +112,7 @@ let DefaultPrefInit = (function() {
 
 
 let Prefs = (function() {
+  let self = {};
 
 
   let defaultAllow = true;
@@ -223,12 +224,10 @@ let Prefs = (function() {
     syncFromPrefs();
   }
 
-  let self = {
-    prefs: null,
-    prefsRoot: null,
-    save: function() {
-      Services.prefs.savePrefFile(null);
-    }
+  self.prefs = null;
+  self.prefsRoot = null;
+  self.save = function() {
+    Services.prefs.savePrefFile(null);
   };
 
   self.isDefaultAllow = function() {
@@ -255,6 +254,23 @@ let Prefs = (function() {
     }
   };
 
+
+  function isPrefEmpty(pref) {
+    try {
+      let value = self.prefs.getComplexValue(pref, Ci.nsISupportsString).data;
+      return value == '';
+    } catch (e) {
+      return true;
+    }
+  }
+
+  self.oldRulesExist = function() {
+    return !(isPrefEmpty('allowedOrigins') &&
+             isPrefEmpty('allowedDestinations') &&
+             isPrefEmpty('allowedOriginsToDestinations'));
+  };
+
+
   init();
 
   return self;
diff --git a/src/content/lib/requestpolicy-service.jsm b/src/content/lib/requestpolicy-service.jsm
index b7b6ef1..619eb99 100644
--- a/src/content/lib/requestpolicy-service.jsm
+++ b/src/content/lib/requestpolicy-service.jsm
@@ -496,140 +496,6 @@ let rpService = (function() {
     // nsIRequestPolicy interface
     // /////////////////////////////////////////////////////////////////////////
 
-    getUriIdentifier : function(uri) {
-      return DomainUtil.getIdentifier(uri);
-    },
-
-    registerHistoryRequest : function(destinationUrl) {
-      RequestProcessor.registerHistoryRequest(destinationUrl);
-    },
-
-    registerFormSubmitted : function(originUrl, destinationUrl) {
-      RequestProcessor.registerFormSubmitted(originUrl, destinationUrl);
-    },
-
-    registerLinkClicked : function(originUrl, destinationUrl) {
-      RequestProcessor.registerLinkClicked(originUrl, destinationUrl);
-    },
-
-    registerAllowedRedirect : function(originUrl, destinationUrl) {
-      RequestProcessor.registerAllowedRedirect(originUrl, destinationUrl);
-    },
-
-    storeRules : function() {
-      PolicyManager.storeRules();
-    },
-
-    addAllowRule : function(rawRule, noStore) {
-      PolicyManager.addRule(RULE_ACTION_ALLOW, rawRule, noStore);
-    },
-
-    addTemporaryAllowRule : function(rawRule) {
-      PolicyManager.addTemporaryRule(RULE_ACTION_ALLOW, rawRule);
-    },
-
-    removeAllowRule : function(rawRule) {
-      PolicyManager.removeRule(RULE_ACTION_ALLOW, rawRule);
-    },
-
-    addDenyRule : function(rawRule) {
-      PolicyManager.addRule(RULE_ACTION_DENY, rawRule);
-    },
-
-    addTemporaryDenyRule : function(rawRule) {
-      PolicyManager.addTemporaryRule(RULE_ACTION_DENY, rawRule);
-    },
-
-    removeDenyRule : function(rawRule) {
-      PolicyManager.removeRule(RULE_ACTION_DENY, rawRule);
-    },
-
-    _allowOrigin : function(host, noStore) {
-      var ruleData = {"o":{"h":host}};
-      PolicyManager.addRule(RULE_ACTION_ALLOW, ruleData, noStore);
-    },
-
-    allowOrigin : function(host) {
-      self._allowOrigin(host, false);
-    },
-
-    allowOriginDelayStore : function(host) {
-      self._allowOrigin(host, true);
-    },
-
-    temporarilyAllowOrigin : function(host) {
-      var ruleData = {"o": {"h" : host}};
-      PolicyManager.addTemporaryRule(RULE_ACTION_ALLOW, ruleData);
-    },
-
-    _allowDestination : function(host, noStore) {
-      var ruleData = {"d": {"h" : host}};
-      PolicyManager.addRule(RULE_ACTION_ALLOW, ruleData, noStore);
-    },
-
-    allowDestination : function(host) {
-      self._allowDestination(host, false);
-    },
-
-    allowDestinationDelayStore : function(host) {
-      self._allowDestination(host, true);
-    },
-
-    temporarilyAllowDestination : function(host) {
-      var ruleData = {"d": {"h" : host}};
-      PolicyManager.addTemporaryRule(RULE_ACTION_ALLOW, ruleData);
-    },
-
-    _allowOriginToDestination : function(originIdentifier, destIdentifier,
-        noStore) {
-      var ruleData = {
-        "o": {"h" : originIdentifier},
-        "d": {"h" : destIdentifier}
-      };
-      PolicyManager.addRule(RULE_ACTION_ALLOW, ruleData, noStore);
-    },
-
-    allowOriginToDestination : function(originIdentifier, destIdentifier) {
-      self._allowOriginToDestination(originIdentifier, destIdentifier, false);
-    },
-
-    allowOriginToDestinationDelayStore : function(originIdentifier,
-                                                  destIdentifier) {
-      self._allowOriginToDestination(originIdentifier, destIdentifier, true);
-    },
-
-    temporarilyAllowOriginToDestination : function(originIdentifier,
-                                                   destIdentifier) {
-      var ruleData = {
-        "o": {"h" : originIdentifier},
-        "d": {"h" : destIdentifier}
-      };
-      PolicyManager.addTemporaryRule(RULE_ACTION_ALLOW, ruleData);
-    },
-
-    temporaryRulesExist : function() {
-      return PolicyManager.temporaryRulesExist();
-    },
-
-    revokeTemporaryPermissions : function() {
-      PolicyManager.revokeTemporaryRules();
-    },
-
-    isAllowedRedirect : function(originUri, destinationUri) {
-      return RequestProcessor.isAllowedRedirect(originUri, destinationUri);
-    },
-
-    /**
-     * Determines whether the user has granted any temporary permissions. This
-     * does not include temporarily disabling all blocking.
-     *
-     * @return {Boolean} true if any temporary permissions have been granted,
-     *         false otherwise.
-     */
-    areTemporaryPermissionsGranted : function() {
-      return PolicyManager.temporaryRulesExist();
-    },
-
     getConflictingExtensions : function() {
       return conflictingExtensions;
     },
@@ -638,21 +504,6 @@ let rpService = (function() {
       return topLevelDocTranslationRules;
     },
 
-    oldRulesExist : function() {
-      function prefEmpty(pref) {
-        try {
-          var value = Prefs.prefs
-              .getComplexValue(pref, Ci.nsISupportsString).data;
-          return value == '';
-        } catch (e) {
-          return true;
-        }
-      }
-      return !(prefEmpty('allowedOrigins') &&
-               prefEmpty('allowedDestinations') &&
-               prefEmpty('allowedOriginsToDestinations'));
-    },
-
     /**
      * Handles observer notifications sent by the HTTPS Everywhere extension
      * that inform us of URIs that extension has rewritten.
@@ -732,7 +583,7 @@ let rpService = (function() {
             self._privateBrowsingEnabled = true;
           } else if (data == "exit") {
             self._privateBrowsingEnabled = false;
-            self.revokeTemporaryPermissions();
+            PolicyManager.revokeTemporaryRules();
           }
           break;
         default :
diff --git a/src/content/settings/common.js b/src/content/settings/common.js
index f8f2ea7..5627b82 100644
--- a/src/content/settings/common.js
+++ b/src/content/settings/common.js
@@ -204,9 +204,9 @@ common.clearPref = function (pref) {
 common.addAllowRules = function (rules) {
   for (var i in rules) {
     var ruleData = rules[i];
-    rpService.addAllowRule(ruleData, true);
+    PolicyManager.addAllowRule(ruleData, true);
   }
-  rpService.storeRules();
+  PolicyManager.storeRules();
 };
 
 common.localize = function(stringNames) {
diff --git a/src/content/settings/oldrules.js b/src/content/settings/oldrules.js
index 8a47be0..653dd42 100644
--- a/src/content/settings/oldrules.js
+++ b/src/content/settings/oldrules.js
@@ -99,7 +99,7 @@ function handleAddHostWildcardsChange(event) {
 }
 
 function onload() {
-  var oldRulesExist = rpService.oldRulesExist();
+  var oldRulesExist = Prefs.oldRulesExist();
   if (!oldRulesExist) {
     $('#hasrules').hide();
     $('#norules').show();
diff --git a/src/content/settings/yourpolicy.js b/src/content/settings/yourpolicy.js
index e3817be..f33491e 100644
--- a/src/content/settings/yourpolicy.js
+++ b/src/content/settings/yourpolicy.js
@@ -87,9 +87,9 @@ function deleteRule(event) {
   var ruleAction = anchor.data('requestpolicyRuleAction');
   var ruleData = anchor.data('requestpolicyRuleData');
   if (ruleAction == 'allow') {
-    rpService.removeAllowRule(ruleData);
+    PolicyManager.removeAllowRule(ruleData);
   } else {
-    rpService.removeDenyRule(ruleData);
+    PolicyManager.removeDenyRule(ruleData);
   }
   anchor.closest('tr').remove();
 }
@@ -201,15 +201,15 @@ function addRuleHelper() {
   }
   if (allow) {
     if (temporary) {
-      rpService.addTemporaryAllowRule(ruleData);
+      PolicyManager.addTemporaryAllowRule(ruleData);
     } else {
-      rpService.addAllowRule(ruleData);
+      PolicyManager.addAllowRule(ruleData);
     }
   } else {
     if (temporary) {
-      rpService.addTemporaryDenyRule(ruleData);
+      PolicyManager.addTemporaryDenyRule(ruleData);
     } else {
-      rpService.addDenyRule(ruleData);
+      PolicyManager.addDenyRule(ruleData);
     }
   }
 }
@@ -227,7 +227,7 @@ function onload() {
     }, SEARCH_DELAY);
   }, false);
   populateRuleTable(search.value);
-  if (rpService.oldRulesExist()) {
+  if (Prefs.oldRulesExist()) {
     $('#oldrulesexist').show();
   }
 
diff --git a/src/content/ui/menu.js b/src/content/ui/menu.js
index 10e3c91..dcffa3a 100644
--- a/src/content/ui/menu.js
+++ b/src/content/ui/menu.js
@@ -115,7 +115,7 @@ requestpolicy.menu = (function() {
         document.getElementById('rp-link-disable-blocking').hidden = disabled;
 
         document.getElementById('rp-revoke-temporary-permissions').hidden =
-            !rpService.temporaryRulesExist();
+            !PolicyManager.temporaryRulesExist();
 
         self._currentUri = requestpolicy.overlay.getTopLevelDocumentUri();
 
@@ -641,22 +641,22 @@ requestpolicy.menu = (function() {
 
       switch (ruleAction) {
         case 'allow':
-          requestpolicy.overlay.addAllowRule(ruleData);
+          PolicyManager.addAllowRule(ruleData);
           break;
         case 'allow-temp':
-          requestpolicy.overlay.addTemporaryAllowRule(ruleData);
+          PolicyManager.addTemporaryAllowRule(ruleData);
           break;
         case 'stop-allow':
-          requestpolicy.overlay.removeAllowRule(ruleData);
+          PolicyManager.removeAllowRule(ruleData);
           break;
         case 'deny':
-          requestpolicy.overlay.addDenyRule(ruleData);
+          PolicyManager.addDenyRule(ruleData);
           break;
         case 'deny-temp':
-          requestpolicy.overlay.addTemporaryDenyRule(ruleData);
+          PolicyManager.addTemporaryDenyRule(ruleData);
           break;
         case 'stop-deny':
-          requestpolicy.overlay.removeDenyRule(ruleData);
+          PolicyManager.removeDenyRule(ruleData);
           break;
         default:
           throw 'action not implemented: ' + ruleAction;
diff --git a/src/content/ui/overlay.js b/src/content/ui/overlay.js
index e19e6cf..c05dd95 100644
--- a/src/content/ui/overlay.js
+++ b/src/content/ui/overlay.js
@@ -42,11 +42,13 @@ requestpolicy.overlay = (function() {
     "request-processor",
     "domain-util",
     "utils",
-    "requestpolicy-service"
+    "requestpolicy-service",
+    "policy-manager"
   ], mod);
   let Logger = mod.Logger, Prefs = mod.Prefs,
       RequestProcessor = mod.RequestProcessor, DomainUtil = mod.DomainUtil,
-      Utils = mod.Utils, rpService = mod.rpService;
+      Utils = mod.Utils, rpService = mod.rpService,
+      PolicyManager = mod.PolicyManager;
 
   //let _extensionConflictInfoUri = "http://www.requestpolicy.com/conflict?ext=";
 
@@ -211,7 +213,7 @@ requestpolicy.overlay = (function() {
             // I believe an empty href always gets filled in with the current URL so
             // it will never actually be empty. However, I don't know this for certain.
             if (event.target.nodeName.toLowerCase() == "a" && event.target.href) {
-              rpService.registerLinkClicked(
+              RequestProcessor.registerLinkClicked(
                   event.target.ownerDocument.URL, event.target.href);
               return;
             }
@@ -221,7 +223,7 @@ requestpolicy.overlay = (function() {
             if (event.target.nodeName.toLowerCase() == "input" &&
                 event.target.type.toLowerCase() == "submit" &&
                 event.target.form && event.target.form.action) {
-              rpService.registerFormSubmitted(
+              RequestProcessor.registerFormSubmitted(
                 event.target.ownerDocument.URL, event.target.form.action);
               return;
             }
@@ -431,7 +433,8 @@ requestpolicy.overlay = (function() {
                 location = content.location;
               }
               // Fx 3.7a5+ calls shouldLoad for location.href changes.
-              rpService.registerAllowedRedirect(location.href, redirectTargetUri);
+              RequestProcessor.registerAllowedRedirect(location.href,
+                                                       redirectTargetUri);
               location.href = redirectTargetUri;
             }
           },
@@ -858,7 +861,7 @@ requestpolicy.overlay = (function() {
     _htmlAnchorTagClicked: function(event) {
       // Note: need to use currentTarget so that it is the link, not
       // something else within the link that got clicked, it seems.
-      rpService.registerLinkClicked(event.currentTarget.ownerDocument.URL,
+      RequestProcessor.registerLinkClicked(event.currentTarget.ownerDocument.URL,
           event.currentTarget.href);
     },
 
@@ -907,7 +910,7 @@ requestpolicy.overlay = (function() {
           // just detect when they will be blocked and show a notification. If
           // the docShell has allowMetaRedirects disabled, it will be respected.
           if (!Prefs.isBlockingDisabled()
-              && !rpService.isAllowedRedirect(document.location.href, dest)) {
+              && !RequestProcessor.isAllowedRedirect(document.location.href, dest)) {
             // Ignore redirects to javascript. The browser will ignore them, as well.
             if (DomainUtil.getUriObject(dest).schemeIs("javascript")) {
               Logger.warning(Logger.TYPE_META_REFRESH,
@@ -995,7 +998,7 @@ requestpolicy.overlay = (function() {
         gContextMenu.requestpolicyMethodsOverridden = true;
 
         gContextMenu.openLink = function() {
-          rpService.registerLinkClicked(this.target.ownerDocument.URL, this.linkURL);
+          RequestProcessor.registerLinkClicked(this.target.ownerDocument.URL, this.linkURL);
           return this.__proto__.openLink.call(this); // call the overridden method
         };
 
@@ -1004,14 +1007,14 @@ requestpolicy.overlay = (function() {
 
         if (gContextMenu.openLinkInPrivateWindow) {
           gContextMenu.openLinkInPrivateWindow = function() {
-            rpService.registerLinkClicked(this.target.ownerDocument.URL, this.linkURL);
+            RequestProcessor.registerLinkClicked(this.target.ownerDocument.URL, this.linkURL);
             return this.__proto__.openLinkInPrivateWindow.call(this);
           };
         }
 
         if (gContextMenu.openLinkInCurrent) {
           gContextMenu.openLinkInCurrent = function() {
-            rpService.registerLinkClicked(this.target.ownerDocument.URL, this.linkURL);
+            RequestProcessor.registerLinkClicked(this.target.ownerDocument.URL, this.linkURL);
             return this.__proto__.openLinkInCurrent.call(this);
           };
         }
@@ -1079,7 +1082,7 @@ requestpolicy.overlay = (function() {
         }
       }
       if (referrerURI) {
-        rpService.registerLinkClicked(referrerURI.spec, url);
+        RequestProcessor.registerLinkClicked(referrerURI.spec, url);
       }
     },
 
@@ -1101,7 +1104,7 @@ requestpolicy.overlay = (function() {
       if (!window.requestpolicyOrigOpen) {
         window.requestpolicyOrigOpen = window.open;
         window.open = function(url, windowName, windowFeatures) {
-          rpService.registerLinkClicked(window.document.documentURI, url);
+          RequestProcessor.registerLinkClicked(window.document.documentURI, url);
           return window.requestpolicyOrigOpen(url, windowName, windowFeatures);
         };
       }
@@ -1110,7 +1113,7 @@ requestpolicy.overlay = (function() {
         window.requestpolicyOrigOpenDialog = window.openDialog;
         window.openDialog = function() {
           // openDialog(url, name, features, arg1, arg2, ...)
-          rpService.registerLinkClicked(window.document.documentURI,
+          RequestProcessor.registerLinkClicked(window.document.documentURI,
               arguments[0]);
           return window.requestpolicyOrigOpenDialog.apply(window, arguments);
         };
@@ -1154,18 +1157,18 @@ requestpolicy.overlay = (function() {
       // Implements nsISHistoryListener (and nsISupportsWeakReference)
       self.historyListener = {
         OnHistoryGoBack : function(backURI) {
-          rpService.registerHistoryRequest(backURI.asciiSpec);
+          RequestProcessor.registerHistoryRequest(backURI.asciiSpec);
           return true;
         },
 
         OnHistoryGoForward : function(forwardURI) {
-          rpService.registerHistoryRequest(forwardURI.asciiSpec);
+          RequestProcessor.registerHistoryRequest(forwardURI.asciiSpec);
           return true;
         },
 
         OnHistoryGotoIndex : function(index, gotoURI) {
-          rpService.registerHistoryRequest(gotoURI.asciiSpec);
-          return true;
+          RequestProcessor.registerHistoryRequest(gotoURI.asciiSpec);
+   return true;
         },
 
         OnHistoryNewEntry : function(newURI) {
@@ -1312,7 +1315,7 @@ requestpolicy.overlay = (function() {
      * duration of the browser session.
      */
     temporarilyAllowOrigin: function(originHost) {
-      rpService.temporarilyAllowOrigin(originHost);
+      PolicyManager.temporarilyAllowOrigin(originHost);
     },
 
     /**
@@ -1326,7 +1329,7 @@ requestpolicy.overlay = (function() {
       // Note: the available variable "content" is different than the avaialable
       // "window.target".
       var host = self.getTopLevelDocumentUriIdentifier();
-      rpService.temporarilyAllowOrigin(host);
+      PolicyManager.temporarilyAllowOrigin(host);
     },
 
     /**
@@ -1337,7 +1340,7 @@ requestpolicy.overlay = (function() {
      *          destHost
      */
     temporarilyAllowDestination: function(destHost) {
-      rpService.temporarilyAllowDestination(destHost);
+      PolicyManager.temporarilyAllowDestination(destHost);
     },
 
     /**
@@ -1350,14 +1353,14 @@ requestpolicy.overlay = (function() {
      *          destHost
      */
     temporarilyAllowOriginToDestination: function(originHost, destHost) {
-      rpService.temporarilyAllowOriginToDestination(originHost, destHost);
+      PolicyManager.temporarilyAllowOriginToDestination(originHost, destHost);
     },
 
     /**
      * Allows requests from an origin, including in future browser sessions.
      */
     allowOrigin: function(originHost) {
-      rpService.allowOrigin(originHost);
+      PolicyManager.allowOrigin(originHost);
     },
 
     /**
@@ -1369,7 +1372,7 @@ requestpolicy.overlay = (function() {
      */
     allowCurrentOrigin: function(event) {
       var host = self.getTopLevelDocumentUriIdentifier();
-      rpService.allowOrigin(host);
+      PolicyManager.allowOrigin(host);
     },
 
     /**
@@ -1379,7 +1382,7 @@ requestpolicy.overlay = (function() {
      *          destHost
      */
     allowDestination: function(destHost) {
-      rpService.allowDestination(destHost);
+      PolicyManager.allowDestination(destHost);
     },
 
     /**
@@ -1392,7 +1395,7 @@ requestpolicy.overlay = (function() {
      *          destHost
      */
     allowOriginToDestination: function(originHost, destHost) {
-      rpService.allowOriginToDestination(originHost, destHost);
+      PolicyManager.allowOriginToDestination(originHost, destHost);
     },
 
     /**
@@ -1441,30 +1444,6 @@ requestpolicy.overlay = (function() {
       rpService.forbidOriginToDestination(originHost, destHost);
     },
 
-    addAllowRule: function(ruleData) {
-      rpService.addAllowRule(ruleData);
-    },
-
-    addTemporaryAllowRule: function(ruleData) {
-      rpService.addTemporaryAllowRule(ruleData);
-    },
-
-    removeAllowRule: function(ruleData) {
-      rpService.removeAllowRule(ruleData);
-    },
-
-    addDenyRule: function(ruleData) {
-      rpService.addDenyRule(ruleData);
-    },
-
-    addTemporaryDenyRule: function(ruleData) {
-      rpService.addTemporaryDenyRule(ruleData);
-    },
-
-    removeDenyRule: function(ruleData) {
-      rpService.removeDenyRule(ruleData);
-    },
-
     /**
      * Revokes all temporary permissions granted during the current session.
      *
@@ -1472,7 +1451,7 @@ requestpolicy.overlay = (function() {
      *          event
      */
     revokeTemporaryPermissions: function(event) {
-      rpService.revokeTemporaryPermissions();
+      PolicyManager.revokeTemporaryRules();
       self._needsReloadOnMenuClose = true;
       var popup = document.getElementById('rp-popup');
       popup.hidePopup();

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