Bug 1885602 - Part 2: Add a MozillaAccountMenuButton composable for the menu redesign...
[gecko.git] / dom / xhr / tests / browser_xhr_onchange_leak.js
blob4d13e33ee471280ea850743b624ac766b60c6c4f
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
4  */
6 // Bug 1336811 - An XHR that has a .onreadystatechange waiting should
7 // not leak forever once the tab is closed. CC optimizations need to be
8 // turned off once it is closed.
10 add_task(async function test() {
11   // We need to reuse the content process when we navigate so the entire process
12   // with the possible-leaking window doesn't get torn down.
13   await SpecialPowers.pushPrefEnv({
14     set: [["dom.ipc.keepProcessesAlive.webIsolated.perOrigin", 1]],
15   });
17   const url =
18     "http://mochi.test:8888/browser/dom/xhr/tests/browser_xhr_onchange_leak.html";
19   let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
20   let browser = gBrowser.selectedBrowser;
21   let pageShowPromise = BrowserTestUtils.waitForContentEvent(
22     browser,
23     "pageshow",
24     true
25   );
26   BrowserTestUtils.startLoadingURIString(browser, "http://mochi.test:8888/");
27   await pageShowPromise;
29   ok(pageShowPromise, "need to check something");
30   BrowserTestUtils.removeTab(newTab);
31 });