Bug 1316289 P1 Make sure we thaw child frames properly. r=smaug
authorBen Kelly <ben@wanderview.com>
Thu, 10 Nov 2016 14:02:18 -0800
changeset 367207 dbed090b39a49e46086507444c9cdf5984976d18
parent 367206 473160a4dbaf251b37d2a02c9aa9b0bae5c0e2b2
child 367208 4d1eb932fa31f2b27cdb2167011a907dceeef8a7
push id1369
push userjlorenzo@mozilla.com
push dateMon, 27 Feb 2017 14:59:41 +0000
treeherdermozilla-release@d75a1dba431f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1316289
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1316289 P1 Make sure we thaw child frames properly. r=smaug
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -8814,19 +8814,16 @@ nsDocShell::RestoreFromHistory()
   }
 
   // This is the end of our CreateContentViewer() replacement.
   // Now we simulate a load.  First, we restore the state of the javascript
   // window object.
   nsCOMPtr<nsPIDOMWindowOuter> privWin = GetWindow();
   NS_ASSERTION(privWin, "could not get nsPIDOMWindow interface");
 
-  rv = privWin->RestoreWindowState(windowState);
-  NS_ENSURE_SUCCESS(rv, rv);
-
   // Now, dispatch a title change event which would happen as the
   // <head> is parsed.
   document->NotifyPossibleTitleChange(false);
 
   // Now we simulate appending child docshells for subframes.
   for (i = 0; i < childShells.Count(); ++i) {
     nsIDocShellTreeItem* childItem = childShells.ObjectAt(i);
     nsCOMPtr<nsIDocShell> childShell = do_QueryInterface(childItem);
@@ -8877,16 +8874,22 @@ nsDocShell::RestoreFromHistory()
     childShell->SetAllowContentRetargetingOnChildren(
       allowContentRetargetingOnChildren);
     childShell->SetDefaultLoadFlags(defaultLoadFlags);
 
     rv = childShell->BeginRestore(nullptr, false);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
+  // Make sure to restore the window state after adding the child shells back
+  // to the tree.  This is necessary for Thaw() and Resume() to propagate
+  // properly.
+  rv = privWin->RestoreWindowState(windowState);
+  NS_ENSURE_SUCCESS(rv, rv);
+
   nsCOMPtr<nsIPresShell> shell = GetPresShell();
 
   // We may be displayed on a different monitor (or in a different
   // HiDPI mode) than when we got into the history list.  So we need
   // to check if this has happened. See bug 838239.
 
   // Because the prescontext normally handles resolution changes via
   // a runnable (see nsPresContext::UIResolutionChanged), its device