[Pkg-mozext-commits] [requestpolicy] 24/50: [fix] Ruleset: {h: "*"} should match any host
David Prévot
taffit at moszumanska.debian.org
Mon Jun 27 12:50:31 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 977012d31f04aeb90e5b24d3d4ccef38f9068943
Author: Martin Kimmerle <dev at 256k.de>
Date: Sat Apr 23 14:59:57 2016 +0200
[fix] Ruleset: {h: "*"} should match any host
Thanks to @arlsr for his pull request!
Closes #555
---
src/content/lib/ruleset.jsm | 6 +++++-
tests/xpcshell/test_rule_match.js | 10 +++++-----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/content/lib/ruleset.jsm b/src/content/lib/ruleset.jsm
index 07201b5..5f692c3 100644
--- a/src/content/lib/ruleset.jsm
+++ b/src/content/lib/ruleset.jsm
@@ -963,7 +963,11 @@ Ruleset.prototype = {
} else {
var parts = host.split(".");
var curLevel = this._domain;
- var nextLevel;
+ // Start by checking for a wildcard at the highest level.
+ var nextLevel = curLevel.getLowerLevel("*");
+ if (nextLevel) {
+ yield [nextLevel, true];
+ }
for (var i = parts.length - 1; i >= 0; i--) {
nextLevel = curLevel.getLowerLevel(parts[i]);
if (!nextLevel) {
diff --git a/tests/xpcshell/test_rule_match.js b/tests/xpcshell/test_rule_match.js
index b4510b0..4cb86c0 100644
--- a/tests/xpcshell/test_rule_match.js
+++ b/tests/xpcshell/test_rule_match.js
@@ -88,11 +88,11 @@ add_test(function() {
// test({ h: "" }, true, "file:///etc/hosts");
// FIXME; see PR #555
- // // Any Host + Default port
- // test({ h: "*" }, true, "http://www.example.com/");
- // test({ h: "*" }, true, "http://localhost/");
- // test({ h: "*" }, false, "http://www.example.com:81/");
- // test({ h: "*" }, false, "http://localhost:81/");
+ // Any Host + Default port
+ test({ h: "*" }, true, "http://www.example.com/");
+ test({ h: "*" }, true, "http://localhost/");
+ test({ h: "*" }, false, "http://www.example.com:81/");
+ test({ h: "*" }, false, "http://localhost:81/");
// Specific Scheme
test({s: "http" }, true, "http://localhost/");
--
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