mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 21:58:41 +02:00
This is generally pretty straightforward, and rewrites nearly all calls. It skips the ones that it can detect using frame script globals like `sendAsyncMessage`, though. Differential Revision: https://phabricator.services.mozilla.com/D53740 --HG-- extra : moz-landing-system : lando
53 lines
1.4 KiB
JavaScript
53 lines
1.4 KiB
JavaScript
"use strict";
|
|
|
|
const URL = "data:text/html,<title>initial title</title>";
|
|
|
|
add_task(async function() {
|
|
// Create a new tab.
|
|
let tab = BrowserTestUtils.addTab(gBrowser, URL);
|
|
await promiseBrowserLoaded(tab.linkedBrowser);
|
|
|
|
// Remove the tab.
|
|
await promiseRemoveTabAndSessionState(tab);
|
|
|
|
// Check the title.
|
|
let [
|
|
{
|
|
state: { entries },
|
|
},
|
|
] = JSON.parse(ss.getClosedTabData(window));
|
|
is(entries[0].title, "initial title", "correct title");
|
|
});
|
|
|
|
add_task(async function() {
|
|
// Create a new tab.
|
|
let tab = BrowserTestUtils.addTab(gBrowser, URL);
|
|
let browser = tab.linkedBrowser;
|
|
await promiseBrowserLoaded(browser);
|
|
|
|
// Flush to ensure we collected the initial title.
|
|
await TabStateFlusher.flush(browser);
|
|
|
|
// Set a new title.
|
|
await SpecialPowers.spawn(browser, [], async function() {
|
|
return new Promise(resolve => {
|
|
docShell.chromeEventHandler.addEventListener("DOMTitleChanged", function onTitleChanged() {
|
|
docShell.chromeEventHandler.removeEventListener("DOMTitleChanged", onTitleChanged);
|
|
resolve();
|
|
});
|
|
|
|
content.document.title = "new title";
|
|
});
|
|
});
|
|
|
|
// Remove the tab.
|
|
await promiseRemoveTabAndSessionState(tab);
|
|
|
|
// Check the title.
|
|
let [
|
|
{
|
|
state: { entries },
|
|
},
|
|
] = JSON.parse(ss.getClosedTabData(window));
|
|
is(entries[0].title, "new title", "correct title");
|
|
});
|