Bug 1453567 - Null-check rootSH in nsDocShell::AddState. r=bz, a=RyanVM
authorNika Layzell <nika@thelayzells.com>
Mon, 16 Apr 2018 12:57:00 -0400
changeset 467533 26d6282bdbe03b9a125f302a3e2daeff28a9eddd
parent 467532 f94b64e0020225c71701930f193bd96c3ad1d150
child 467534 5ded36cb383d3ccafd9b6c231c5120dcdae196a2
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, RyanVM
bugs1453567
milestone61.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 1453567 - Null-check rootSH in nsDocShell::AddState. r=bz, a=RyanVM Looks like this accidentally got thrown out in the refactoring.
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -11849,16 +11849,18 @@ nsDocShell::AddState(JS::Handle<JS::Valu
   newSHEntry->SetURIWasModified(!sameExceptHashes || oldURIWasModified);
 
   // Step 5: If aReplace is false, indicating that we're doing a pushState
   // rather than a replaceState, notify bfcache that we've added a page to
   // the history so it can evict content viewers if appropriate. Otherwise
   // call ReplaceEntry so that we notify nsIHistoryListeners that an entry
   // was replaced.
   RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
+  NS_ENSURE_TRUE(rootSH, NS_ERROR_UNEXPECTED);
+
   if (!aReplace) {
     int32_t curIndex = rootSH->Index();
     if (curIndex > -1) {
       rootSH->LegacySHistoryInternal()->EvictOutOfRangeContentViewers(curIndex);
     }
   } else {
     nsCOMPtr<nsISHEntry> rootSHEntry = nsSHistory::GetRootSHEntry(newSHEntry);