tor-browser

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

008.html (1618B)


      1 <!doctype html>
      2 <html>
      3 
      4 <!-- configure this test below to point to the script -->
      5 
      6  <head>
      7    <title>history.pushState/replaceState resolving</title>
      8    <script type="text/javascript" src="/resources/testharness.js"></script>
      9    <script type="text/javascript" src="/resources/testharnessreport.js"></script>
     10  </head>
     11  <body>
     12 
     13    <p></p>
     14    <noscript><p>Enable JavaScript and reload</p></noscript>
     15    <div id="log"></div>
     16    <script type="text/javascript">
     17 
     18 /*
     19 Location of the script (which must be hosted on a separate domain from this test) containing the test code:
     20 var beforehref = location.href;
     21 test(function () {
     22  history.pushState('','','/testing_ignore_me_404');
     23  assert_equals(location.href,beforehref.replace(/^(\w*:\/\/[^\/]*\/)[\w\W]*$/,'$1testing_ignore_me_404'));
     24 }, 'history.pushState URL resolving should be done relative to the document, not the script');
     25 test(function () {
     26  history.replaceState('','','/testing_ignore_me_404_2');
     27  assert_equals(location.href,beforehref.replace(/^(\w*:\/\/[^\/]*\/)[\w\W]*$/,'$1testing_ignore_me_404_2'));
     28 }, 'history.replaceState URL resolving should be done relative to the document, not the script');
     29 */
     30 var scriptlocation = 'http://www.' + location.host + location.pathname.split("/").slice(0,-1).join("/") + "/008.js";
     31 
     32 if( location.protocol == 'file:' ) {
     33  document.getElementsByTagName('p')[0].innerHTML = 'ERROR: This test cannot be run from file: (URL resolving will not work). It must be loaded over HTTP.';
     34 } else {
     35  document.write('<script type="text\/javascript" src="'+scriptlocation+'"><\/script>');
     36 }
     37    </script>
     38 
     39  </body>
     40 </html>