summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/about/browser_aboutNewTab_bookmarksToolbarNewWindow.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /browser/base/content/test/about/browser_aboutNewTab_bookmarksToolbarNewWindow.js
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/base/content/test/about/browser_aboutNewTab_bookmarksToolbarNewWindow.js')
-rw-r--r--browser/base/content/test/about/browser_aboutNewTab_bookmarksToolbarNewWindow.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/browser/base/content/test/about/browser_aboutNewTab_bookmarksToolbarNewWindow.js b/browser/base/content/test/about/browser_aboutNewTab_bookmarksToolbarNewWindow.js
new file mode 100644
index 0000000000..db75376aac
--- /dev/null
+++ b/browser/base/content/test/about/browser_aboutNewTab_bookmarksToolbarNewWindow.js
@@ -0,0 +1,57 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+add_task(async function bookmarks_toolbar_shown_on_newtab() {
+ let url =
+ getRootDirectory(gTestPath).replace(
+ "chrome://mochitests/content",
+ "https://example.com"
+ ) + "slow_loading_page.sjs";
+ for (let featureEnabled of [true, false]) {
+ for (let newTabEnabled of [true, false]) {
+ info(
+ `Testing with the feature ${
+ featureEnabled ? "enabled" : "disabled"
+ } and newtab ${newTabEnabled ? "enabled" : "disabled"}`
+ );
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["browser.toolbars.bookmarks.2h2020", featureEnabled],
+ ["browser.newtabpage.enabled", newTabEnabled],
+ ],
+ });
+
+ let newWindowOpened = BrowserTestUtils.domWindowOpened();
+ let triggeringPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
+ openUILinkIn(url, "window", { triggeringPrincipal });
+
+ let newWin = await newWindowOpened;
+
+ let exitConditions = {
+ visible: true,
+ };
+ let slowSiteLoaded = BrowserTestUtils.firstBrowserLoaded(newWin, false);
+ slowSiteLoaded.then(result => {
+ exitConditions.earlyExit = result;
+ });
+
+ let result = await waitForBookmarksToolbarVisibilityWithExitConditions({
+ win: newWin,
+ exitConditions,
+ message: "Toolbar should not become visible when loading slow site",
+ });
+
+ // The visibility promise will resolve to a Boolean whereas the browser
+ // load promise will resolve to an Event object.
+ ok(
+ typeof result != "boolean",
+ "The bookmarks toolbar should not become visible before the site is loaded"
+ );
+ ok(!isBookmarksToolbarVisible(newWin), "Toolbar hidden on slow site");
+
+ await BrowserTestUtils.closeWindow(newWin);
+ }
+ }
+});