Bug 1894709 - [devtools] Fix browser_rules_pseudo-element_01.js intermittent. r=devtools-reviewers,jdescottes.

Differential Revision: https://phabricator.services.mozilla.com/D209556
This commit is contained in:
Nicolas Chevobbe 2024-05-06 14:52:59 +00:00
Родитель 8356aa55c5
Коммит cd1be97ffd
1 изменённых файлов: 21 добавлений и 25 удалений

Просмотреть файл

@ -26,10 +26,11 @@ add_task(async function () {
await testParagraph(inspector, view); await testParagraph(inspector, view);
await testBody(inspector, view); await testBody(inspector, view);
await testList(inspector, view); await testList(inspector, view);
await testBackdrop(inspector, view);
await testCustomHighlight(inspector, view); await testCustomHighlight(inspector, view);
await testSlider(inspector, view); await testSlider(inspector, view);
await testUrlFragmentTextDirective(inspector, view); await testUrlFragmentTextDirective(inspector, view);
// keep this one last as it makes the browser go fullscreen and seem to impact other tests
await testBackdrop(inspector, view);
}); });
async function testTopLeft(inspector, view) { async function testTopLeft(inspector, view) {
@ -325,23 +326,20 @@ async function testBackdrop(inspector, view) {
gBrowser.selectedBrowser.focus(); gBrowser.selectedBrowser.focus();
await onTabFocused; await onTabFocused;
const onFullscreen = new Promise(resolve => {
BrowserTestUtils.addContentEventListener(
gBrowser.selectedBrowser,
"fullscreenchange",
resolve,
{ once: true }
);
});
info("Request fullscreen"); info("Request fullscreen");
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => { // Entering fullscreen is triggering an update, wait for it so it doesn't impact
// the rest of the test
let onInspectorUpdated = view.once("ruleview-refreshed");
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async () => {
const canvas = content.document.querySelector("canvas"); const canvas = content.document.querySelector("canvas");
canvas.requestFullscreen(); canvas.requestFullscreen();
});
await onFullscreen; await ContentTaskUtils.waitForCondition(
ok(true, "canvas is fullscreen"); () => content.document.fullscreenElement === canvas,
"canvas is fullscreen"
);
});
await onInspectorUpdated;
await assertPseudoElementRulesNumbers("canvas", inspector, view, { await assertPseudoElementRulesNumbers("canvas", inspector, view, {
elementRulesNb: 3, elementRulesNb: 3,
@ -350,19 +348,17 @@ async function testBackdrop(inspector, view) {
assertGutters(view); assertGutters(view);
info("Exit fullscreen"); // Exiting fullscreen is triggering an update, wait for it so it doesn't impact
const onFullscreenExit = new Promise(resolve => { // the rest of the test
BrowserTestUtils.addContentEventListener( onInspectorUpdated = view.once("ruleview-refreshed");
gBrowser.selectedBrowser, await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async () => {
"fullscreenchange", content.document.exitFullscreen();
resolve, await ContentTaskUtils.waitForCondition(
{ once: true } () => content.document.fullscreenElement === null,
"canvas is no longer fullscreen"
); );
}); });
SpecialPowers.spawn(gBrowser.selectedBrowser, [], async () => { await onInspectorUpdated;
content.document.exitFullscreen();
});
await onFullscreenExit;
info( info(
"Test ::backdrop rules are not displayed when elements are not fullscreen" "Test ::backdrop rules are not displayed when elements are not fullscreen"