async prepare()

in src/js/popup.js [940:994]


  async prepare() {
    const identity = Logic.currentIdentity();

    const newTab = document.querySelector("#open-new-tab-in-info");
    Utils.addEnterHandler(newTab, () => {
      try {
        browser.tabs.create({
          cookieStoreId: identity.cookieStoreId
        });
        window.close();
      } catch (e) {
        window.close();
      }
    });
    // Populating the panel: name and icon
    document.getElementById("container-info-title").textContent = identity.name;

    const alwaysOpen = document.querySelector("#always-open-in-info-panel");
    Utils.addEnterHandler(alwaysOpen, async () => {
      Utils.alwaysOpenInContainer(identity);
      window.close();
    });

    // Show or not the has-tabs section.
    for (let trHasTabs of document.getElementsByClassName("container-info-has-tabs")) { // eslint-disable-line prefer-const
      trHasTabs.style.display = !identity.hasHiddenTabs && !identity.hasOpenTabs ? "none" : "";
    }

    if (identity.numberOfOpenTabs === 0) {
      Logic._disableMenuItem("No tabs available for this container");
    } else {
      Logic._enableMenuItems();
    }

    this.intializeShowHide(identity);

    // Let's retrieve the list of tabs.
    const tabs = await browser.runtime.sendMessage({
      method: "getTabs",
      windowId: browser.windows.WINDOW_ID_CURRENT,
      cookieStoreId: Logic.currentIdentity().cookieStoreId
    });
    const manageContainer = document.querySelector("#manage-container-link");
    Utils.addEnterHandler(manageContainer, async () => {
      Logic.showPanel(P_CONTAINER_EDIT, identity);
    });
    const clearContainerStorageButton = document.getElementById("clear-container-storage-info");
    Utils.addEnterHandler(clearContainerStorageButton, async () => {
      const granted = await browser.permissions.request({ permissions: ["browsingData"] });
      if (granted) {
        Logic.showPanel(P_CLEAR_CONTAINER_STORAGE, identity);
      }
    });
    return this.buildOpenTabTable(tabs);
  },