[Pkg-mozext-commits] [requestpolicy] 268/280: Fix: rules with a port haven't been working

David Prévot taffit at moszumanska.debian.org
Sat May 2 20:30:37 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 eea5892693c0a2eb7e22c202241848379dc54e36
Author: Martin Kimmerle <dev at 256k.de>
Date:   Thu Apr 30 13:08:33 2015 +0200

    Fix: rules with a port haven't been working
    
    The `port` in the `Rule` class is of type "string", whereas the
    `port` attribute of a `nsIURI` object is of type "integer".
    Therefore `Rule.port` has to be typecasted before comparison.
    
    Fixes #627.
---
 ChangeLog.md                | 4 ++++
 src/content/lib/ruleset.jsm | 7 ++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index d235075..950b1e6 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -3,6 +3,10 @@
 Note: ChangeLogs for the source code and unit tests, both not relevant for
       users, you can find in the dedicated subdirectories.
 
+#### Version 1.0.beta9.1 (bugfix)
+* rules with a port specified in the origin or destination haven't
+  been working (#627)
+
 #### Version 1.0.beta9
 * new features
   * RPC is now a bootstrapped addon. (#489)
diff --git a/src/content/lib/ruleset.jsm b/src/content/lib/ruleset.jsm
index b35bc34..41e6401 100644
--- a/src/content/lib/ruleset.jsm
+++ b/src/content/lib/ruleset.jsm
@@ -546,7 +546,12 @@ function Rule(scheme, port) {
 Rule.prototype = {
 
   scheme : null,
+
+  /**
+   * @type {?string}
+   */
   port : null,
+
   path : null,
 
   // Either null, RULE_ACTION_ALLOW, or RULE_ACTION_DENY.
@@ -612,7 +617,7 @@ Rule.prototype = {
         // If the rule's port is "*" it means any port. We use this convention
         // because we assume an empty port in a rule means default ports rather
         // than any port.
-        if (this.port !== uriObj.port && this.port !== "*") {
+        if (parseInt(this.port, 10) !== uriObj.port && this.port !== "*") {
           //dprint("isMatch: wrong port (not the port specified by the rule)");
           return false;
         }

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