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/. */
8 "http://mochi.test:8888/browser/dom/ipc/tests/file_dummy.html";
10 function untilPageTitleChanged() {
11 return new Promise(resolve =>
12 gBrowser.addEventListener("pagetitlechanged", resolve, { once: true })
16 add_task(async () => {
17 const tab = await BrowserTestUtils.openNewForegroundTab({
22 const { linkedBrowser } = tab;
24 tab.getAttribute("label").includes("file_dummy.html"),
25 "The title should be the raw path"
29 SpecialPowers.spawn(linkedBrowser, [], function () {
30 content.document.title = "Title";
32 untilPageTitleChanged(),
35 is(tab.getAttribute("label"), "Title", "The title should change");
37 linkedBrowser.reload();
39 await untilPageTitleChanged();
42 tab.getAttribute("label").includes("file_dummy.html"),
43 "The title should be the raw path again"
46 BrowserTestUtils.removeTab(tab);