[tbb-commits] [Git][tpo/applications/tor-browser][base-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:46:10 UTC 2023



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


Commits:
95b3625a by cypherpunks1 at 2023-09-08T11:45:15+01: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/95b3625a85b67f859adecbb436a4f44e1aec3ee0

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/95b3625a85b67f859adecbb436a4f44e1aec3ee0
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/d5ad4c8d/attachment-0001.htm>


More information about the tbb-commits mailing list