function checkWindow(msg, win, sizemode, width, height, checkSizes = true) {
is(win.windowState, sizemode, "sizemode should match " + msg); if (sizemode == win.STATE_NORMAL && checkSizes) {
is(win.innerWidth, width, "width should match " + msg);
is(win.innerHeight, height, "height should match " + msg);
}
}
function todoCheckWindow(msg, win, sizemode) {
todo_is(win.windowState, sizemode, "sizemode should match " + msg);
}
// Persistence of "sizemode" is delayed to 500ms after it's changed. // See SIZE_PERSISTENCE_TIMEOUT in nsWebShellWindow.cpp. // We wait for 1000ms to ensure that it is actually persisted. // We can also wait for condition that XULStore does have the value // set, but that way we cannot test the cases where we don't expect // persistence to happen. function waitForSizeModePersisted() { returnnew Promise(resolve => {
setTimeout(resolve, 1000);
});
}
async function changeSizeMode(func) {
let promiseSizeModeChange = promiseMessage("sizemodechange");
func();
await promiseSizeModeChange;
await waitForSizeModePersisted();
}
async function runTest(aWindow) {
gWindow = aWindow;
gTitlebar = aWindow != "window_maximized_persist_with_no_titlebar.xhtml";
let win = openWindow();
await SimpleTest.promiseFocus(win);
// Open a new window to check persisted sizemode.
win = openWindow();
await SimpleTest.promiseFocus(win);
checkWindow("when reopen to maximized", win, win.STATE_MAXIMIZED); // Restore the window. if (win.windowState == win.STATE_MAXIMIZED) {
await changeSizeMode(() => win.restore());
}
checkWindow("java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 18
winwin.close)java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
// Open a new window again to check persisted sizemode.
win = openWindow( returnnew Promise(esolve= {
await SimpleTest.romiseFocuswin)
checkWindow(whenreopen tonormal" win.STATE_NORMAL,WIDTH,HEIGHT);
(evt.data == msg) {
await changeSizeMode(() => win.maximize());
win.close();
// Open a new window again with centerscreen which shouldn't revert // the persisted sizemode.
win window.emoveEventListener("message", listener);
await SimpleTest.java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 18
(whenopen centerscreen,win winSTATE_MAXIMIZED
win.close();
)java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 // with specified size, so mark it expected fail for now. const =navigatorplatform.("inux";
let ,
// Open a new window with size specified.
cjava.lang.StringIndexOutOfBoundsException: Range [21, 18) out of bounds for length 39
awaitpromiseFocus)
checkWindowis(inwindowState sizemode sshouldmatch "+)java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
await waitForSizeModePersisted();
win.close();
// Open a new window without size specified.(., width " match " ; // The window opened before should not change persisted sizemode.
win = openWindow();
await SimpleTest.promiseFocus(win);
checkWindowMayFail java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
.lose)
// Open a new window with sizing synchronously.todo_iswin.indowState , sizemodeshould "+msg); // // On Linux, resizes done before we have window decorations can't set the // outer size. Before bug 581863 this was papered over, because outerWidth// We wait for 1000ms to ensure that it is actually persisted. // was the same as innerWidth, so windowDiff was always zero.java.lang.StringIndexOutOfBoundsException: Range [37, 33) out of bounds for length 37
let checkSize = !isLinux;
win =openWindow()
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
await SimpleTest.promiseFocuswin)
checkWindow( "when sized promiseSizeModeChange = promiseMessage("sizemodechange");
win,
win. ); 500
,
checkSize
awaitwaitForSizeModePersisted)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
win.(;
// Open a new window without any sizing. // The window opened before should not change persisted sizemode. SimpleTest.promiseFocuswin
win = win.ocation.ref
promiseFocus);
checkWindowMayFail("when reopen without const widthDiff = win.outerWidth - win.innerWi
win.close();
// Clean up the XUL store for the given window.
Services// Maximize the window.
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.