[Pkg-mozext-commits] [requestpolicy] 163/257: [ref] RequestResult: use `self.*` notation

David Prévot taffit at moszumanska.debian.org
Thu Jan 28 03:20:08 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 46d158f17087c2d8b4a6bfeb6eafa1ecafff1891
Author: Martin Kimmerle <dev at 256k.de>
Date:   Tue Dec 1 13:24:31 2015 +0100

    [ref] RequestResult: use `self.*` notation
---
 src/content/lib/request-result.jsm | 38 ++++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/src/content/lib/request-result.jsm b/src/content/lib/request-result.jsm
index 6441484..dee579f 100644
--- a/src/content/lib/request-result.jsm
+++ b/src/content/lib/request-result.jsm
@@ -86,30 +86,32 @@ function RequestResult(isAllowed, resultReason) {
   this.isAllowed = isAllowed;
   this.resultReason = resultReason;
 }
+
 RequestResult.prototype = {
   matchedAllowRules : null,
   matchedDenyRules : null,
 
   isAllowed : undefined,  // whether the request will be or has been allowed
-  resultReason : undefined,
+  resultReason : undefined
+};
+
+RequestResult.prototype.allowRulesExist = function() {
+  return this.matchedAllowRules.length > 0;
+};
 
-  allowRulesExist : function() {
-    return this.matchedAllowRules.length > 0;
-  },
-  denyRulesExist : function () {
-    return this.matchedDenyRules.length > 0;
-  },
+RequestResult.prototype.denyRulesExist = function() {
+  return this.matchedDenyRules.length > 0;
+};
 
-  isDefaultPolicyUsed : function () {
-    // returns whether the default policy has been or will be used for this request.
-    return (this.resultReason == REQUEST_REASON_DEFAULT_POLICY ||
-            this.resultReason == REQUEST_REASON_DEFAULT_POLICY_INCONSISTENT_RULES ||
-            this.resultReason == REQUEST_REASON_DEFAULT_SAME_DOMAIN);
-  },
+RequestResult.prototype.isDefaultPolicyUsed = function() {
+  // returns whether the default policy has been or will be used for this request.
+  return (this.resultReason == REQUEST_REASON_DEFAULT_POLICY ||
+          this.resultReason == REQUEST_REASON_DEFAULT_POLICY_INCONSISTENT_RULES ||
+          this.resultReason == REQUEST_REASON_DEFAULT_SAME_DOMAIN);
+};
 
-  isOnBlacklist: function() {
-    // TODO: implement a real blacklist. currently, if a request is blocked
-    // *not* by the default policy it's by a blacklist
-    return this.isAllowed ? false : !this.isDefaultPolicyUsed();
-  }
+RequestResult.prototype.isOnBlacklist = function() {
+  // TODO: implement a real blacklist. currently, if a request is blocked
+  // *not* by the default policy it's by a blacklist
+  return this.isAllowed ? false : !this.isDefaultPolicyUsed();
 };

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