[tbb-commits] [Git][tpo/applications/tor-browser][tor-browser-115.2.0esr-13.0-1] Bug 41881: Don't persist custom network requests on private windows

ma1 (@ma1) git at gitlab.torproject.org
Fri Sep 8 10:17:58 UTC 2023



ma1 pushed to branch tor-browser-115.2.0esr-13.0-1 at The Tor Project / Applications / Tor Browser


Commits:
d66f99f2 by cypherpunks1 at 2023-09-08T10:16:52+00:00
Bug 41881: Don't persist custom network requests on private windows

- - - - -


1 changed file:

- devtools/client/netmonitor/src/components/new-request/HTTPCustomRequestPanel.js


Changes:

=====================================
devtools/client/netmonitor/src/components/new-request/HTTPCustomRequestPanel.js
=====================================
@@ -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;
-    const persistedCustomRequest = await asyncStorage.getItem(
-      "devtools.netmonitor.customRequest"
-    );
-    request = request || persistedCustomRequest;
+    if (!lazy.PrivateBrowsingUtils.isWindowPrivate(window)) {
+      const persistedCustomRequest = await asyncStorage.getItem(
+        "devtools.netmonitor.customRequest"
+      );
+      request = request || persistedCustomRequest;
+    }
 
     if (!request) {
       this.setState({ _isStateDataReady: true });
@@ -191,7 +198,9 @@ class HTTPCustomRequestPanel extends Component {
   }
 
   componentWillUnmount() {
-    asyncStorage.setItem("devtools.netmonitor.customRequest", this.state);
+    if (!lazy.PrivateBrowsingUtils.isWindowPrivate(window)) {
+      asyncStorage.setItem("devtools.netmonitor.customRequest", this.state);
+    }
   }
 
   handleChangeURL(event) {



View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/d66f99f26f2a0b41d5d40bc430a386f48abdae1c

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/d66f99f26f2a0b41d5d40bc430a386f48abdae1c
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20230908/a84d791a/attachment-0001.htm>


More information about the tbb-commits mailing list