Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 title = $ping | 1 title = $ping |
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-ping"); | |
12 log.innerText = log.innerText + message + "\n"; | |
13 console.log(message); | |
14 } | |
15 | |
16 function do_ping() { | 10 function do_ping() { |
17 var button = document.getElementById("ping-button"); | 11 var button = document.getElementById("ping-button"); |
18 button.parentNode.removeChild(button); | 12 button.parentNode.removeChild(button); |
19 | 13 |
20 pagelog("Calling navigator.sendBeacon()"); | 14 pagelog("Calling navigator.sendBeacon()"); |
21 var res = navigator.sendBeacon("/en/filters/ping", "Testdata" ); | 15 var res = navigator.sendBeacon("/en/filters/ping", "Testdata" ); |
22 pagelog("navigator.sendBeacon() called."); | 16 pagelog("navigator.sendBeacon() called."); |
23 | 17 |
24 if(res) { | 18 if (res) |
kzar
2018/06/04 17:17:29
Nit: This looks better, but still a couple of mino
rossg
2018/06/07 10:30:25
Done.
| |
25 pagelog("navigator.sendBeacon() returned true.") | 19 pagelog("navigator.sendBeacon() returned true."); |
26 } | 20 else |
27 else { | 21 pagelog("Beacon could not be queued."); |
28 pagelog("Beacon could not be queued.") | |
29 } | |
30 | 22 |
31 } | 23 } |
32 </script> | 24 </script> |
33 | 25 |
34 <section class="site-panel"> | 26 <section class="site-panel"> |
35 <h2>$ping</h2> | 27 <h2>$ping</h2> |
36 <p>Check that usage of the $ping filter option is working as expected.</p> | 28 <p>Check that usage of the $ping filter option is working as expected.</p> |
37 <p>With the filter displayed below each test case added to ABP (or with the te stcase subscription installed and active), the pings triggered in the test case panels below should be blocked.</p> | 29 <p>With the filter displayed below each test case added to ABP (or with the te stcase subscription installed and active), the pings triggered in the test case panels below should be blocked.</p> |
38 <p>Note: Browsers will always return true if the ping is successfully queued, not if sent. Check with the Adblock Plus DevTools panel to check if it was actua lly blocked.</p> | 30 <p>Note: Browsers will always return true if the ping is successfully queued, not if sent. Check with the Adblock Plus DevTools panel to check if it was actua lly blocked.</p> |
39 </section> | 31 </section> |
40 | 32 |
41 <section class="site-panel"> | 33 <section class="site-panel"> |
42 <h2>Test case</h2> | 34 <h2>Test case</h2> |
43 <div class="testcase-container"> | 35 <div class="testcase-container"> |
44 <div class="testcase-row"><h3>Ping</h3> | 36 <div class="testcase-row"><h3>Ping</h3> |
45 <a href="http://example.com" target="_blank" ping="/en/filters/ping">Link based ping</a> | 37 <a href="http://example.com" target="_blank" ping="/en/filters/ping">Link based ping</a> |
46 </div> | 38 </div> |
47 </div> | 39 </div> |
48 <h3>Filters</h3> | 40 <h3>Filters</h3> |
49 <pre>testpages.adblockplus.org/*^$ping</pre> | 41 <pre>testpages.adblockplus.org/*^$ping</pre> |
50 </section> | 42 </section> |
51 | 43 |
52 <section class="site-panel"> | 44 <section class="site-panel"> |
53 <h2>navigator.sendBeacon()</h2> | 45 <h2>navigator.sendBeacon()</h2> |
54 <div class="testcase-container"> | 46 <div class="testcase-container"> |
55 <div class="testcase-row"><h3>Ping</h3> | 47 <div class="testcase-row"><h3>Ping</h3> |
56 <div id="testcase-fo-ping"> | 48 <div id="testcase-fo-ping"> |
57 <button id="ping-button" onclick="do_ping()">Send Ping</button> | 49 <button id="ping-button" onclick="do_ping()">Send Ping</button> |
50 <div id="testcase-output"></div> | |
58 </div> | 51 </div> |
59 </div> | 52 </div> |
60 </div> | 53 </div> |
61 <h3>Filters</h3> | 54 <h3>Filters</h3> |
62 <pre>testpages.adblockplus.org/*^$ping</pre> | 55 <pre>testpages.adblockplus.org/*^$ping</pre> |
63 </section> | 56 </section> |
LEFT | RIGHT |