[Pkg-mozext-commits] [requestpolicy] 186/257: [ref] Ruleset.getHostMatches: convert to generator function

David Prévot taffit at moszumanska.debian.org
Thu Jan 28 03:20:11 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 41fd1c124c2f77398f145e6f68f5eb80afde7aec
Author: Martin Kimmerle <dev at 256k.de>
Date:   Thu Dec 3 12:33:08 2015 +0100

    [ref] Ruleset.getHostMatches: convert to generator function
---
 src/content/lib/ruleset.jsm | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/content/lib/ruleset.jsm b/src/content/lib/ruleset.jsm
index 1e49442..87f8e2b 100644
--- a/src/content/lib/ruleset.jsm
+++ b/src/content/lib/ruleset.jsm
@@ -874,11 +874,10 @@ Ruleset.prototype = {
    * Yields all matching hosts. For domains, this is in top-down order. For
    * example, first "com", then "foo", then "www".
    *
-   * @param string
-   *          host The host to get matching entries for.
-   * @return DomainEntry|IPAddressEntry
+   * @param {string} host The host to get matching entries for.
+   * @return {Generator<DomainEntry|IPAddressEntry>}
    */
-  getHostMatches : function(host) {
+  getHostMatches : function*(host) {
     if (!this.rules.isEmpty()) {
       // If `this.rules` is not empty, it contains any rules which do
       // not specify a host (host = undefined).
@@ -942,7 +941,7 @@ Ruleset.prototype = {
 
     //dprint("Checking origin rules and origin-to-destination rules.");
     // First, check for rules for each part of the origin host.
-    originouterloop: for (let entry in this.getHostMatches(originHost)) {
+    originouterloop: for (let entry of this.getHostMatches(originHost)) {
       //dprint(entry);
       for (let rule of entry.rules) {
         //dprint("Checking rule: " + rule);
@@ -976,7 +975,7 @@ Ruleset.prototype = {
         // entry we're currently looking at.
         if (ruleMatchedOrigin && rule.destinations) {
           //dprint("There are origin-to-destination rules using this origin rule.");
-          for (let destEntry in rule.destinations.getHostMatches(destHost)) {
+          for (let destEntry of rule.destinations.getHostMatches(destHost)) {
             //dprint(destEntry);
             for (let destRule of destEntry.rules) {
               //dprint("Checking rule: " + rule);
@@ -1014,7 +1013,7 @@ Ruleset.prototype = {
 
     //dprint("Checking dest rules.");
     // Last, check for rules for each part of the destination host.
-    destouterloop: for (let entry in this.getHostMatches(destHost)) {
+    destouterloop: for (let entry of this.getHostMatches(destHost)) {
       //dprint(entry);
       for (let rule of entry.rules) {
         //dprint("Checking rule: " + rule);

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