Bug 1191597 part 5 - Ensure to cleanup old window size from the list when exit fullscreen. draft
authorXidorn Quan <quanxunzhen@gmail.com>
Fri, 08 Jan 2016 00:55:00 +1100
changeset 319976 c20311140df7b37c78983acb9cd8b68a4f8c1053
parent 319975 540b9761d59fbd3e937c941f6e0ad155b2ac4b46
child 319977 94024145bf99b601e198cd8ff216a8933bf36bc7
push id9116
push userxquan@mozilla.com
push dateFri, 08 Jan 2016 09:53:58 +0000
bugs1191597
milestone46.0a1
Bug 1191597 part 5 - Ensure to cleanup old window size from the list when exit fullscreen.
dom/base/nsDOMWindowUtils.cpp
--- 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)
 {