diff --git a/devtools/client/aboutdebugging/test/browser_service_workers_start.js b/devtools/client/aboutdebugging/test/browser_service_workers_start.js index 7dbe571e15bc..0bb9f052dcf3 100644 --- a/devtools/client/aboutdebugging/test/browser_service_workers_start.js +++ b/devtools/client/aboutdebugging/test/browser_service_workers_start.js @@ -55,12 +55,18 @@ add_task(function* () { ok(name, "Found the service worker in the list"); let targetElement = name.parentNode.parentNode; - // Check that there is a Debug button but not a Start button. - ok(targetElement.querySelector(".debug-button"), "Found its debug button"); - ok(!targetElement.querySelector(".start-button"), "No start button"); + // The service worker may already be killed with the low 1s timeout + if (!targetElement.querySelector(".start-button")) { + // Check that there is a Debug button but not a Start button. + ok(targetElement.querySelector(".debug-button"), "Found its debug button"); - // Wait for the service worker to be killed due to inactivity. - yield waitForMutation(targetElement, { childList: true }); + // Wait for the service worker to be killed due to inactivity. + yield waitForMutation(targetElement, { childList: true }); + } else { + // Check that there is no Debug button when the SW is already shut down. + ok(!targetElement.querySelector(".debug-button"), "No debug button when " + + "the worker is already killed"); + } // We should now have a Start button but no Debug button. let startBtn = targetElement.querySelector(".start-button");