tor-browser

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

history-state.window.js (1184B)


      1 async_test(t => {
      2  const iframe = document.body.appendChild(document.createElement("iframe"));
      3  t.add_cleanup(() => iframe.remove());
      4  iframe.src = "/common/blank.html";
      5  iframe.onload = t.step_func_done(() => {
      6    const win = iframe.contentWindow;
      7    const doc = iframe.contentDocument;
      8    assert_equals(win.history.state, null);
      9    win.history.replaceState("state", "");
     10    assert_equals(win.history.state, "state");
     11    assert_equals(doc.open(), doc);
     12    assert_equals(win.history.state, "state");
     13  });
     14 }, "history.state is kept by document.open()");
     15 
     16 async_test(t => {
     17  const iframe = document.body.appendChild(document.createElement("iframe"));
     18  t.add_cleanup(() => iframe.remove());
     19  iframe.src = "/common/blank.html";
     20  iframe.onload = t.step_func_done(() => {
     21    const win = iframe.contentWindow;
     22    const doc = iframe.contentDocument;
     23    assert_equals(win.history.state, null);
     24    win.history.replaceState("state", "");
     25    assert_equals(win.history.state, "state");
     26    assert_equals(doc.open("", "replace"), doc);
     27    assert_equals(win.history.state, "state");
     28  });
     29 }, "history.state is kept by document.open() (with historical replace parameter set)");