/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(async function test_deleteClosedWindow() { /** Test for Bug 491577 **/
// open a window and add the above closed window list
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no");
await promiseWindowLoaded(newWin);
Services.prefs.setIntPref( "browser.sessionstore.max_windows_undo",
test_state._closedWindows.length
);
await setWindowState(newWin, test_state, true);
let closedWindows = ss.getClosedWindowData();
is(
closedWindows.length,
test_state._closedWindows.length, "Closed window list has the expected length"
);
is(
countByTitle(closedWindows, FORGET),
test_state._closedWindows.length - remember_count, "The correct amount of windows are to be forgotten"
);
is(
countByTitle(closedWindows, REMEMBER),
remember_count, "Everything is set up."
);
// all of the following calls with illegal arguments should throw NS_ERROR_ILLEGAL_VALUE
ok(
testForError(() => ss.forgetClosedWindow(-1)), "Invalid window for forgetClosedWindow throws"
);
ok(
testForError(() =>
ss.forgetClosedWindow(test_state._closedWindows.length + 1)
), "Invalid window for forgetClosedWindow throws"
);
// Remove third window, then first window
ss.forgetClosedWindow(2);
ss.forgetClosedWindow(null);
closedWindows = ss.getClosedWindowData();
is(
closedWindows.length,
remember_count, "The correct amount of windows were removed"
);
is(
countByTitle(closedWindows, FORGET),
0, "All windows specifically forgotten were indeed removed"
);
is(
countByTitle(closedWindows, REMEMBER),
remember_count, "... and windows not specifically forgetten weren't."
);
// clean up
Services.prefs.clearUserPref("browser.sessionstore.max_windows_undo");
await BrowserTestUtils.closeWindow(newWin);
});
Messung V0.5
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.