browser_bug1686194.js (1176B)
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 "use strict"; 6 7 const TEST_PAGE = 8 "http://mochi.test:8888/browser/dom/ipc/tests/file_dummy.html"; 9 10 function untilPageTitleChanged() { 11 return new Promise(resolve => 12 gBrowser.addEventListener("pagetitlechanged", resolve, { once: true }) 13 ); 14 } 15 16 add_task(async () => { 17 const tab = await BrowserTestUtils.openNewForegroundTab({ 18 gBrowser, 19 opening: TEST_PAGE, 20 }); 21 22 const { linkedBrowser } = tab; 23 ok( 24 tab.getAttribute("label").includes("file_dummy.html"), 25 "The title should be the raw path" 26 ); 27 28 await Promise.all([ 29 SpecialPowers.spawn(linkedBrowser, [], function () { 30 content.document.title = "Title"; 31 }), 32 untilPageTitleChanged(), 33 ]); 34 35 is(tab.getAttribute("label"), "Title", "The title should change"); 36 37 linkedBrowser.reload(); 38 39 await untilPageTitleChanged(); 40 41 ok( 42 tab.getAttribute("label").includes("file_dummy.html"), 43 "The title should be the raw path again" 44 ); 45 46 BrowserTestUtils.removeTab(tab); 47 });