tor-browser

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

test_bug1173171.html (1281B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1173171
      5 -->
      6 <head>
      7  <title>Test for Bug 1173171</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     10 </head>
     11 <body>
     12 
     13 <iframe id="testFrame"></iframe>
     14 
     15 <pre id="test">
     16 <script class="testbody" type="application/javascript">
     17 
     18 /** Test for Bug 1173171 */
     19 
     20 // __xhr(method, url, responseType__.
     21 // A simple async XMLHttpRequest call.
     22 // Returns a promise with the response.
     23 let xhr = function(method, url, responseType) {
     24  return new Promise(function(resolve) {
     25    let xhrInstance = new XMLHttpRequest();
     26    xhrInstance.open(method, url, true);
     27    xhrInstance.onload = function() {
     28      resolve(xhrInstance.response);
     29    };
     30    xhrInstance.onerror = function() {
     31      resolve(null);
     32    };
     33    xhrInstance.responseType = responseType;
     34    xhrInstance.send();
     35  });
     36 };
     37 
     38 let jarURL = "jar:http://mochi.test:8888/tests/modules/libjar/test/mochitest/bug403331.zip!/test.html";
     39 
     40 // Test behavior when blocking is deactivated and activated.
     41 add_task(async function() {
     42  let response = await xhr("GET", jarURL, "document");
     43  is(response, null, "Remote jars should be blocked.");
     44 });
     45 
     46 </script>
     47 </pre>
     48 
     49 </body>
     50 </html>