Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/abp2blocklist.js

Issue 29452289: Issue 5283 - Add support for $websocket and $webrtc (Closed) Base URL: https://hg.adblockplus.org/abp2blocklist
Patch Set: Created May 31, 2017, 2:42 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« node_modules/filterClasses.js ('K') | « node_modules/filterClasses.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/abp2blocklist.js
===================================================================
--- a/test/abp2blocklist.js
+++ b/test/abp2blocklist.js
@@ -79,27 +79,27 @@
testRules(test, ["test.com#@#whatever", "##whatever"], []);
testRules(test, ["~test.com##whatever"], []);
test.done();
},
testRequestFilters: function(test)
{
- testRules(test, ["/foo", "||test.com", "http://example.com/foo"], [
+ testRules(test, ["/foo", "||test.com", "|http://example.com/foo"], [
Manish Jethani 2017/05/31 02:51:43 We can talk about this. As I said earlier, I don't
Sebastian Noack 2017/05/31 07:09:26 A pattern of "http://example.com" should match any
Manish Jethani 2017/05/31 07:22:46 I see what you mean. In that case we should check
Sebastian Noack 2017/05/31 08:05:46 How about this: * If the filter neither starts wi
Manish Jethani 2017/06/02 08:02:36 These rules are both complicated and wrong. For ex
Sebastian Noack 2017/06/02 10:58:50 Note that "raw" is for all requests initiated by c
Manish Jethani 2017/07/03 18:34:52 Makes sense, done.
{trigger: {"url-filter": "^https?://.*/foo",
"resource-type": ["image", "style-sheet", "script", "font",
"media", "raw", "document"]},
action: {type: "block"}},
{trigger: {"url-filter": "^https?://([^/]+\\.)?test\\.com",
"url-filter-is-case-sensitive": true,
"resource-type": ["image", "style-sheet", "script", "font",
"media", "raw", "document"]},
action: {type: "block"}},
- {trigger: {"url-filter": "http://example\\.com/foo",
+ {trigger: {"url-filter": "^http://example\\.com/foo",
"resource-type": ["image", "style-sheet", "script", "font",
"media", "raw", "document"]},
action: {type: "block"}}
]);
testRules(test, ["||example.com"], [
{trigger: {"url-filter": "^https?://([^/]+\\.)?example\\.com",
"url-filter-is-case-sensitive": true,
@@ -209,28 +209,32 @@
},
testRequestTypeMapping: function(test)
{
testRules(
test,
["1", "2$image", "3$stylesheet", "4$script", "5$font", "6$media",
"7$popup", "8$object", "9$object_subrequest", "10$xmlhttprequest",
- "11$ping", "12$subdocument", "13$other", "14$IMAGE",
- "15$script,PING,Popup", "16$~image"],
+ "11$websocket", "12$webrtc",
+ "13$ping", "14$subdocument", "15$other", "16$IMAGE",
+ "17$script,PING,Popup", "18$~image"],
[["image", "style-sheet", "script", "font", "media", "raw", "document" ],
["image"],
["style-sheet"],
["script"],
["font"],
["media"],
["popup"],
["media"],
["raw"],
["raw"],
+ ["raw"], // WebSocket
+ ["raw"], // WebRTC: STUN
+ ["raw"], // WebRTC: TURN
["raw"],
["document"],
["raw"],
["image"],
["script", "popup", "raw" ],
["style-sheet", "script", "font", "media", "raw", "document"]],
rules => rules.map(rule => rule.trigger["resource-type"])
);
@@ -269,10 +273,32 @@
testUnicode: function(test)
{
testRules(test, ["$domain=🐈.cat"], ["*xn--zn8h.cat"],
rules => rules[0]["trigger"]["if-domain"]);
testRules(test, ["🐈$domain=🐈.cat"], []);
testRules(test, ["###🐈"], []);
test.done();
+ },
+
+ testWebSocket: function(test)
+ {
+ testRules(test, ["foo$websocket"], [
+ {trigger: {"url-filter": "^wss?://.*foo", "resource-type": ["raw"]},
+ action: {type: "block"}}
+ ]);
+
+ test.done();
+ },
+
+ testWebRTC: function(test)
+ {
+ testRules(test, ["foo$webrtc"], [
+ {trigger: {"url-filter": "^stuns?:.*foo", "resource-type": ["raw"]},
+ action: {type: "block"}},
+ {trigger: {"url-filter": "^turns?:.*foo", "resource-type": ["raw"]},
+ action: {type: "block"}}
+ ]);
+
+ test.done();
}
};
« node_modules/filterClasses.js ('K') | « node_modules/filterClasses.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld