[tbb-commits] [tor-browser/tor-browser-60.3.0esr-8.5-1] Bug 28507: Implement fallback to delete private data in the browser startup

gk at torproject.org gk at torproject.org
Thu Nov 22 21:16:52 UTC 2018


commit 977e468c7f83b78cf920a7aa4943147eda195c45
Author: Igor Oliveira <igt0 at torproject.org>
Date:   Mon Nov 19 14:58:15 2018 -0200

    Bug 28507: Implement fallback to delete private data in the browser startup
    
    When the TBA is forcefully closed, its private data is not deleted,
    even if the history.clear_on_exit is set.
    
    As fallback, this patch calls the Sanitize:ClearData event in the
    browser startup to clean the private data if needed.
---
 .../android/base/java/org/mozilla/gecko/GeckoApp.java | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
index ef7da17e19a1..3741c26fe0e8 100644
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -564,10 +564,7 @@ public abstract class GeckoApp extends GeckoActivity
         return super.onOptionsItemSelected(item);
     }
 
-    private void quitAndClear() {
-        // Make sure the Guest Browsing notification goes away when we quit.
-        GuestSession.hideNotification(this);
-
+    private GeckoBundle createSanitizeData() {
         final SharedPreferences prefs = getSharedPreferencesForProfile();
         final Set<String> clearSet = PrefUtils.getStringSet(
             prefs, ClearOnShutdownPref.PREF, new HashSet<String>());
@@ -576,7 +573,14 @@ public abstract class GeckoApp extends GeckoActivity
         for (final String clear : clearSet) {
             clearObj.putBoolean(clear, true);
         }
+        return clearObj;
+    }
 
+    private void quitAndClear() {
+        // Make sure the Guest Browsing notification goes away when we quit.
+        GuestSession.hideNotification(this);
+
+        final GeckoBundle clearObj = createSanitizeData();
         final GeckoBundle res = new GeckoBundle(2);
         res.putBundle("sanitize", clearObj);
 
@@ -1135,6 +1139,13 @@ public abstract class GeckoApp extends GeckoActivity
         mTextSelection.create();
 
         final Bundle finalSavedInstanceState = savedInstanceState;
+
+        // When the browser is forcefully closed, its private data is not
+        // deleted, even if the history.clear_on_exit is set. Here we are calling
+        // the Sanitize:ClearData in the startup to make sure the private
+        // data was cleared.
+        EventDispatcher.getInstance().dispatch("Sanitize:ClearData", createSanitizeData());
+
         ThreadUtils.postToBackgroundThread(new Runnable() {
             @Override
             public void run() {



More information about the tbb-commits mailing list