browser_xhr_onchange_leak.js (1208B)
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 */ 5 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. 9 10 add_task(async function test() { 11 const url = 12 "http://mochi.test:8888/browser/dom/xhr/tests/browser_xhr_onchange_leak.html"; 13 let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url); 14 let browser = gBrowser.selectedBrowser; 15 let origContentProcessId = browser.frameLoader.remoteTab.contentProcessId; 16 let pageShowPromise = BrowserTestUtils.waitForContentEvent( 17 browser, 18 "pageshow", 19 true 20 ); 21 BrowserTestUtils.startLoadingURIString(browser, "http://mochi.test:8888/"); 22 await pageShowPromise; 23 24 is( 25 browser.frameLoader.remoteTab.contentProcessId, 26 origContentProcessId, 27 "we must still be in the same process after we navigate " + 28 "so the entire process with the possibly-leaking window " + 29 "doesn't get torn down" 30 ); 31 32 BrowserTestUtils.removeTab(newTab); 33 });