[tbb-commits] [torbutton/master] Bug 40057: Error popup when using New Identity feature

sysrqb at torproject.org sysrqb at torproject.org
Wed Oct 27 16:06:10 UTC 2021


commit 66abd8c194b0518c84c7ac94e5094315741d2ece
Author: Richard Pospesel <richard at torproject.org>
Date:   Tue Oct 26 16:03:08 2021 +0200

    Bug 40057: Error popup when using New Identity feature
---
 chrome/content/torbutton.js | 35 +++++------------------------------
 1 file changed, 5 insertions(+), 30 deletions(-)

diff --git a/chrome/content/torbutton.js b/chrome/content/torbutton.js
index c05dd605..65048b1a 100644
--- a/chrome/content/torbutton.js
+++ b/chrome/content/torbutton.js
@@ -556,34 +556,6 @@ async function torbutton_do_new_identity() {
   torbutton_log(3, "New Identity: Clearing Image Cache");
   torbutton_clear_image_caches();
 
-  torbutton_log(3, "New Identity: Clearing Offline Cache");
-
-  try {
-    const LoadContextInfo = Services.loadContextInfo;
-
-    for (let contextInfo of [LoadContextInfo.default, LoadContextInfo.private]) {
-      let appCacheStorage = Services.cache2.appCacheStorage(contextInfo, null);
-      // The following call (asyncEvictStorage) is actually synchronous, either
-      // if we have pref "browser.cache.use_new_backend" -> 1 or
-      // "browser.cache.use_new_backend_temp" -> true,
-      // then we are using the new cache (cache2) which operates synchronously.
-      // If we are using the old cache, then the tor-browser.git patch for
-      // #5715 also makes this synchronous. So we pass a null callback.
-      try {
-        appCacheStorage.asyncEvictStorage(null);
-      } catch (err) {
-         // We ignore "not available" errors because they occur if a cache
-         // has not been used, e.g., if no browsing has been done.
-         if (err.name !== 'NS_ERROR_NOT_AVAILABLE') {
-             throw err;
-         }
-      }
-    }
-  } catch(e) {
-      torbutton_log(5, "Exception on cache clearing: "+e);
-      window.alert("Torbutton: Unexpected error during offline cache clearing: "+e);
-  }
-
   torbutton_log(3, "New Identity: Clearing Disk and Memory Caches");
 
   try {
@@ -1086,8 +1058,11 @@ function torbutton_disable_browser_js(browser) {
         torbutton_log(4, "Failed to disable JS events: "+e)
     }
 
-    if (browser.docShell)
-      browser.docShell.allowJavascript = false;
+    let { browsingContext } = browser;
+
+    if (browsingContext) {
+      browsingContext.allowJavascript = false;
+    }
 
     try {
         // My estimation is that this does not get the inner iframe windows,





More information about the tbb-commits mailing list