tor-browser

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

ext-devtools-inspectedWindow.js (974B)


      1 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
      2 /* vim: set sts=2 sw=2 et tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 "use strict";
      8 
      9 this.devtools_inspectedWindow = class extends ExtensionAPI {
     10  getAPI(context) {
     11    // `devtoolsToolboxInfo` is received from the child process when the root devtools view
     12    // has been created, and every sub-frame of that top level devtools frame will
     13    // receive the same information when the context has been created from the
     14    // `ExtensionChild.createExtensionContext` method.
     15    let tabId =
     16      context.devtoolsToolboxInfo &&
     17      context.devtoolsToolboxInfo.inspectedWindowTabId;
     18 
     19    return {
     20      devtools: {
     21        inspectedWindow: {
     22          get tabId() {
     23            return tabId;
     24          },
     25        },
     26      },
     27    };
     28  }
     29 };