Bug 1266339 - Part 1 - Move session store file names in GeckoProfile into named constants. r=margaret
authorJan Henning <jh+bugzilla@buttercookie.de>
Thu, 21 Apr 2016 20:28:38 +0200
changeset 297916 582c4b721a4f67b8b93f793ef35349e65db80382
parent 297915 49b7c8123960f0b443aeb8df0c795bbebbd39042
child 297917 1633fe6e9c8159ef9ba25ab9192902a2d8d214ae
push id76943
push userryanvm@gmail.com
push dateWed, 18 May 2016 16:13:55 +0000
treeherdermozilla-inbound@c4449eab07d3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1266339
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1266339 - Part 1 - Move session store file names in GeckoProfile into named constants. r=margaret MozReview-Commit-ID: 8QESeQ5P6Ys
mobile/android/base/java/org/mozilla/gecko/GeckoProfile.java
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoProfile.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoProfile.java
@@ -68,16 +68,20 @@ public final class GeckoProfile {
 
     // Used to "lock" the guest profile, so that we'll always restart in it
     private static final String LOCK_FILE_NAME = ".active_lock";
     public static final String DEFAULT_PROFILE = "default";
     // Profile is using a custom directory outside of the Mozilla directory.
     public static final String CUSTOM_PROFILE = "";
     public static final String GUEST_PROFILE = "guest";
 
+    // Session store
+    private static final String SESSION_FILE = "sessionstore.js";
+    private static final String SESSION_FILE_BACKUP = "sessionstore.bak";
+
     private static final HashMap<String, GeckoProfile> sProfileCache = new HashMap<String, GeckoProfile>();
     private static String sDefaultProfileName;
 
     // Caches the guest profile dir.
     private static File sGuestDir;
     private static GeckoProfile sGuestProfile;
     private static boolean sShouldCheckForGuestProfile = true;
 
@@ -762,19 +766,19 @@ public final class GeckoProfile {
      * sessionstore.js should hold the current session, and sessionstore.bak
      * should hold the previous session (where it is used to read the "tabs
      * from last time"). Normally, sessionstore.js is moved to sessionstore.bak
      * on a clean quit, but this doesn't happen if Fennec crashed. Thus, this
      * method should be called after a crash so sessionstore.bak correctly
      * holds the previous session.
      */
     public void moveSessionFile() {
-        File sessionFile = getFile("sessionstore.js");
+        File sessionFile = getFile(SESSION_FILE);
         if (sessionFile != null && sessionFile.exists()) {
-            File sessionFileBackup = getFile("sessionstore.bak");
+            File sessionFileBackup = getFile(SESSION_FILE_BACKUP);
             sessionFile.renameTo(sessionFileBackup);
         }
     }
 
     /**
      * Get the string from a session file.
      *
      * The session can either be read from sessionstore.js or sessionstore.bak.
@@ -782,17 +786,17 @@ public final class GeckoProfile {
      * sessionstore.bak holds the previous session.
      *
      * @param readBackup if true, the session is read from sessionstore.bak;
      *                   otherwise, the session is read from sessionstore.js
      *
      * @return the session string
      */
     public String readSessionFile(boolean readBackup) {
-        File sessionFile = getFile(readBackup ? "sessionstore.bak" : "sessionstore.js");
+        File sessionFile = getFile(readBackup ? SESSION_FILE_BACKUP : SESSION_FILE);
 
         try {
             if (sessionFile != null && sessionFile.exists()) {
                 return readFile(sessionFile);
             }
         } catch (IOException ioe) {
             Log.e(LOGTAG, "Unable to read session file", ioe);
         }