tor-browser

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

test_bug1507702.html (1414B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1507702
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 1507702</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11  <link rel="icon" href="about:crashparent"/>
     12 </head>
     13 <body>
     14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1507702">Mozilla Bug 1507702</a>
     15 <img src="about:crashparent">
     16 <img src="about:crashcontent">
     17 <iframe src="about:crashparent"></iframe>
     18 <iframe src="about:crashcontent"></iframe>
     19 <script>
     20  let urls = ["about:crashparent", "about:crashcontent"];
     21  async function testFetch() {
     22    const url = urls.shift();
     23    if (!url) {
     24      return Promise.resolve();
     25    }
     26 
     27    let threw;
     28    try {
     29      await fetch(url);
     30      threw = false;
     31    } catch (e) {
     32      threw = true;
     33    }
     34 
     35    ok(threw === true, "fetch should reject");
     36    return testFetch();
     37  }
     38 
     39  document.body.onload = async () => {
     40    for (const url of ["about:crashparent", "about:crashcontent"]) {
     41      SimpleTest.doesThrow(() => {
     42        top.location.href = url;
     43      }, "navigation should throw");
     44 
     45      SimpleTest.doesThrow(() => {
     46        location.href = url;
     47      }, "navigation should throw");
     48    }
     49 
     50    await testFetch();
     51    SimpleTest.finish();
     52  };
     53 
     54  SimpleTest.waitForExplicitFinish();
     55 </script>
     56 </body>
     57 </html>