tor-browser

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

script-crossorigin-network.sub.html (3579B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>HTMLScriptElement: crossorigin attribute network test</title>
      4 <link rel="author" title="KiChjang" href="mailto:kungfukeith11@gmail.com">
      5 <link rel="help" href="https://html.spec.whatwg.org/multipage/#cors-settings-attribute">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 
      9 <body>
     10  <script type="text/javascript">
     11  var test1 = async_test("same-origin use-credentials");
     12  var test2 = async_test("same-origin invalid");
     13  var test3 = async_test("same-origin missing");
     14  var test4 = async_test("cross-origin use-credentials");
     15  var test5 = async_test("cross-origin invalid");
     16  var test6 = async_test("cross-origin missing");
     17  var test7 = async_test("cross-origin use-credentials mixed case");
     18  var test8 = async_test("cross-origin use-credentials non-ASCII");
     19 
     20  var same = "resources/cross-origin.py";
     21  var cross = new URL(same, location);
     22  cross.port = {{ports[http][1]}};
     23 
     24  var script1 = document.createElement("script");
     25  script1.src = same;
     26  script1.crossOrigin = "use-credentials";
     27 
     28  var script2 = document.createElement("script");
     29  script2.src = same;
     30  script2.crossOrigin = "gibberish";
     31 
     32  var script3 = document.createElement("script");
     33  script3.src = same;
     34 
     35  var script4 = document.createElement("script");
     36  script4.src = cross;
     37  script4.crossOrigin = "use-credentials";
     38 
     39  var script5 = document.createElement("script");
     40  script5.src = cross;
     41  script5.crossOrigin = "gibberish";
     42 
     43  var script6 = document.createElement("script");
     44  script6.src = cross;
     45 
     46  var script7 = document.createElement("script");
     47  script7.src = cross;
     48  script7.crossOrigin = "UsE-cReDenTiAlS";
     49 
     50  var script8 = document.createElement("script");
     51  script8.src = cross;
     52  script8.crossOrigin = "uſe-credentialſ";
     53 
     54  document.cookie = "milk=yes";
     55 
     56  document.body.appendChild(script1);
     57  script1.onload = function() {
     58    test1.step(function() {
     59      assert_true(included, "credentials included (credentialsMode include)");
     60      test1.done();
     61    });
     62  };
     63 
     64  document.body.appendChild(script2);
     65  script2.onload = function() {
     66    test2.step(function() {
     67      assert_true(included, "credentials included (credentialsMode same-origin)");
     68      test2.done();
     69    });
     70  };
     71 
     72  document.body.appendChild(script3);
     73  script3.onload = function() {
     74    test3.step(function() {
     75      assert_true(included, "credentials included (credentialsMode include)");
     76      test3.done();
     77    });
     78  };
     79 
     80  document.body.appendChild(script4);
     81  script4.onload = function() {
     82    test4.step(function() {
     83      assert_true(included, "credentials included (credentialsMode include)");
     84      test4.done();
     85    });
     86  };
     87 
     88  document.body.appendChild(script5);
     89  script5.onload = function() {
     90    test5.step(function() {
     91      assert_false(included, "credentials excluded (credentialsMode same-origin)");
     92      test5.done();
     93    });
     94  };
     95 
     96  document.body.appendChild(script6);
     97  script6.onload = function() {
     98    test6.step(function() {
     99      assert_true(included, "credentials included (credentialsMode include)");
    100      test6.done();
    101    });
    102  };
    103 
    104  document.body.appendChild(script7);
    105  script7.onload = function() {
    106    test7.step(function() {
    107      assert_true(included, "credentials included (credentialsMode include)");
    108      test7.done();
    109    });
    110  };
    111 
    112  document.body.appendChild(script8);
    113  script8.onload = function() {
    114    test8.step(function() {
    115      assert_false(included, "credentials excluded (credentialsMode same-origin)");
    116      test8.done();
    117    });
    118  };
    119  </script>
    120 </body>