tor-browser

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

test_featurePolicy.html (1151B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test for geolocation + featurePolicy</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 <script class="testbody" type="text/javascript">
     10 
     11 SimpleTest.waitForExplicitFinish();
     12 
     13 var tests = [
     14  [ "geolocation 'none'", "denied"],
     15  [ "geolocation", "allowed"],
     16  [ "geolocation 'src'", "allowed"],
     17  [ "geolocation 'self'", "allowed"],
     18  [ "geolocation *", "allowed"],
     19  [ "geolocation http://random.net", "denied"],
     20  [ null, "allowed" ],
     21 ];
     22 
     23 function nextTest() {
     24  if (!tests.length) {
     25    SimpleTest.finish();
     26    return;
     27  }
     28 
     29  let test = tests.shift();
     30 
     31  var iframe = document.createElement("iframe");
     32  if (test[0]) {
     33    iframe.setAttribute("allow", test[0]);
     34  }
     35 
     36  window.continueTest = msg => {
     37    delete window.continueTest;
     38 
     39    is(msg, test[1], "Expected " + test[1] + " for " + test[0]);
     40    document.body.removeChild(iframe);
     41    SimpleTest.executeSoon(nextTest);
     42  };
     43 
     44  iframe.src = "file_featurePolicy.html";
     45  document.body.appendChild(iframe);
     46 }
     47 
     48 nextTest();
     49 </script>
     50 </body>
     51 </html>