forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1753608 - Fix Session Restore fails to restore some features. r=Gijs
* I overlooked that some `window.open` feature names are different from barprop names. * Adding "resizable" will regress the maximize button prblem. But it was broken even before bug 1564738 and fixing it requires changes to session data. The current session data do not contain enough information to restore the maximize button state correctly. I'll file a follow-up bug about this. * I renamed the test file because it is no longer limited to tab visibility. Differential Revision: https://phabricator.services.mozilla.com/D137838
- Loading branch information
Showing
5 changed files
with
83 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 0 additions & 49 deletions
49
browser/base/content/test/tabs/browser_tabbar_visibility.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
browser/components/sessionstore/test/browser_restored_window_features.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
* http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
"use strict"; | ||
|
||
function testFeatures(win, barprops) { | ||
for (let [name, visible] of Object.entries(barprops)) { | ||
is( | ||
win[name].visible, | ||
visible, | ||
name + " should be " + (visible ? "visible" : "hidden") | ||
); | ||
} | ||
is(win.toolbar.visible, false, "toolbar should be hidden"); | ||
let toolbar = win.document.getElementById("TabsToolbar"); | ||
is(toolbar.collapsed, true, "tabbar should be collapsed"); | ||
let chromeFlags = win.docShell.treeOwner | ||
.QueryInterface(Ci.nsIInterfaceRequestor) | ||
.getInterface(Ci.nsIAppWindow).chromeFlags; | ||
is( | ||
chromeFlags & Ci.nsIWebBrowserChrome.CHROME_WINDOW_RESIZE, | ||
Ci.nsIWebBrowserChrome.CHROME_WINDOW_RESIZE, | ||
"window should be resizable" | ||
); | ||
} | ||
|
||
add_task(async function testRestoredWindowFeatures() { | ||
const DUMMY_PAGE = "browser/base/content/test/tabs/dummy_page.html"; | ||
const TESTS = [ | ||
{ | ||
url: "http://example.com/browser/" + DUMMY_PAGE, | ||
features: "menubar=0,resizable", | ||
barprops: { menubar: false }, | ||
}, | ||
{ | ||
url: "data:,", // title should be empty | ||
features: "location,resizable", | ||
barprops: { locationbar: true }, | ||
}, | ||
]; | ||
const TEST_URL_CHROME = "chrome://mochitests/content/browser/" + DUMMY_PAGE; | ||
|
||
for (let test of TESTS) { | ||
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, TEST_URL_CHROME); | ||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser); | ||
|
||
let newWindowPromise = BrowserTestUtils.waitForNewWindow({ | ||
url: test.url, | ||
}); | ||
await SpecialPowers.spawn(gBrowser.selectedBrowser, [test], t => { | ||
content.eval(`window.open("${t.url}", "_blank", "${t.features}")`); | ||
}); | ||
let win = await newWindowPromise; | ||
let title = win.document.title; | ||
|
||
testFeatures(win, test.barprops); | ||
|
||
await BrowserTestUtils.closeWindow(win); | ||
|
||
newWindowPromise = BrowserTestUtils.waitForNewWindow({ | ||
url: test.url, | ||
}); | ||
SessionStore.undoCloseWindow(0); | ||
win = await newWindowPromise; | ||
|
||
is(title, win.document.title, "title should be preserved"); | ||
testFeatures(win, test.barprops); | ||
|
||
await BrowserTestUtils.closeWindow(win); | ||
} | ||
}); |