Skip to content

Instantly share code, notes, and snippets.

@gijsk
Created October 3, 2025 12:07
Show Gist options
  • Select an option

  • Save gijsk/3cfe6960d05a6f07a23b93aa8f52e658 to your computer and use it in GitHub Desktop.

Select an option

Save gijsk/3cfe6960d05a6f07a23b93aa8f52e658 to your computer and use it in GitHub Desktop.
Test changes for fullscreen toolbox hidden
diff --git a/browser/modules/WebAuthnPromptHelper.sys.mjs b/browser/modules/WebAuthnPromptHelper.sys.mjs
index 9548d1752f..6645e213b0 100644
--- a/browser/modules/WebAuthnPromptHelper.sys.mjs
+++ b/browser/modules/WebAuthnPromptHelper.sys.mjs
@@ -35,6 +35,7 @@
observe(aSubject, aTopic, aData) {
switch (aTopic) {
case "fullscreen-nav-toolbox":
+ console.trace("Got fullscreen notification", aData, this._tid);
// Prevent the navigation toolbox from being hidden while a WebAuthn
// prompt is visible.
if (aData == "hidden" && this._tid != 0) {
@@ -381,6 +382,7 @@
// go fullscreen.
Services.obs.addObserver(this, "fullscreen-painted");
+ console.log("Adding observer for fullscreen-nav-toolbox");
// The `fullscreen-nav-toolbox` topic is notified when the nav toolbox is
// hidden.
Services.obs.addObserver(this, "fullscreen-nav-toolbox");
@@ -400,6 +402,7 @@
options.eventCallback = event => {
if (event == "removed") {
Services.obs.removeObserver(this, "fullscreen-painted");
+ console.trace("Removing observer for fullscreen-nav-toolbox");
Services.obs.removeObserver(this, "fullscreen-nav-toolbox");
this._current = null;
this._tid = 0;
diff --git a/dom/webauthn/tests/browser/browser_webauthn_prompts.js b/dom/webauthn/tests/browser/browser_webauthn_prompts.js
index 38288a9f91..f66ec76718 100644
--- a/dom/webauthn/tests/browser/browser_webauthn_prompts.js
+++ b/dom/webauthn/tests/browser/browser_webauthn_prompts.js
@@ -33,7 +33,7 @@
);
}
-add_task(async function test_setup_usbtoken() {
+add_setup(async function test_setup_usbtoken() {
return SpecialPowers.pushPrefEnv({
set: [
["security.webauth.webauthn_enable_softtoken", false],
@@ -41,12 +41,14 @@
],
});
});
-add_task(test_register);
-add_task(test_register_escape);
-add_task(test_sign);
-add_task(test_sign_escape);
-add_task(test_tab_switching);
-add_task(test_window_switching);
+add_task(test_register).skip();
+add_task(test_register_escape).skip();
+add_task(test_sign).skip();
+add_task(test_sign_escape).skip();
+add_task(test_tab_switching).skip();
+add_task(test_window_switching).skip();
+// XXXgijs: this should be add_setup but the ordering with the previous
+// tests may be important... Perhaps this should be split to a separate file?
add_task(async function test_setup_softtoken() {
gAuthenticatorId = add_virtual_authenticator();
return SpecialPowers.pushPrefEnv({
@@ -61,14 +63,15 @@
});
add_task(test_fullscreen_show_nav_toolbar);
add_task(test_no_fullscreen_dom);
-add_task(test_register_direct_with_consent);
-add_task(test_register_direct_without_consent);
-add_task(test_select_sign_result);
+add_task(test_register_direct_with_consent).skip();
+add_task(test_register_direct_without_consent).skip();
+add_task(test_select_sign_result).skip();
function promiseNavToolboxStatus(aExpectedStatus) {
let navToolboxStatus;
return TestUtils.topicObserved("fullscreen-nav-toolbox", (subject, data) => {
navToolboxStatus = data;
+ info("nav toolbox is " + data);
return data == aExpectedStatus;
}).then(() =>
Assert.equal(
@@ -414,6 +417,14 @@
ok(active, "request is active");
ok(window.fullScreen, "window is fullscreen");
+ info("Trying to hide and ensure the toolbox gets reshown.");
+ // Ensure that re-hiding the nav toolbox isn't allowed.
+ navToolboxHiddenPromise = promiseNavToolboxStatus("hidden");
+ navToolboxShownPromise = promiseNavToolboxStatus("shown");
+ FullScreen.hideNavToolbox(false);
+ await navToolboxHiddenPromise;
+ await navToolboxShownPromise;
+
// Proceed through the consent prompt.
PopupNotifications.panel.firstElementChild.secondaryButton.click();
await requestPromise;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment