tor-browser

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

browser_bug1719178.js (952B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 "use strict";
      4 SimpleTest.requestFlakyTimeout(
      5  "The test needs to let objects die asynchronously."
      6 );
      7 
      8 add_task(async function test_accessing_shistory() {
      9  let tab = await BrowserTestUtils.openNewForegroundTab(
     10    gBrowser,
     11    "about:preferences"
     12  );
     13  let sh = tab.linkedBrowser.browsingContext.sessionHistory;
     14  ok(sh, "Should have SessionHistory object");
     15  gBrowser.removeTab(tab);
     16  tab = null;
     17  for (let i = 0; i < 5; ++i) {
     18    SpecialPowers.Services.obs.notifyObservers(
     19      null,
     20      "memory-pressure",
     21      "heap-minimize"
     22    );
     23    SpecialPowers.DOMWindowUtils.garbageCollect();
     24    await new Promise(function (r) {
     25      // eslint-disable-next-line mozilla/no-arbitrary-setTimeout
     26      setTimeout(r, 50);
     27    });
     28  }
     29 
     30  try {
     31    sh.reloadCurrentEntry();
     32  } catch (ex) {}
     33  ok(true, "This test shouldn't crash.");
     34 });