tor-browser

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

browser_storage_indexeddb_delete.js (1562B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 // Test deleting indexedDB database from the tree using context menu
      8 
      9 add_task(async function () {
     10  await openTabAndSetupStorage(
     11    MAIN_DOMAIN_SECURED + "storage-empty-objectstores.html"
     12  );
     13 
     14  const contextMenu =
     15    gPanelWindow.document.getElementById("storage-tree-popup");
     16  const menuDeleteDb = contextMenu.querySelector("#storage-tree-popup-delete");
     17 
     18  info("test state before delete");
     19  await checkState([
     20    [
     21      ["indexedDB", "https://test1.example.org"],
     22      ["idb1 (default)", "idb2 (default)"],
     23    ],
     24  ]);
     25 
     26  info("do the delete");
     27  const deletedDb = [
     28    "indexedDB",
     29    "https://test1.example.org",
     30    "idb1 (default)",
     31  ];
     32 
     33  await selectTreeItem(deletedDb);
     34 
     35  // Wait once for update and another time for value fetching
     36  const eventWait = gUI.once("store-objects-updated");
     37 
     38  const selector = `[data-id='${JSON.stringify(
     39    deletedDb
     40  )}'] > .tree-widget-item`;
     41  const target = gPanelWindow.document.querySelector(selector);
     42  ok(target, `tree item found in ${deletedDb.join(" > ")}`);
     43  await waitForContextMenu(contextMenu, target, () => {
     44    info(`Opened tree context menu in ${deletedDb.join(" > ")}`);
     45    menuDeleteDb.click();
     46  });
     47 
     48  await eventWait;
     49 
     50  info("test state after delete");
     51  await checkState([
     52    [["indexedDB", "https://test1.example.org"], ["idb2 (default)"]],
     53  ]);
     54 });