OLD | NEW |
1 title = $ping - ABP Test Pages | 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 (res ? pagelog("navigator.sendBeacon() returned true.") : pagelog("Beacon coul
d not be queued.")); | 18 if (res) |
| 19 pagelog("navigator.sendBeacon() returned true."); |
| 20 else |
| 21 pagelog("Beacon could not be queued."); |
| 22 |
25 } | 23 } |
26 </script> | 24 </script> |
27 | 25 |
28 <section class="site-panel"> | 26 <section class="site-panel"> |
29 <h2>$ping</h2> | 27 <h2>$ping</h2> |
30 <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> |
| 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> |
31 <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> |
32 </section> | 31 </section> |
33 | 32 |
34 <section class="site-panel"> | 33 <section class="site-panel"> |
35 <h2>Test case</h2> | 34 <h2>Test case</h2> |
36 <div class="testcase-container"> | 35 <div class="testcase-container"> |
37 <div class="testcase-row"><h3>Ping</h3> | 36 <div class="testcase-row"><h3>Ping</h3> |
38 <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> |
39 </div> | 38 </div> |
40 </div> | 39 </div> |
41 <h3>Filters</h3> | 40 <h3>Filters</h3> |
42 testpages.adblockplus.org/*^$ping | 41 <pre>testpages.adblockplus.org/*^$ping</pre> |
43 </section> | 42 </section> |
44 | 43 |
45 <section class="site-panel"> | 44 <section class="site-panel"> |
46 <h2>navigator.sendBeacon()</h2> | 45 <h2>navigator.sendBeacon()</h2> |
47 <div class="testcase-container"> | 46 <div class="testcase-container"> |
48 <div class="testcase-row"><h3>Ping</h3> | 47 <div class="testcase-row"><h3>Ping</h3> |
49 <div id="testcase-fo-ping"> | 48 <div id="testcase-fo-ping"> |
50 <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> |
51 </div> | 51 </div> |
52 </div> | 52 </div> |
53 </div> | 53 </div> |
54 <h3>Filters</h3> | 54 <h3>Filters</h3> |
55 testpages.adblockplus.org/*^$ping | 55 <pre>testpages.adblockplus.org/*^$ping</pre> |
56 </section> | 56 </section> |
OLD | NEW |