tor-browser

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

speculative-script.tentative.html (1077B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <meta charset="windows-1253">
      5 <title>Speculative script</title>
      6 <script src=/resources/testharness.js></script>
      7 <script src=/resources/testharnessreport.js></script>
      8 <script src=/common/utils.js></script>
      9 <body>
     10 <script>
     11 const uuid = token();
     12 
     13 window.onmessage = function(e) {
     14  // The script is first speculatively loaded in the windows-1253 context (inherited from this doc), so
     15  // the Greek hex NCR turns into a byte. This byte is stored. Then the script is fetched
     16  // non-speculatively, because the Greek hexNCR in the URL makes the URL not match in the
     17  // windows-1251 context. Now the Greek hex NCR turns in to a decimal NCR and the original Greek
     18  // character comes back as a byte that gets a Cyrillic interpretation.
     19  assert_equals(e.data, `token: ${uuid}, character: &#950;, previous character: \u0436, byte: \u0436`, "Check result");
     20  done();
     21 }
     22 
     23 setup({single_test: true});
     24 const iframe = document.createElement('iframe');
     25 iframe.src = `support/speculative-script.py?uuid=${uuid}`;
     26 document.body.appendChild(iframe);
     27 </script>