browser_bug1309900_crossProcessHistoryNavigation.js (1743B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 add_task(async function runTests() { 8 await SpecialPowers.pushPrefEnv({ 9 set: [["browser.navigation.requireUserInteraction", false]], 10 }); 11 let tab = await BrowserTestUtils.openNewForegroundTab( 12 gBrowser, 13 "about:about" 14 ); 15 16 registerCleanupFunction(function () { 17 gBrowser.removeTab(tab); 18 }); 19 20 let browser = tab.linkedBrowser; 21 22 let loaded = BrowserTestUtils.browserLoaded(browser); 23 BrowserTestUtils.startLoadingURIString(browser, "about:config"); 24 let href = await loaded; 25 is(href, "about:config", "Check about:config loaded"); 26 27 // Using a dummy onunload listener to disable the bfcache as that can prevent 28 // the test browser load detection mechanism from working. 29 loaded = BrowserTestUtils.browserLoaded(browser); 30 BrowserTestUtils.startLoadingURIString( 31 browser, 32 "data:text/html,<body%20onunload=''><iframe></iframe></body>" 33 ); 34 href = await loaded; 35 is( 36 href, 37 "data:text/html,<body%20onunload=''><iframe></iframe></body>", 38 "Check data URL loaded" 39 ); 40 41 loaded = BrowserTestUtils.browserLoaded(browser); 42 browser.goBack(); 43 href = await loaded; 44 is(href, "about:config", "Check we've gone back to about:config"); 45 46 loaded = BrowserTestUtils.browserLoaded(browser); 47 browser.goForward(); 48 href = await loaded; 49 is( 50 href, 51 "data:text/html,<body%20onunload=''><iframe></iframe></body>", 52 "Check we've gone forward to data URL" 53 ); 54 });