Bug 1254746 - Fix browser_service_workers_start.js intermittent when the worker is killed sooner than expected. r=jryans

This commit is contained in:
Alexandre Poirot 2016-05-30 03:06:21 -07:00
parent 3212a68758
commit 4bc9677f7d

View File

@ -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");