Bug 718240 - Use 30 second timeout for crash restore. r=mfinkle

This commit is contained in:
Brian Nicholson 2012-03-19 11:20:42 -07:00
Родитель daa9bc177b
Коммит 4b8060ab1b
3 изменённых файлов: 16 добавлений и 5 удалений

Просмотреть файл

@ -145,7 +145,7 @@ pref("browser.sessionhistory.max_entries", 50);
/* session store */
pref("browser.sessionstore.resume_session_once", false);
pref("browser.sessionstore.resume_from_crash", true);
pref("browser.sessionstore.resume_from_crash", false);
pref("browser.sessionstore.resume_from_crash_timeout", 60); // minutes
pref("browser.sessionstore.interval", 10000); // milliseconds
pref("browser.sessionstore.max_tabs_undo", 1);

Просмотреть файл

@ -1677,9 +1677,10 @@ abstract public class GeckoApp
if (uri != null && uri.length() > 0)
passedUri = mLastTitle = uri;
mRestoreSession |= getProfile().shouldRestoreSession();
if (passedUri == null || passedUri.equals("about:home")) {
// show about:home if we aren't restoring previous session
if (! getProfile().hasSession()) {
if (!mRestoreSession) {
mBrowserToolbar.updateTabCount(1);
showAboutHome();
}

Просмотреть файл

@ -33,6 +33,9 @@ public final class GeckoProfile {
private File mMozDir;
private File mDir;
// this short timeout is a temporary fix until bug 735399 is implemented
private static final long SESSION_TIMEOUT = 30 * 1000; // 30 seconds
public static GeckoProfile get(Context context) {
return get(context, null);
}
@ -80,12 +83,19 @@ public final class GeckoProfile {
return mDir;
}
public boolean hasSession() {
public boolean shouldRestoreSession() {
Log.w(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - start check sessionstore.js exists");
File dir = getDir();
boolean hasSession = (dir != null && new File(dir, "sessionstore.js").exists());
if (dir == null)
return false;
File sessionFile = new File(dir, "sessionstore.js");
if (!sessionFile.exists())
return false;
boolean shouldRestore = (System.currentTimeMillis() - sessionFile.lastModified() < SESSION_TIMEOUT);
Log.w(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - finish check sessionstore.js exists");
return hasSession;
return shouldRestore;
}
public String readSessionFile(boolean geckoReady) {