diff --git a/toolkit/content/tests/chrome/test_maximized_persist.xul b/toolkit/content/tests/chrome/test_maximized_persist.xul index be1f7f3c897b..a7e9a56636d4 100644 --- a/toolkit/content/tests/chrome/test_maximized_persist.xul +++ b/toolkit/content/tests/chrome/test_maximized_persist.xul @@ -96,6 +96,13 @@ await changeSizeMode(() => win.maximize()); win.close(); + // Open a new window again with centerscreen which shouldn't revert + // the persisted sizemode. + win = openWindow("centerscreen"); + await SimpleTest.promiseFocus(win); + checkWindow("when open with centerscreen", win, win.STATE_MAXIMIZED); + win.close(); + // Linux doesn't seem to persist sizemode across opening window // with specified size, so mark it expected fail for now. let todo = navigator.platform.includes('Linux'); diff --git a/xpfe/appshell/nsXULWindow.cpp b/xpfe/appshell/nsXULWindow.cpp index 82489131843d..cc41ce3d752d 100644 --- a/xpfe/appshell/nsXULWindow.cpp +++ b/xpfe/appshell/nsXULWindow.cpp @@ -2357,7 +2357,8 @@ nsXULWindow::SizeShell() LoadMiscPersistentAttributesFromXUL(); - if (mChromeLoaded && mCenterAfterLoad && !positionSet) { + if (mChromeLoaded && mCenterAfterLoad && !positionSet && + mWindow->SizeMode() == nsSizeMode_Normal) { Center(parentWindow, parentWindow ? false : true, false); } }