Verified Commit 173e40cb authored by cypherpunks1's avatar cypherpunks1 Committed by ma1
Browse files

Bug 41881: Don't persist custom network requests on private windows

parent 66add4d2
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -4,6 +4,11 @@

"use strict";

const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
  PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
});

const {
  Component,
  createFactory,
@@ -122,10 +127,12 @@ class HTTPCustomRequestPanel extends Component {

  async componentDidMount() {
    let { connector, request } = this.props;
    if (!lazy.PrivateBrowsingUtils.isWindowPrivate(window)) {
      const persistedCustomRequest = await asyncStorage.getItem(
        "devtools.netmonitor.customRequest"
      );
      request = request || persistedCustomRequest;
    }

    if (!request) {
      this.setState({ _isStateDataReady: true });
@@ -191,8 +198,10 @@ class HTTPCustomRequestPanel extends Component {
  }

  componentWillUnmount() {
    if (!lazy.PrivateBrowsingUtils.isWindowPrivate(window)) {
      asyncStorage.setItem("devtools.netmonitor.customRequest", this.state);
    }
  }

  handleChangeURL(event) {
    const { value } = event.target;