tor-browser

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

test_delivering.html (1044B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test for delivering reports</title>
      5  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      7 </head>
      8 <body>
      9 
     10 <script type="application/javascript">
     11 
     12 // Setting prefs.
     13 SpecialPowers.pushPrefEnv({ set: [
     14  ["dom.reporting.delivering.timeout", 1],
     15  ["dom.reporting.delivering.maxFailures", 2],
     16  ["dom.reporting.delivering.maxReports", 3],
     17 ]})
     18 
     19 // Tests run in iframes because the origin must be secure for report-to header.
     20 .then(_ => {
     21  window.addEventListener("message", e => {
     22    if (e.data.type == "finish") {
     23      SimpleTest.finish();
     24      return;
     25    }
     26 
     27    if (e.data.type == "test") {
     28      ok(e.data.check, e.data.msg);
     29      return;
     30    }
     31 
     32    ok(false, "Invalid message");
     33  });
     34 
     35  let ifr = document.createElement("iframe");
     36  ifr.src = "https://example.org/tests/dom/reporting/tests/iframe_delivering.html";
     37 
     38  document.body.appendChild(ifr);
     39 });
     40 
     41 SimpleTest.waitForExplicitFinish();
     42 
     43 </script>
     44 </body>
     45 </html>