blob: 9bbb1ca76212b180bb6c4d859527576a0a948c18 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
"use strict";
const URL = "data:text/html,<title>initial title</title>";
add_task(function* () {
// Create a new tab.
let tab = gBrowser.addTab(URL);
yield promiseBrowserLoaded(tab.linkedBrowser);
// Remove the tab.
yield promiseRemoveTab(tab);
// Check the title.
let [{state: {entries}}] = JSON.parse(ss.getClosedTabData(window));
is(entries[0].title, "initial title", "correct title");
});
add_task(function* () {
// Create a new tab.
let tab = gBrowser.addTab(URL);
let browser = tab.linkedBrowser;
yield promiseBrowserLoaded(browser);
// Flush to ensure we collected the initial title.
yield TabStateFlusher.flush(browser);
// Set a new title.
yield ContentTask.spawn(browser, null, function* () {
return new Promise(resolve => {
addEventListener("DOMTitleChanged", function onTitleChanged() {
removeEventListener("DOMTitleChanged", onTitleChanged);
resolve();
});
content.document.title = "new title";
});
});
// Remove the tab.
yield promiseRemoveTab(tab);
// Check the title.
let [{state: {entries}}] = JSON.parse(ss.getClosedTabData(window));
is(entries[0].title, "new title", "correct title");
});
|