mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 13:56:29 +00:00
Bug 694378 - session restore fails when selectedWindow > number of windows [r=dietrich]
This commit is contained in:
parent
9709f3cbf0
commit
18f17914d7
@ -2577,7 +2577,7 @@ SessionStoreService.prototype = {
|
||||
this._closedWindows = root._closedWindows;
|
||||
|
||||
var winData;
|
||||
if (!root.selectedWindow) {
|
||||
if (!root.selectedWindow || root.selectedWindow > root.windows.length) {
|
||||
root.selectedWindow = 0;
|
||||
} else {
|
||||
// put the selected window at the beginning of the array to ensure that
|
||||
|
@ -154,6 +154,7 @@ _BROWSER_TEST_FILES = \
|
||||
browser_662812.js \
|
||||
browser_665702-state_session.js \
|
||||
browser_682507.js \
|
||||
browser_694378.js \
|
||||
$(NULL)
|
||||
|
||||
ifneq ($(OS_ARCH),Darwin)
|
||||
|
@ -0,0 +1,35 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Test Summary:
|
||||
// 1. call ss.setWindowState with a broken state
|
||||
// 1a. ensure that it doesn't throw.
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
let brokenState = {
|
||||
windows: [
|
||||
{ tabs: [{ entries: [{ url: "about:mozilla" }] }] }
|
||||
//{ tabs: [{ entries: [{ url: "about:robots" }] }] },
|
||||
],
|
||||
selectedWindow: 2
|
||||
};
|
||||
let brokenStateString = JSON.stringify(brokenState);
|
||||
|
||||
let gotError = false;
|
||||
try {
|
||||
ss.setWindowState(window, brokenStateString, true);
|
||||
}
|
||||
catch (ex) {
|
||||
gotError = true;
|
||||
info(ex);
|
||||
}
|
||||
|
||||
ok(!gotError, "ss.setWindowState did not throw an error");
|
||||
|
||||
// Make sure that we reset the state. Use a full state just in case things get crazy.
|
||||
let blankState = { windows: [{ tabs: [{ entries: [{ url: "about:blank" }] }]}]};
|
||||
waitForBrowserState(blankState, finish);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user