commit ca33aee18396e3aaebbc341cf2bda29cf038d0ee
parent b6582225b9c8b9ae1446f2f3e0556322f6aac41c
Author: Nicolas Chevobbe <nchevobbe@mozilla.com>
Date: Thu, 23 Oct 2025 12:11:03 +0000
Bug 1995758 - [devtools] Wait for new-configuration-applied when needed in browser_toolbox_options.js. r=devtools-reviewers,ochameau.
Updating some of the options in the settings panel might trigger a target
configuration update, so wait for the "new-configuration-applied" event in such case.
This patch exports BOOLEAN_CONFIGURATION_PREFS so we can use it in the test.
Differential Revision: https://phabricator.services.mozilla.com/D269583
Diffstat:
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/devtools/client/framework/test/browser_toolbox_options.js b/devtools/client/framework/test/browser_toolbox_options.js
@@ -14,6 +14,9 @@ const L10N = new LocalizationHelper(
"devtools/client/locales/toolbox.properties"
);
const { PrefObserver } = require("resource://devtools/client/shared/prefs.js");
+const {
+ BOOLEAN_CONFIGURATION_PREFS,
+} = require("resource://devtools/client/framework/toolbox.js");
add_task(async function () {
const URL =
@@ -216,6 +219,12 @@ async function testMouseClick(node, prefValue) {
});
});
+ const onNewConfigurationApplied = Object.keys(
+ BOOLEAN_CONFIGURATION_PREFS
+ ).includes(pref)
+ ? toolbox.once("new-configuration-applied")
+ : null;
+
node.scrollIntoView();
// We use executeSoon here to ensure that the element is in view and
@@ -228,6 +237,11 @@ async function testMouseClick(node, prefValue) {
await changeSeenPromise;
ok(changeSeen, "Correct pref was changed");
+
+ if (onNewConfigurationApplied) {
+ await onNewConfigurationApplied;
+ ok(true, `Configuration was changed when updating pref "${pref}"`);
+ }
observer.destroy();
}
diff --git a/devtools/client/framework/toolbox.js b/devtools/client/framework/toolbox.js
@@ -248,6 +248,7 @@ const BOOLEAN_CONFIGURATION_PREFS = {
name: "isTracerFeatureEnabled",
},
};
+exports.BOOLEAN_CONFIGURATION_PREFS = BOOLEAN_CONFIGURATION_PREFS;
/**
* A "Toolbox" is the component that holds all the tools for one specific