Skip to content

Commit b4e098c

Browse files
committed
TextPatterMatcher renamed to TextRegexpMatcher
I even had a spell error
1 parent d483b96 commit b4e098c

5 files changed

Lines changed: 17 additions & 14 deletions

File tree

lib/matchers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Matcher.parse = function parse(filterRule) {
1717
} else if (stringStartsWith(filterRule, '|')) {
1818
return new PrefixMatcher(filterRule.substring(1));
1919
} else {
20-
return new TextPatterMatcher(filterRule);
20+
return new TextRegexpMatcher(filterRule);
2121
}
2222
};
2323

@@ -45,7 +45,7 @@ let DomainNameMatcher = Class({
4545
}
4646
});
4747

48-
let TextPatterMatcher = Class({
48+
let TextRegexpMatcher = Class({
4949
extends: Matcher,
5050

5151
initialize: function initialize(expression) {
@@ -75,4 +75,4 @@ let TextPatterMatcher = Class({
7575
exports.Matcher = Matcher;
7676
exports.PrefixMatcher = PrefixMatcher;
7777
exports.DomainNameMatcher = DomainNameMatcher;
78-
exports.TextPatterMatcher = TextPatterMatcher;
78+
exports.TextRegexpMatcher = TextRegexpMatcher;

lib/proxy.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ function applyFilter(proxyService, uri, proxyInfo) {
8585
}
8686

8787
if (matchesAnyIn(parsedRules.whiteList, uri, allDomains)) {
88-
console.log(uri.spec, ' matched whiteList');
88+
console.log(uri.spec + ' matched whiteList');
8989
return proxyInfo;
9090
} else if (matchesAnyIn(parsedRules.proxyList, uri, allDomains)) {
91-
console.log(uri.spec, ' matched proxyList');
91+
console.log(uri.spec + ' matched proxyList');
9292
return defaultProxy;
9393
} else {
94-
console.log(uri.spec, ' matched nothing');
94+
console.log(uri.spec + ' matched nothing');
9595
return proxyInfo;
9696
}
9797
} else { // Proxy Off
@@ -104,7 +104,10 @@ var AutoProxyPlusFilter = Class({
104104
interfaces: [ 'nsIProtocolProxyFilter' ],
105105
applyFilter: function(proxyService, uri, proxyInfo) {
106106
var ret = applyFilter(proxyService, uri, proxyInfo);
107-
console.log(ret);
107+
108+
if (ret) {
109+
console.log(uri.spec + " [proxy: " + ret.type + '://' + ret.host + ':' + ret.port + ']');
110+
}
108111

109112
return ret;
110113
}

lib/proxy_rule.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
let ss = require('sdk/simple-storage');
22
let { Class } = require('sdk/core/heritage');
33
const { EventTarget } = require("sdk/event/target");
4-
let { Matcher, PrefixMatcher, DomainNameMatcher, TextPatterMatcher } = require('./matchers');
4+
let { Matcher, PrefixMatcher, DomainNameMatcher, TextRegexpMatcher } = require('./matchers');
55
let { on, once, off, emit } = require('sdk/event/core');
66

77
if (!ss.storage.userProxyRules) {
@@ -63,7 +63,7 @@ ProxyRule.prototype.toMatcher = function() {
6363
} else if (this.type == 'prefix') {
6464
return new PrefixMatcher(this.expression);
6565
} else if (this.type == 'expression') {
66-
return new TextPatterMatcher(this.expression);
66+
return new TextRegexpMatcher(this.expression);
6767
} else {
6868
return undefined;
6969
}

lib/proxy_rules_subscription.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
let { domainOf, allDomainsOf } = require('./domain_utils');
22
let { stringStartsWith } = require('./utils');
3-
let { Matcher, PrefixMatcher, DomainNameMatcher, TextPatterMatcher } = require('./matchers');
3+
let { Matcher, PrefixMatcher, DomainNameMatcher, TextRegexpMatcher } = require('./matchers');
44
let XMLHttpRequest = require('sdk/net/xhr').XMLHttpRequest;
55
let base64 = require("sdk/base64");
66
let sp = require("sdk/simple-prefs");
@@ -71,7 +71,7 @@ function parseGfwList(gfwlist) {
7171
}
7272

7373

74-
if (matcher instanceof TextPatterMatcher) {
74+
if (matcher instanceof TextRegexpMatcher) {
7575
if (matcher.isRegex()) {
7676
addValueToKey(toList, DEFAULT, matcher);
7777
} else {

test/test-matchers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
let { Matcher, PrefixMatcher, DomainNameMatcher, TextPatterMatcher } = require('./matchers');
1+
let { Matcher, PrefixMatcher, DomainNameMatcher, TextRegexpMatcher } = require('./matchers');
22

33
exports['test Matcher parsing'] = function(assert) {
4-
assert.ok(Matcher.parse("alliance.org.hk") instanceof TextPatterMatcher);
5-
assert.ok(Matcher.parse(".allinfa.com") instanceof TextPatterMatcher);
4+
assert.ok(Matcher.parse("alliance.org.hk") instanceof TextRegexpMatcher);
5+
assert.ok(Matcher.parse(".allinfa.com") instanceof TextRegexpMatcher);
66
assert.ok(Matcher.parse("|http://allinfa.com") instanceof PrefixMatcher);
77
assert.ok(Matcher.parse("||allinfo.com") instanceof DomainNameMatcher);
88

0 commit comments

Comments
 (0)