LEFT | RIGHT |
1 title = $xmlhttprequest | 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 aborted(evt) { | 9 function aborted(evt) { |
10 pagelog("XMLHTTPRequest was aborted."); | 10 pagelog("XMLHTTPRequest was aborted."); |
11 } | 11 } |
12 | 12 |
13 function failed(evt) { | 13 function failed(evt) { |
14 pagelog("XMLHTTPRequest failed."); | 14 pagelog("XMLHTTPRequest failed."); |
15 } | 15 } |
16 | 16 |
17 function makerequest() { | 17 function makerequest() { |
18 var req = new XMLHttpRequest(); | 18 var req = new XMLHttpRequest(); |
19 req.addEventListener("error", failed); | 19 req.addEventListener("error", failed); |
20 req.addEventListener("abort", aborted); | 20 req.addEventListener("abort", aborted); |
21 req.open("GET", "https://{{ site_url|strip_proto }}/testcasefiles/xmlhttpreque
st/text.txt", true); | 21 req.open("GET", "{{ site_url }}/testcasefiles/xmlhttprequest/text.txt", true); |
22 req.onload = function(e) { | 22 req.onload = function(e) { |
23 if (this.status == 200) { | 23 if (this.status == 200) { |
24 pagelog(this.responseText); | 24 pagelog(this.responseText); |
25 } | 25 } |
26 }; | 26 }; |
27 req.send(); | 27 req.send(); |
28 } | 28 } |
29 | 29 |
30 document.addEventListener('DOMContentLoaded', makerequest, false); | 30 document.addEventListener('DOMContentLoaded', makerequest, false); |
31 </script> | 31 </script> |
(...skipping 13 matching lines...) Expand all Loading... |
45 <div id="testcase-output"></div> | 45 <div id="testcase-output"></div> |
46 <div id="testcase-output-expected">XMLHTTPRequest failed.</div> | 46 <div id="testcase-output-expected">XMLHTTPRequest failed.</div> |
47 </div> | 47 </div> |
48 <div class="testcase-row"> | 48 <div class="testcase-row"> |
49 <h3>Image</h3><img class="testcase-image" src="/testcasefiles/xmlhttpreque
st/image.jpg"/> | 49 <h3>Image</h3><img class="testcase-image" src="/testcasefiles/xmlhttpreque
st/image.jpg"/> |
50 </div> | 50 </div> |
51 </div> | 51 </div> |
52 <h3>Filters</h3> | 52 <h3>Filters</h3> |
53 <pre>{{ site_url|strip_proto }}/testcasefiles/xmlhttprequest/$xmlhttprequest</
pre> | 53 <pre>{{ site_url|strip_proto }}/testcasefiles/xmlhttprequest/$xmlhttprequest</
pre> |
54 </section> | 54 </section> |
LEFT | RIGHT |