tor-browser

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

panel.js (998B)


      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 NetMonitorPanel {
      8  constructor(iframeWindow, toolbox, commands) {
      9    this.panelWin = iframeWindow;
     10    this.toolbox = toolbox;
     11    this.commands = commands;
     12  }
     13  async open() {
     14    // Reuse an existing Network monitor API object if available.
     15    // It could have been created for WE API before Net panel opens.
     16    const api = await this.toolbox.getNetMonitorAPI();
     17    const app = this.panelWin.initialize(api);
     18 
     19    // Connect the application object to the UI.
     20    await app.bootstrap({
     21      toolbox: this.toolbox,
     22      document: this.panelWin.document,
     23      win: this.panelWin,
     24    });
     25 
     26    // Ready to go!
     27    return this;
     28  }
     29 
     30  destroy() {
     31    this.panelWin.Netmonitor.destroy();
     32    this.emit("destroyed");
     33  }
     34 }
     35 
     36 exports.NetMonitorPanel = NetMonitorPanel;