| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 title = $xmlhttprequest Exception - ABP Test Pages | |
| 2 template = testcase | |
| 3 | |
| 4 {% set testcase_moreinfo = [ | |
| 5 ("Filter Options", "https://adblockplus.org/filters#options"), | |
| 6 ] %} | |
| 7 | |
| 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) { | |
| 16 pagelog("XMLHTTPRequest was aborted."); | |
| 17 } | |
| 18 | |
| 19 function failed(evt) { | |
| 20 pagelog("XMLHTTPRequest failed."); | |
| 21 } | |
| 22 | |
| 23 function makerequest() { | |
| 24 var req = new XMLHttpRequest(); | |
| 25 req.addEventListener("error", failed); | |
| 26 req.addEventListener("abort", aborted); | |
| 27 req.open("GET", "http://testpages.adblockplus.org/testcasefiles/xmlhttprequest exception/text.txt", true); | |
| 28 req.onload = function(e) { | |
| 29 if (this.status == 200) { | |
| 30 pagelog(this.responseText); | |
| 31 } | |
| 32 }; | |
| 33 req.send(); | |
| 34 } | |
| 35 | |
| 36 document.addEventListener('DOMContentLoaded', makerequest, false); | |
| 37 </script> | |
| 38 | |
| 39 <section class="site-panel"> | |
| 40 <h2>$xmlhttprequest Exception</h2> | |
| 41 <p>Check that usage of the $xmlhttprequest filter option in an exception filte r works as expected.</p> | |
| 42 </section> | |
| 43 | |
| 44 <section class="site-panel"> | |
| 45 <h2>Test case</h2> | |
| 46 <p>The XMLHTTPRequest should not be blocked. The Image should be blocked.</p> | |
| 47 <div class="testcase-container"> | |
| 48 <div class="testcase-row"> | |
| 49 <h3>XMLHTTPRequest</h3><div id="testcase-ex-xmlhttprequest"></div> | |
| 50 </div> | |
| 51 <div class="testcase-row"> | |
| 52 <h3>Image</h3><img class="testcase-image" src="/testcasefiles/xmlhttpreque stexception/image.jpg"/> | |
| 53 </div> | |
| 54 </div> | |
| 55 <h3>Filters</h3> | |
| 56 ||testpages.adblockplus.org/testcasefiles/xmlhttprequestexception/*<br> | |
| 57 @@testpages.adblockplus.org/testcasefiles/xmlhttprequestexception/$xmlhttprequ est | |
| 58 </section> | |
| OLD | NEW |