browser_application_panel_manifest-reload.js (1713B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 /** 7 * Check that the application panel refetches the page manifest when reloading 8 * or navigating to a new page 9 */ 10 11 add_task(async function () { 12 await enableApplicationPanel(); 13 14 info("Loading a page with no manifest"); 15 let url = URL_ROOT_SSL + "resources/manifest/load-no-manifest.html"; 16 const { panel, tab } = await openNewTabAndApplicationPanel(url); 17 const doc = panel.panelWin.document; 18 19 selectPage(panel, "manifest"); 20 21 info("Waiting for the 'no manifest' message to appear"); 22 await waitFor(() => doc.querySelector(".js-manifest-empty") !== null); 23 ok(true, "Manifest page displays a 'no manifest' message"); 24 25 info("Navigating to a page with a manifest"); 26 url = URL_ROOT_SSL + "resources/manifest/load-ok.html"; 27 await navigateTo(url); 28 29 info("Waiting for the manifest to show up"); 30 await waitFor(() => doc.querySelector(".js-manifest") !== null); 31 ok(true, "Manifest displayed successfully"); 32 33 info("Navigating to a page with a manifest that fails to load"); 34 url = URL_ROOT_SSL + "resources/manifest/load-fail.html"; 35 await navigateTo(url); 36 37 info("Waiting for the manifest to fail to load"); 38 await waitFor(() => doc.querySelector(".js-manifest-loaded-error") !== null); 39 ok(true, "Manifest page displays loading error"); 40 41 info("Reloading"); 42 await navigateTo(url); 43 44 info("Waiting for the manifest to fail to load"); 45 await waitFor(() => doc.querySelector(".js-manifest-loaded-error") !== null); 46 ok(true, "Manifest page displays loading error"); 47 48 // close the tab 49 info("Closing the tab."); 50 await BrowserTestUtils.removeTab(tab); 51 });