browser_multiple_navigateAndRestore.js (1528B)
1 "use strict"; 2 3 const PAGE_1 = 4 "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20page."; 5 const PAGE_2 = 6 "data:text/html,<html><body>Another%20regular,%20everyday,%20normal%20page."; 7 8 add_task(async function () { 9 // Load an empty, non-remote tab at about:blank... 10 let tab = BrowserTestUtils.addTab(gBrowser, "about:blank", { 11 forceNotRemote: true, 12 }); 13 gBrowser.selectedTab = tab; 14 let browser = gBrowser.selectedBrowser; 15 ok(!browser.isRemoteBrowser, "Ensure browser is not remote"); 16 // Load a remote page, and then another remote page immediately 17 // after. 18 BrowserTestUtils.startLoadingURIString(browser, PAGE_1); 19 browser.stop(); 20 BrowserTestUtils.startLoadingURIString(browser, PAGE_2); 21 await BrowserTestUtils.browserLoaded(browser, false, PAGE_2); 22 23 ok(browser.isRemoteBrowser, "Should have switched remoteness"); 24 await TabStateFlusher.flush(browser); 25 let state = JSON.parse(ss.getTabState(tab)); 26 let entries = state.entries; 27 is(entries.length, 1, "There should only be one entry"); 28 is(entries[0].url, PAGE_2, "Should have PAGE_2 as the sole history entry"); 29 is( 30 browser.currentURI.spec, 31 PAGE_2, 32 "Should have PAGE_2 as the browser currentURI" 33 ); 34 35 await SpecialPowers.spawn(browser, [PAGE_2], async function (expectedURL) { 36 docShell.QueryInterface(Ci.nsIWebNavigation); 37 Assert.equal( 38 docShell.currentURI.spec, 39 expectedURL, 40 "Content should have PAGE_2 as the browser currentURI" 41 ); 42 }); 43 44 BrowserTestUtils.removeTab(tab); 45 });