mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1160556 - Recollect session history data when the page title changes r=Gijs
This commit is contained in:
parent
0604dd048f
commit
f2eaecef00
@ -265,6 +265,9 @@ let SessionHistoryListener = {
|
||||
if (!SessionHistory.isEmpty(docShell)) {
|
||||
this.collect();
|
||||
}
|
||||
|
||||
// Listen for page title changes.
|
||||
addEventListener("DOMTitleChanged", this);
|
||||
},
|
||||
|
||||
uninit: function () {
|
||||
@ -280,6 +283,10 @@ let SessionHistoryListener = {
|
||||
}
|
||||
},
|
||||
|
||||
handleEvent(event) {
|
||||
this.collect();
|
||||
},
|
||||
|
||||
onFrameTreeCollected: function () {
|
||||
this.collect();
|
||||
},
|
||||
|
@ -88,6 +88,7 @@ skip-if = buildapp == 'mulet'
|
||||
[browser_history_persist.js]
|
||||
[browser_label_and_icon.js]
|
||||
[browser_merge_closed_tabs.js]
|
||||
[browser_page_title.js]
|
||||
[browser_pageStyle.js]
|
||||
[browser_privatetabs.js]
|
||||
[browser_replace_load.js]
|
||||
|
38
browser/components/sessionstore/test/browser_page_title.js
Normal file
38
browser/components/sessionstore/test/browser_page_title.js
Normal file
@ -0,0 +1,38 @@
|
||||
"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.
|
||||
TabState.flush(browser);
|
||||
|
||||
// Set a new title.
|
||||
yield ContentTask.spawn(browser, null, function* () {
|
||||
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");
|
||||
});
|
@ -528,6 +528,8 @@ for (let name of FORM_HELPERS) {
|
||||
this[name] = (browser, data) => sendMessage(browser, msg, data);
|
||||
}
|
||||
|
||||
// Removes the given tab immediately and returns a promise that resolves when
|
||||
// all pending status updates (messages) of the closing tab have been received.
|
||||
function promiseRemoveTab(tab) {
|
||||
return BrowserTestUtils.removeTab(tab);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user