OLD | NEW |
1 title = $xmlhttprequest - ABP Test Pages | 1 title = $xmlhttprequest |
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 <script> | 8 <script> |
9 function pagelog(message) { | |
10 var log = document.getElementById("testcase-fo-xmlhttprequest"); | |
11 log.innerText = log.innerText + message + "\n"; | |
12 console.log(message); | |
13 } | |
14 | |
15 function aborted(evt) { | 9 function aborted(evt) { |
16 pagelog("XMLHTTPRequest was aborted."); | 10 pagelog("XMLHTTPRequest was aborted."); |
17 } | 11 } |
18 | 12 |
19 function failed(evt) { | 13 function failed(evt) { |
20 pagelog("XMLHTTPRequest failed."); | 14 pagelog("XMLHTTPRequest failed."); |
21 } | 15 } |
22 | 16 |
23 function makerequest() { | 17 function makerequest() { |
24 var req = new XMLHttpRequest(); | 18 var req = new XMLHttpRequest(); |
25 req.addEventListener("error", failed); | 19 req.addEventListener("error", failed); |
26 req.addEventListener("abort", aborted); | 20 req.addEventListener("abort", aborted); |
27 req.open("GET", "https://testpages.adblockplus.org/testcasefiles/xmlhttpreques
t/text.txt", true); | 21 req.open("GET", "https://testpages.adblockplus.org/testcasefiles/xmlhttpreques
t/text.txt", true); |
28 req.onload = function(e) { | 22 req.onload = function(e) { |
29 if (this.status == 200) { | 23 if (this.status == 200) { |
30 pagelog(this.responseText); | 24 pagelog(this.responseText); |
31 } | 25 } |
32 }; | 26 }; |
33 req.send(); | 27 req.send(); |
34 } | 28 } |
35 | 29 |
36 document.addEventListener('DOMContentLoaded', makerequest, false); | 30 document.addEventListener('DOMContentLoaded', makerequest, false); |
37 </script> | 31 </script> |
38 | 32 |
39 <section class="site-panel"> | 33 <section class="site-panel"> |
40 <h2>$xmlhttprequest</h2> | 34 <h2>$xmlhttprequest</h2> |
41 <p>Check that usage of the $xmlhttprequest filter option works as expected.</p
> | 35 <p>Check that usage of the $xmlhttprequest filter option works as expected.</p
> |
| 36 <p>With the filter displayed below each test case added to ABP (or with the te
stcase subscription installed and active), the XMLHTTPRequest in each test case
panel should be blocked but the images should not.</p> |
42 </section> | 37 </section> |
43 | 38 |
44 <section class="site-panel"> | 39 <section class="site-panel"> |
45 <h2>Test case</h2> | 40 <h2>Test case</h2> |
46 <p>The XMLHTTPRequest should be blocked. The Image should not be blocked.</p> | 41 <p>The XMLHTTPRequest should be blocked. The Image should not be blocked.</p> |
47 <div class="testcase-container"> | 42 <div class="testcase-container"> |
48 <div class="testcase-row"> | 43 <div class="testcase-row"> |
49 <h3>XMLHTTPRequest</h3><div id="testcase-fo-xmlhttprequest"></div> | 44 <h3>XMLHTTPRequest</h3><div id="testcase-output"></div> |
50 </div> | 45 </div> |
51 <div class="testcase-row"> | 46 <div class="testcase-row"> |
52 <h3>Image</h3><img class="testcase-image" src="/testcasefiles/xmlhttpreque
st/image.jpg"/> | 47 <h3>Image</h3><img class="testcase-image" src="/testcasefiles/xmlhttpreque
st/image.jpg"/> |
53 </div> | 48 </div> |
54 </div> | 49 </div> |
55 <h3>Filters</h3> | 50 <h3>Filters</h3> |
56 testpages.adblockplus.org/testcasefiles/xmlhttprequest/$xmlhttprequest | 51 <pre>testpages.adblockplus.org/testcasefiles/xmlhttprequest/$xmlhttprequest</p
re> |
57 </section> | 52 </section> |
OLD | NEW |