no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / dom / ipc / tests / browser_bug1686194.js
blobf6acefa2f2265c9a23e13fb43a39c9afac4f5892
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/. */
5 "use strict";
7 const TEST_PAGE =
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 })
13   );
16 add_task(async () => {
17   const tab = await BrowserTestUtils.openNewForegroundTab({
18     gBrowser,
19     opening: TEST_PAGE,
20   });
22   const { linkedBrowser } = tab;
23   ok(
24     tab.getAttribute("label").includes("file_dummy.html"),
25     "The title should be the raw path"
26   );
28   await Promise.all([
29     SpecialPowers.spawn(linkedBrowser, [], function () {
30       content.document.title = "Title";
31     }),
32     untilPageTitleChanged(),
33   ]);
35   is(tab.getAttribute("label"), "Title", "The title should change");
37   linkedBrowser.reload();
39   await untilPageTitleChanged();
41   ok(
42     tab.getAttribute("label").includes("file_dummy.html"),
43     "The title should be the raw path again"
44   );
46   BrowserTestUtils.removeTab(tab);
47 });