tor-browser

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

test_empty_directive.html (1230B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1439425
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 1439425</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11 </head>
     12 <body>
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1439425">Mozilla Bug 1439425</a>
     14 <p id="display"></p>
     15 
     16 <iframe id="cspframe"></iframe>
     17 
     18 <pre id="test">
     19 
     20 <script class="testbody" type="text/javascript">
     21 let consoleCount = 0;
     22 
     23 function cleanup() {
     24  SpecialPowers.postConsoleSentinel();
     25 }
     26 
     27 function finish() {
     28  SimpleTest.finish();
     29 }
     30 
     31 SpecialPowers.registerConsoleListener(function ConsoleMsgListener(aMsg) {
     32  if (aMsg.message == "SENTINEL") {
     33    is(consoleCount, 0);
     34    SimpleTest.executeSoon(finish);
     35  } else if (aMsg.message.includes("Content-Security-Policy")) {
     36    ++consoleCount;
     37    ok(false, "Must never see a console warning here");
     38  }
     39 });
     40 
     41 // set up and start testing
     42 SimpleTest.waitForExplicitFinish();
     43 let frame = document.getElementById('cspframe');
     44 frame.onload = () => {
     45  SimpleTest.executeSoon(cleanup);
     46 };
     47 frame.src = 'file_empty_directive.html';
     48 </script>
     49 </pre>
     50 </body>
     51 </html>