summaryrefslogtreecommitdiffstats
path: root/browser/base
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 02:40:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 02:40:49 +0000
commit911baf9ac34facefd36ec67e32030b9427e76bcb (patch)
tree239b696af83e6dea7b1829262aaa0eb685718927 /browser/base
parentAdding debian version 115.9.1esr-1. (diff)
downloadfirefox-esr-911baf9ac34facefd36ec67e32030b9427e76bcb.tar.xz
firefox-esr-911baf9ac34facefd36ec67e32030b9427e76bcb.zip
Merging upstream version 115.10.0esr.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/base')
-rw-r--r--browser/base/content/test/fullscreen/browser.ini1
-rw-r--r--browser/base/content/test/popupNotifications/browser.ini1
-rw-r--r--browser/base/content/test/popupNotifications/browser_popupNotification_security_delay.js165
3 files changed, 167 insertions, 0 deletions
diff --git a/browser/base/content/test/fullscreen/browser.ini b/browser/base/content/test/fullscreen/browser.ini
index 8eecb3f99c..7a63da02f4 100644
--- a/browser/base/content/test/fullscreen/browser.ini
+++ b/browser/base/content/test/fullscreen/browser.ini
@@ -21,6 +21,7 @@ skip-if = (os == 'linux') || (os == 'win') # Bug 1818795 and Bug 1818796
[browser_fullscreen_newtab.js]
[browser_fullscreen_newwindow.js]
[browser_fullscreen_permissions_prompt.js]
+skip-if = (os == "win" && os_version == "6.1") # Bug 1887280
[browser_fullscreen_warning.js]
support-files = fullscreen.html
skip-if =
diff --git a/browser/base/content/test/popupNotifications/browser.ini b/browser/base/content/test/popupNotifications/browser.ini
index a5a8ab4eb9..4bc43a47e9 100644
--- a/browser/base/content/test/popupNotifications/browser.ini
+++ b/browser/base/content/test/popupNotifications/browser.ini
@@ -32,6 +32,7 @@ skip-if = (os == "linux" && (debug || asan))
https_first_disabled = true
skip-if = (os == "linux" && (debug || asan))
[browser_popupNotification_security_delay.js]
+skip-if = (os == "win" && os_version == "6.1") # Bug 1887279
[browser_popupNotification_selection_required.js]
skip-if = (os == "linux" && (debug || asan))
[browser_reshow_in_background.js]
diff --git a/browser/base/content/test/popupNotifications/browser_popupNotification_security_delay.js b/browser/base/content/test/popupNotifications/browser_popupNotification_security_delay.js
index 600456640b..7797e93cd5 100644
--- a/browser/base/content/test/popupNotifications/browser_popupNotification_security_delay.js
+++ b/browser/base/content/test/popupNotifications/browser_popupNotification_security_delay.js
@@ -5,6 +5,8 @@
const TEST_SECURITY_DELAY = 5000;
+SimpleTest.requestCompleteLog();
+
/**
* Shows a test PopupNotification.
*/
@@ -395,3 +397,166 @@ add_task(async function test_notificationWindowMove() {
// Reset window position
window.moveTo(screenX, screenY);
});
+
+/**
+ * Tests that the security delay gets extended if a notification is shown during
+ * a full screen transition.
+ */
+add_task(async function test_notificationDuringFullScreenTransition() {
+ // Log full screen transition messages.
+ let loggingObserver = {
+ observe(subject, topic) {
+ info("Observed topic: " + topic);
+ },
+ };
+ Services.obs.addObserver(loggingObserver, "fullscreen-transition-start");
+ Services.obs.addObserver(loggingObserver, "fullscreen-transition-end");
+ // Unregister observers when the test ends:
+ registerCleanupFunction(() => {
+ Services.obs.removeObserver(loggingObserver, "fullscreen-transition-start");
+ Services.obs.removeObserver(loggingObserver, "fullscreen-transition-end");
+ });
+
+ if (Services.appinfo.OS == "Linux") {
+ ok(
+ "Skipping test on Linux because of disabled full screen transition in CI."
+ );
+ return;
+ }
+ // Bug 1882527: Intermittent failures on macOS.
+ if (Services.appinfo.OS == "Darwin") {
+ ok("Skipping test on macOS because of intermittent failures.");
+ return;
+ }
+
+ await BrowserTestUtils.withNewTab("https://example.com", async browser => {
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ // Set a short security delay so we can observe it being extended.
+ ["security.notification_enable_delay", 1],
+ // Set a longer full screen exit transition so the test works on slow builds.
+ ["full-screen-api.transition-duration.leave", "1000 1000"],
+ // Waive the user activation requirement for full screen requests.
+ // The PoC this test is based on relies on spam clicking which grants
+ // user activation in the popup that requests full screen.
+ // This isn't reliable in automation.
+ ["full-screen-api.allow-trusted-requests-only", false],
+ // macOS native full screen is not affected by the full screen
+ // transition overlap. Test with the old full screen implementation.
+ ["full-screen-api.macos-native-full-screen", false],
+ ],
+ });
+
+ await ensureSecurityDelayReady();
+
+ ok(
+ !PopupNotifications.isPanelOpen,
+ "PopupNotification panel should not be open initially."
+ );
+
+ info("Open a notification.");
+ let popupShownPromise = waitForNotificationPanel();
+ showNotification();
+ await popupShownPromise;
+ ok(
+ PopupNotifications.isPanelOpen,
+ "PopupNotification should be open after show call."
+ );
+
+ let notification = PopupNotifications.getNotification("foo", browser);
+ is(notification?.id, "foo", "There should be a notification with id foo");
+
+ info(
+ "Open a new tab via window.open, enter full screen and remove the tab."
+ );
+
+ // There are two transitions, one for full screen entry and one for full screen exit.
+ let transitionStartCount = 0;
+ let transitionEndCount = 0;
+ let promiseFullScreenTransitionStart = TestUtils.topicObserved(
+ "fullscreen-transition-start",
+ () => {
+ transitionStartCount++;
+ return transitionStartCount == 2;
+ }
+ );
+ let promiseFullScreenTransitionEnd = TestUtils.topicObserved(
+ "fullscreen-transition-end",
+ () => {
+ transitionEndCount++;
+ return transitionEndCount == 2;
+ }
+ );
+ let notificationShownPromise = waitForNotificationPanel();
+
+ await SpecialPowers.spawn(browser, [], () => {
+ // Use eval to execute in the privilege context of the website.
+ content.eval(`
+ let button = document.createElement("button");
+ button.id = "triggerBtn";
+ button.innerText = "Open Popup";
+ button.addEventListener("click", () => {
+ let popup = window.open("about:blank");
+ popup.document.write(
+ "<script>setTimeout(() => document.documentElement.requestFullscreen(), 500)</script>"
+ );
+ popup.document.write(
+ "<script>setTimeout(() => window.close(), 1500)</script>"
+ );
+ });
+ // Insert button at the top so the synthesized click works. Otherwise
+ // the button may be outside of the viewport.
+ document.body.prepend(button);
+ `);
+ });
+
+ let timeClick = performance.now();
+ await BrowserTestUtils.synthesizeMouseAtCenter("#triggerBtn", {}, browser);
+
+ info("Wait for the exit transition to start. It's the second transition.");
+ await promiseFullScreenTransitionStart;
+ info("Full screen transition start");
+ ok(true, "Full screen transition started");
+ ok(
+ window.isInFullScreenTransition,
+ "Full screen transition is still running."
+ );
+
+ info(
+ "Wait for notification to re-show on tab switch, after the popup has been closed"
+ );
+ await notificationShownPromise;
+ ok(
+ window.isInFullScreenTransition,
+ "Full screen transition is still running."
+ );
+ info(
+ "about to trigger notification. time between btn click and notification show: " +
+ (performance.now() - timeClick)
+ );
+
+ info(
+ "Trigger main action via button click during the extended security delay."
+ );
+ triggerMainCommand(PopupNotifications.panel);
+
+ await new Promise(resolve => setTimeout(resolve, 0));
+
+ ok(
+ PopupNotifications.isPanelOpen,
+ "PopupNotification should still be open."
+ );
+ notification = PopupNotifications.getNotification(
+ "foo",
+ gBrowser.selectedBrowser
+ );
+ ok(
+ notification,
+ "Notification should still be open because we clicked during the security delay."
+ );
+
+ info("Wait for full screen transition end.");
+ await promiseFullScreenTransitionEnd;
+ info("Full screen transition end");
+ });
+});