tor-browser

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

TabAction.js (1558B)


      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 const {
      8  createFactory,
      9  PureComponent,
     10 } = require("resource://devtools/client/shared/vendor/react.mjs");
     11 const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.mjs");
     12 
     13 const FluentReact = require("resource://devtools/client/shared/vendor/fluent-react.js");
     14 const Localized = createFactory(FluentReact.Localized);
     15 
     16 const InspectAction = createFactory(
     17  require("resource://devtools/client/aboutdebugging/src/components/debugtarget/InspectAction.js")
     18 );
     19 
     20 const Types = require("resource://devtools/client/aboutdebugging/src/types/index.js");
     21 
     22 /**
     23 * This component displays the inspect button for tabs.
     24 */
     25 class TabAction extends PureComponent {
     26  static get propTypes() {
     27    return {
     28      dispatch: PropTypes.func.isRequired,
     29      target: Types.debugTarget.isRequired,
     30    };
     31  }
     32 
     33  render() {
     34    const isZombieTab = this.props.target.details.isZombieTab;
     35    return Localized(
     36      {
     37        id: "about-debugging-zombie-tab-inspect-action-disabled",
     38        attrs: {
     39          // Show an explanatory title only if the action is disabled.
     40          title: isZombieTab,
     41        },
     42      },
     43      InspectAction({
     44        disabled: isZombieTab,
     45        dispatch: this.props.dispatch,
     46        target: this.props.target,
     47      })
     48    );
     49  }
     50 }
     51 
     52 module.exports = FluentReact.withLocalization(TabAction);