tor-browser

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

panel.js (1107B)


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