mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1001167 - Don't let invalid sessionstore.js files break sessionstore r=smacleod
This commit is contained in:
parent
23d227e0ea
commit
026758ba0e
@ -126,15 +126,16 @@ SessionStartup.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
this._initialState = this._parseStateString(stateString);
|
||||
this._initialState = this._parseStateString(stateString);
|
||||
|
||||
let shouldResumeSessionOnce = Services.prefs.getBoolPref("browser.sessionstore.resume_session_once");
|
||||
let shouldResumeSession = shouldResumeSessionOnce ||
|
||||
Services.prefs.getIntPref("browser.startup.page") == BROWSER_STARTUP_RESUME_SESSION;
|
||||
|
||||
// If this is a normal restore then throw away any previous session
|
||||
if (!shouldResumeSessionOnce)
|
||||
if (!shouldResumeSessionOnce && this._initialState) {
|
||||
delete this._initialState.lastSessionState;
|
||||
}
|
||||
|
||||
let resumeFromCrash = Services.prefs.getBoolPref("browser.sessionstore.resume_from_crash");
|
||||
|
||||
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"windows": // invalid json
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function run_test() {
|
||||
let profd = do_get_profile();
|
||||
|
||||
let sourceSession = do_get_file("data/sessionstore_invalid.js");
|
||||
sourceSession.copyTo(profd, "sessionstore.js");
|
||||
|
||||
let sourceCheckpoints = do_get_file("data/sessionCheckpoints_all.json");
|
||||
sourceCheckpoints.copyTo(profd, "sessionCheckpoints.json");
|
||||
|
||||
do_test_pending();
|
||||
let startup = Cc["@mozilla.org/browser/sessionstartup;1"].
|
||||
getService(Ci.nsISessionStartup);
|
||||
|
||||
afterSessionStartupInitialization(function cb() {
|
||||
do_check_eq(startup.sessionType, Ci.nsISessionStartup.NO_SESSION);
|
||||
do_test_finished();
|
||||
});
|
||||
}
|
@ -4,9 +4,11 @@ tail =
|
||||
firefox-appdir = browser
|
||||
support-files =
|
||||
data/sessionCheckpoints_all.json
|
||||
data/sessionstore_invalid.js
|
||||
data/sessionstore_valid.js
|
||||
|
||||
[test_backup.js]
|
||||
[test_backup_once.js]
|
||||
[test_startup_nosession_async.js]
|
||||
[test_startup_session_async.js]
|
||||
[test_startup_invalid_session.js]
|
||||
|
Loading…
Reference in New Issue
Block a user