| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 title = $xmlhttprequest Exception - ABP Test Pages | 1 title = $xmlhttprequest Exception |
| 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) { | |
|
kzar
2018/04/19 13:08:20
This function is in the code 5 times in different
kzar
2018/04/23 09:57:27
I think the code duplication is a bigger problem t
kzar
2018/06/04 17:17:28
I still think it would be better if we avoided dup
rossg
2018/06/07 10:30:23
I have inlined the function into the testcases tem
kzar
2018/06/07 11:43:03
Great, thanks.
| |
| 10 var log = document.getElementById("testcase-ex-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", "http://testpages.adblockplus.org/testcasefiles/xmlhttprequest exception/text.txt", true); | 21 req.open("GET", "http://testpages.adblockplus.org/testcasefiles/xmlhttprequest exception/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 Exception</h2> | 34 <h2>$xmlhttprequest Exception</h2> |
| 41 <p>Check that usage of the $xmlhttprequest filter option in an exception filte r works as expected.</p> | 35 <p>Check that usage of the $xmlhttprequest filter option in an exception filte r works as expected.</p> |
| 36 <p>With the filter(s) displayed below each test case added to ABP (or with the testcase subscription installed and active), the XMLHTTPRequest should not be b locked while the image should be.</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 not be blocked. The Image should be blocked.</p> | 41 <p>The XMLHTTPRequest should not be blocked. The Image should 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-ex-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 stexception/image.jpg"/> | 47 <h3>Image</h3><img class="testcase-image" src="/testcasefiles/xmlhttpreque stexception/image.jpg"/> |
| 53 </div> | 48 </div> |
| 54 </div> | 49 </div> |
| 55 <h3>Filters</h3> | 50 <h3>Filters</h3> |
| 56 ||testpages.adblockplus.org/testcasefiles/xmlhttprequestexception/*<br> | 51 <pre>||testpages.adblockplus.org/testcasefiles/xmlhttprequestexception/*</pre> |
| 57 @@testpages.adblockplus.org/testcasefiles/xmlhttprequestexception/$xmlhttprequ est | 52 <pre>@@testpages.adblockplus.org/testcasefiles/xmlhttprequestexception/$xmlhtt prequest</pre> |
| 58 </section> | 53 </section> |
| LEFT | RIGHT |