tor-browser

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

006.html (1329B)


      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 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <body>
      7 <div id="log"></div>
      8 <script>
      9 var t = async_test();
     10 t.step(function() {
     11  var original_url = location.href;
     12  assert_equals(location.hash, "", "Page must be loaded with no hash");
     13  location.hash = "test";
     14 
     15  var count = 0;
     16  var mid_url = location.href;
     17 
     18  addEventListener("hashchange",
     19                   t.step_func(function(e) {
     20                     if (count === 0) {
     21                       assert_equals(e.oldURL, original_url, "oldURL property first update");
     22                       assert_equals(e.newURL, mid_url, "newURL property first update");
     23                       count = 1;
     24                     } else if (count === 1) {
     25                       assert_equals(e.oldURL, mid_url, "oldURL property second update");
     26                       assert_equals(e.newURL, location.href, "newURL property second update");
     27                       location.hash = "";
     28                       t.done();
     29                     }
     30                   }), true);
     31 
     32  location.hash = "test1";
     33 });
     34 </script>