tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_application_panel_manifest-load.js (2063B)


      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 fetches a manifest when in the Manifest Page
      8 */
      9 
     10 add_task(async function () {
     11  info("Test that manifest page loads the manifest successfully");
     12  const url = URL_ROOT + "resources/manifest/load-ok.html";
     13 
     14  await enableApplicationPanel();
     15  const { panel, tab } = await openNewTabAndApplicationPanel(url);
     16  const doc = panel.panelWin.document;
     17 
     18  selectPage(panel, "manifest");
     19 
     20  info("Waiting for the manifest to load");
     21  await waitUntil(() => doc.querySelector(".js-manifest") !== null);
     22  ok(true, "Manifest loaded successfully");
     23 
     24  // close the tab
     25  info("Closing the tab.");
     26  await BrowserTestUtils.removeTab(tab);
     27 });
     28 
     29 add_task(async function () {
     30  info("Test that manifest page shows an error when failing to load");
     31  const url = URL_ROOT + "resources/manifest/load-fail.html";
     32 
     33  await enableApplicationPanel();
     34  const { panel, tab } = await openNewTabAndApplicationPanel(url);
     35  const doc = panel.panelWin.document;
     36 
     37  selectPage(panel, "manifest");
     38 
     39  info("Waiting for the manifest to fail to load");
     40  await waitUntil(
     41    () => doc.querySelector(".js-manifest-loaded-error") !== null
     42  );
     43  ok(true, "Manifest page displays loading error");
     44 
     45  // close the tab
     46  info("Closing the tab.");
     47  await BrowserTestUtils.removeTab(tab);
     48 });
     49 
     50 add_task(async function () {
     51  info("Test that manifest page shows a message when there is no manifest");
     52  const url = URL_ROOT + "resources/manifest/load-no-manifest.html";
     53 
     54  await enableApplicationPanel();
     55  const { panel, tab } = await openNewTabAndApplicationPanel(url);
     56  const doc = panel.panelWin.document;
     57 
     58  selectPage(panel, "manifest");
     59 
     60  info("Waiting for the 'no manifest' message to appear");
     61  await waitUntil(() => doc.querySelector(".js-manifest-empty") !== null);
     62  ok(true, "Manifest page displays a 'no manifest' message");
     63 
     64  // close the tab
     65  info("Closing the tab.");
     66  await BrowserTestUtils.removeTab(tab);
     67 });