tor-browser

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

panel.js (1192B)


      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 /**
      8 * DevTools panel responsible for the application tool, which lists and allows to debug
      9 * service workers.
     10 */
     11 class ApplicationPanel {
     12  /**
     13   * Constructor.
     14   *
     15   * @param {Window} panelWin
     16   *        The frame/window dedicated to this panel.
     17   * @param {Toolbox} toolbox
     18   *        The toolbox instance responsible for this panel.
     19   * @param {object} commands
     20   *        The commands object with all interfaces defined from devtools/shared/commands/
     21   */
     22  constructor(panelWin, toolbox, commands) {
     23    this.panelWin = panelWin;
     24    this.toolbox = toolbox;
     25    this.commands = commands;
     26  }
     27 
     28  async open() {
     29    await this.panelWin.Application.bootstrap({
     30      toolbox: this.toolbox,
     31      commands: this.commands,
     32      panel: this,
     33    });
     34 
     35    return this;
     36  }
     37 
     38  destroy() {
     39    this.panelWin.Application.destroy();
     40    this.panelWin = null;
     41    this.toolbox = null;
     42    this.emit("destroyed");
     43  }
     44 }
     45 
     46 exports.ApplicationPanel = ApplicationPanel;