tor-browser

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

hash-empty-string.html (1189B)


      1 <!doctype html>
      2 <meta charset="utf8">
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <link rel="help"
      6      href="https://html.spec.whatwg.org/multipage/nav-history-apis.html#the-location-interface:concept-url-fragment-4">
      7 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1544428">
      8 <link rel="author" title="Zach Hoffman" href="mailto:zach@zrhoffman.net">
      9 <script>
     10 let popstateTriggered = false;
     11 window.addEventListener("popstate", () => popstateTriggered = true);
     12 
     13 let hashchangeTriggered = false;
     14 window.addEventListener("hashchange", () => hashchangeTriggered = true);
     15 
     16 test(() => {
     17  assert_equals(location.href.indexOf("#"), -1)
     18 }, "URL has no hash")
     19 
     20 location.hash = "";
     21 
     22 test(() => {
     23  assert_false(popstateTriggered);
     24 }, "changing the hash from an empty string to an empty string does not trigger a popstate event")
     25 
     26 promise_test(async () => {
     27  // hashchange is fired async
     28  await new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r)));
     29  assert_false(hashchangeTriggered);
     30 }, "changing the hash from an empty string to an empty string does not trigger a hashchange event")
     31 </script>