no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / docshell / test / browser / browser_bug1719178.js
blob6c4fc2d15fa5534606bf7b37ae7beff39836e5de
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 );
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   }
30   try {
31     sh.reloadCurrentEntry();
32   } catch (ex) {}
33   ok(true, "This test shouldn't crash.");
34 });