-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
testpage.html
97 lines (93 loc) · 2.39 KB
/
testpage.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
div {
margin: 2px 0;
border: 1px solid black;
}
img {
display: block;
}
</style>
</head>
<body>
<h2 id="blocksub">Block requests containing 'blocksub' (except main_frame)</h2>
Given the following rule:
<pre>
{
"id": 1,
"condition": {
"urlFilter": "blocksub"
},
"action": {
"type": "block"
}
},
</pre>
<div>
rule 1 will block this image (containing 'blocksub'):
<img src="https://developer.mozilla.org/favicon.ico?blocksub">
</div>
<div>
rule 1 will not block this image (does not contain 'blocksub'):
<img src="https://developer.mozilla.org/favicon.ico">
</div>
<div>
rule 1 will not block top-level navigations to
<a href="https://developer.mozilla.org/favicon.ico?blocksub">https://developer.mozilla.org/favicon.ico?blocksub</a>
because top-level navigation ("main_frame") requests are not matched
when "resourceTypes" and "excludedResourceTypes" are not specified.
</div>
<h2 id="blocktop">Block main_frame requests containing 'blocktop'</h2>
Given the following rule:
<pre>
{
"id": 2,
"condition": {
"urlFilter": "blocktop",
"resourceTypes": ["main_frame"]
},
"action": {
"type": "block"
}
},
</pre>
<div>
rule 2 will block top-level navigation to
<a href="https://developer.mozilla.org/favicon.ico?blocktop">https://developer.mozilla.org/favicon.ico?blocktop</a>
because the "resourceTypes" array contains "main_frame".
</div>
<div>
rule 2 will not block this image (containing 'blocktop')
<img src="https://developer.mozilla.org/favicon.ico?blocktop">
because "image" is not in the "resourceTypes" array.
</div>
<h2 id="blockall">Block all requests containing 'blockall'</h2>
Given the following rule:
<pre>
{
"id": 3,
"condition": {
"urlFilter": "blockall",
"excludedResourceTypes": []
},
"action": {
"type": "block"
}
}
</pre>
<div>
rule 3 will block this image (containing 'blockall'):
<img src="https://developer.mozilla.org/favicon.ico?blockall">
</div>
<div>
rule 3 will block top-level navigation to
<a href="https://developer.mozilla.org/favicon.ico?blockall">https://developer.mozilla.org/favicon.ico?blockall</a>
because "excludedResourceTypes" is set to an empty array.
<br>
Note: not blocked in Chrome due to <a href="https://crbug.com/1432871">https://crbug.com/1432871</a>.
</div>
</body>
</html>