tor-browser

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

007.html (1257B)


      1 <!doctype html>
      2 <!-- this tests the spec as it hopefully will be once bug https://www.w3.org/Bugs/Public/show_bug.cgi?id=17155 is fixed -->
      3 <title>Fragment Navigation: hashchange event multiple changes old/newURL</title>
      4 <meta name=timeout content=long>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <body>
      8 <div id="log"></div>
      9 <script>
     10 var t = async_test();
     11 t.step(function() {
     12  var original_url = location.href;
     13  assert_equals(location.hash, "", "Page must be loaded with no hash");
     14 
     15  var count = 0;
     16 
     17  location.hash = "test";
     18 
     19  hashes = [];
     20 
     21  addEventListener("hashchange",
     22                   t.step_func(function(e) {
     23                     if (count < 100) {
     24                       location.hash = "test" + count++;
     25                       hashes.push(location.hash);
     26                     } else if (count === 100) {
     27                       expected = [];
     28                       for (var i=0; i<100; i++) {
     29                          expected.push("#test" + i);
     30                       }
     31                       assert_array_equals(hashes, expected);
     32                       location.hash = "";
     33                       t.done();
     34                     }
     35                   }), true);
     36 });
     37 </script>