Bug 418833 - Make browser_toolbox_options.js more resilient to things being added to the document loading queue. r?jryans
Earlier patches in this series add SVG icons for unstyled checkboxes and radio buttons.
This causes us to queue extra loads to documents that have those elements, even when
we're natively styling those input elements by default.
browser_toolbox_options works by loading up the DevTools options iframe, and then
clicking on things to make sure that the right prefs are set. There are checkboxes
in the iframe document, which means the extra loads I referred to happen. When
our presentation subsystems notice that there are extra loads occurring, we do
"paint suppression" to avoid flashes of unstyled content. During paint suppression,
nothing is displayed (painting is suppressed), and so nothing is clickable.
browser_toolbox_options was not waiting for the "load" event before clicking on
items. It got lucky up until the SVGs were added, but this was a race waiting
to happen. I've added a wait for the "load" event, and this test now passes.
MozReview-Commit-ID: EjzvhxhKlDs
--- a/devtools/client/framework/test/browser_toolbox_options.js
+++ b/devtools/client/framework/test/browser_toolbox_options.js
@@ -73,16 +73,25 @@ function* testOptionsShortcut() {
is(toolbox.currentToolId, "webconsole", "webconsole is reselected (2)");
synthesizeKeyShortcut(L10N.getStr("toolbox.help.key"));
is(toolbox.currentToolId, "options", "Toolbox selected via shortcut key (2)");
}
function* testOptions() {
let tool = toolbox.getPanel("options");
panelWin = tool.panelWin;
+
+ // It's possible that the iframe for options hasn't fully loaded yet,
+ // and might be paint-suppressed, which means that clicking things
+ // might not work just yet. The "load" event is a good indication that
+ // we're ready to proceed.
+ if (tool.panelDoc.readyState != "complete") {
+ yield once(tool.panelWin, "load");
+ }
+
let prefNodes = tool.panelDoc.querySelectorAll(
"input[type=checkbox][data-pref]");
// Store modified pref names so that they can be cleared on error.
for (let node of tool.panelDoc.querySelectorAll("[data-pref]")) {
let pref = node.getAttribute("data-pref");
modifiedPrefs.push(pref);
}