tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

doc-xhr-run-to-completion.html (912B)


      1 <!-- This Source Code Form is subject to the terms of the Mozilla Public
      2    - License, v. 2.0. If a copy of the MPL was not distributed with this
      3    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
      4 <!DOCTYPE html>
      5 <meta charset=UTF-8>
      6 <script>
      7 const cpmm = SpecialPowers.Services.cpmm;
      8 var result;
      9 
     10 function newXHR() {
     11    var xhr = new XMLHttpRequest();
     12    xhr.open('GET', 'doc-xhr-run-to-completion.html', true);
     13    xhr.onload = done;
     14    xhr.onerror = done;
     15    xhr.onreadystatechange = done;
     16    xhr.ontimeout = done;
     17    xhr.send();
     18 }
     19 
     20 function singleRequest() {
     21    result = "test failed";
     22    newXHR();
     23    debugger;
     24    result = "test passed";
     25 }
     26 
     27 function multipleRequests() {
     28    result = "test failed";
     29    newXHR();
     30    newXHR();
     31    debugger;
     32    newXHR();
     33    debugger;
     34    debugger;
     35    result = "test passed";
     36 }
     37 
     38 function done() {
     39    cpmm.sendAsyncMessage(result);
     40 }
     41 </script>