Bug 1191597 part 5 - Ensure to cleanup old window size from the list when exit fullscreen.
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -3091,27 +3091,29 @@ nsDOMWindowUtils::HandleFullscreenReques
return NS_OK;
}
nsresult
nsDOMWindowUtils::ExitFullscreen()
{
nsCOMPtr<nsIDocument> doc = GetDocument();
NS_ENSURE_STATE(doc);
+
+ // Although we would not use the old size if we have already exited
+ // fullscreen, we still want to cleanup in case we haven't.
+ nsSize oldSize = OldWindowSize::GetAndRemove(doc->GetWindow());
if (!doc->IsFullScreenDoc()) {
return NS_OK;
}
// Notify the pres shell that we are starting fullscreen change, and
// set the window dimensions in advance. Since the resize message
// comes after the fullscreen change call, doing so could avoid an
// extra resize reflow after this point.
- FullscreenChangePrepare prepare(
- GetPresShell(), OldWindowSize::GetAndRemove(doc->GetWindow()));
-
+ FullscreenChangePrepare prepare(GetPresShell(), oldSize);
nsIDocument::ExitFullscreenInDocTree(doc);
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::SelectAtPoint(float aX, float aY, uint32_t aSelectBehavior,
bool *_retval)
{