[tor-commits] [torbutton/master] Bug 5715: Explicitly clear image cache on New Identity

mikeperry at torproject.org mikeperry at torproject.org
Wed May 2 02:34:31 UTC 2012


commit 3009ee8b19600737ee12b2891fe75486e30e8417
Author: Mike Perry <mikeperry-git at fscked.org>
Date:   Tue May 1 14:10:48 2012 -0700

    Bug 5715: Explicitly clear image cache on New Identity
    
    It seems to get cleared eventually by nsICacheService.EvictEntries, but this
    gets it done immediately.
---
 src/chrome/content/torbutton.js |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 57261c9..dc0b05b 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -1481,6 +1481,10 @@ function torbutton_do_new_identity() {
   m_tb_prefs.setIntPref("browser.sessionstore.max_tabs_undo", 0);
   m_tb_prefs.setIntPref("browser.sessionstore.max_tabs_undo", tabs);
 
+  var imgCache = Components.classes["@mozilla.org/image/cache;1"].
+            getService(Components.interfaces.imgICache);
+  imgCache.clearCache(false); // evict all but chrome cache
+
   var cache = Components.classes["@mozilla.org/network/cache-service;1"].
       getService(Components.interfaces.nsICacheService);
   try {





More information about the tor-commits mailing list