tor-browser

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

browser_about-devtools-toolbox_load.js (1050B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 /**
      7 * Test that about:devtools-toolbox shows error an page when opened with invalid
      8 * paramters
      9 */
     10 add_task(async function () {
     11  // test that error is shown when missing `type` param
     12  let { document, tab } = await openAboutToolbox({ invalid: "invalid" });
     13  await assertErrorIsShown(document);
     14  await removeTab(tab);
     15  // test that error is shown if `id` is not provided
     16  ({ document, tab } = await openAboutToolbox({ type: "tab" }));
     17  await assertErrorIsShown(document);
     18  await removeTab(tab);
     19  // test that error is shown if `remoteId` refers to an unexisting target
     20  ({ document, tab } = await openAboutToolbox({
     21    type: "tab",
     22    remoteId: "13371337",
     23  }));
     24  await assertErrorIsShown(document);
     25  await removeTab(tab);
     26 
     27  async function assertErrorIsShown(doc) {
     28    await waitUntil(() => doc.querySelector(".qa-error-page"));
     29    ok(doc.querySelector(".qa-error-page"), "Error page is rendered");
     30  }
     31 });