OLD | NEW |
1 title = $websocket - ABP Test Pages | 1 title = $websocket |
2 template = testcase | 2 template = testcase |
3 | 3 |
4 {% set testcase_moreinfo = [ | 4 {% set testcase_moreinfo = [ |
5 ("Filter Options", "https://adblockplus.org/filters#options"), | 5 ("Filter Options", "https://adblockplus.org/filters#options"), |
6 ] %} | 6 ] %} |
7 | 7 |
8 | 8 |
9 <script> | 9 <script> |
10 function pagelog(message) { | |
11 var log = document.getElementById("testcase-fo-websocket"); | |
12 log.innerText = log.innerText + message + "\n"; | |
13 console.log(message); | |
14 } | |
15 | |
16 function ws_open(evt) { | 10 function ws_open(evt) { |
17 pagelog("Connected"); | 11 pagelog("Connected"); |
18 websocket.send("Test message was echoed back"); | 12 websocket.send("Test message was echoed back"); |
19 } | 13 } |
20 function ws_close(evt) { | 14 function ws_close(evt) { |
21 pagelog("Disconnected"); | 15 pagelog("Disconnected"); |
22 } | 16 } |
23 function ws_message(evt) { | 17 function ws_message(evt) { |
24 pagelog("Received message: "); | 18 pagelog("Received message: "); |
25 pagelog(evt.data); | 19 pagelog(evt.data); |
(...skipping 15 matching lines...) Expand all Loading... |
41 websocket.onmessage = function(evt) { ws_message(evt) }; | 35 websocket.onmessage = function(evt) { ws_message(evt) }; |
42 websocket.onerror = function(evt) { ws_error(evt) }; | 36 websocket.onerror = function(evt) { ws_error(evt) }; |
43 } | 37 } |
44 | 38 |
45 document.addEventListener('DOMContentLoaded', ws_connect, false); | 39 document.addEventListener('DOMContentLoaded', ws_connect, false); |
46 </script> | 40 </script> |
47 | 41 |
48 <section class="site-panel"> | 42 <section class="site-panel"> |
49 <h2>$websocket</h2> | 43 <h2>$websocket</h2> |
50 <p>Check that usage of the $websocket filter option works as expected.</p> | 44 <p>Check that usage of the $websocket filter option works as expected.</p> |
| 45 <p>With the filter displayed below each test case added to ABP (or with the te
stcase subscription installed and active), the websocket connection should be bl
ocked and not echo back the test message.</p> |
51 </section> | 46 </section> |
52 | 47 |
53 <section class="site-panel"> | 48 <section class="site-panel"> |
54 <h2>Test case</h2> | 49 <h2>Test case</h2> |
55 <div class="testcase-container"> | 50 <div class="testcase-container"> |
56 <div class="testcase-row"><h3>WebSocket Request</h3><div id="testcase-fo-webs
ocket"></div></div> | 51 <div class="testcase-row"><h3>WebSocket Request</h3><div id="testcase-output"
></div></div> |
57 </div> | 52 </div> |
58 <h3>Filters</h3> | 53 <h3>Filters</h3> |
59 $websocket,domain=testpages.adblockplus.org | 54 <pre>$websocket,domain=testpages.adblockplus.org</pre> |
60 </section> | 55 </section> |
OLD | NEW |