browser_application_panel_unregister-worker.js (1264B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 const TAB_URL = URL_ROOT + "resources/service-workers/simple.html"; 7 8 add_task(async function () { 9 await enableApplicationPanel(); 10 11 const { panel, tab, commands } = await openNewTabAndApplicationPanel(TAB_URL); 12 const doc = panel.panelWin.document; 13 14 selectPage(panel, "service-workers"); 15 16 info("Wait until the service worker appears in the application panel"); 17 await waitUntil(() => getWorkerContainers(doc).length === 1); 18 19 const workerContainer = getWorkerContainers(doc)[0]; 20 21 info("Wait until the unregister button is displayed for the service worker"); 22 await waitUntil(() => workerContainer.querySelector(".js-unregister-button")); 23 info("Click the unregister button"); 24 const button = workerContainer.querySelector(".js-unregister-button"); 25 button.click(); 26 info("Wait until the service worker is removed from the application panel"); 27 await waitUntil(() => getWorkerContainers(doc).length === 0); 28 ok(true, "Service worker list is empty"); 29 30 // just in case cleanup 31 await unregisterAllWorkers(commands.client, doc); 32 33 // close the tab 34 info("Closing the tab."); 35 await BrowserTestUtils.removeTab(tab); 36 });