Skip to content

Commit

Permalink
Fix #719 content option rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizzick committed Jun 6, 2017
1 parent bf7ff25 commit 237da1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Extension/lib/filter/rules/url-filter-rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,11 @@
} else if (optionName[0] === api.FilterRule.NOT_MARK && optionName.substring(1) in UrlFilterRule.contentTypes) {
restrictedContentType |= UrlFilterRule.contentTypes[optionName.substring(1)]; // jshint ignore:line
} else if (optionName in UrlFilterRule.ignoreOptions) { // jshint ignore:line
// Ignore
if (optionName === 'CONTENT' && optionsParts.length === 1) {
//https://github.com/AdguardTeam/AdguardBrowserExtension/issues/719
throw 'Single $content option rule is ignored: ' + this.ruleText;
}
// Ignore others
} else {
throw 'Unknown option: ' + optionName;
}
Expand Down
3 changes: 3 additions & 0 deletions Extension/tests/url-filter/test-url-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ QUnit.test("Content-specific URL blocking", function (assert) {
assert.notOk(rule.isFiltered("ws://test.ru/?ololo=ololo", false, RequestTypes.WEBSOCKET));
assert.notOk(rule.isFiltered("http://test.ru/?ololo=ololo", false, RequestTypes.SUBDOCUMENT));
assert.notOk(rule.isFiltered("http://test.ru/?ololo=ololo", false, RequestTypes.OTHER));
mask = "test.com$content,script";
rule = new adguard.rules.UrlFilterRule(mask);
assert.ok(rule != null);
});

QUnit.test("UrlFilter class tests", function (assert) {
Expand Down

0 comments on commit 237da1b

Please sign in to comment.