Bug 1432396 - Check the docshell is being destroyed along with the tree owner at the top of nsDocShell::CreateContentViewer(). r?bz draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Fri, 16 Feb 2018 06:15:02 +0900
changeset 755924 467431f76cc93a663551b3332edd332ee41a32cc
parent 755923 472fd4931a6609a4ed543c30a171caa9e46535d8
child 755925 0d13120c212b866bc5ba7d927b86d20fc76ef336
push id99325
push userhikezoe@mozilla.com
push dateThu, 15 Feb 2018 23:56:43 +0000
reviewersbz
bugs1432396
milestone60.0a1
Bug 1432396 - Check the docshell is being destroyed along with the tree owner at the top of nsDocShell::CreateContentViewer(). r?bz We bail out the function to make sure we don't process CreateContentViewer and mLoadingURI is not re-initialized in the function while destroying the docshell. MozReview-Commit-ID: AYJ1t2N786N
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -8688,17 +8688,17 @@ nsDocShell::RestoreFromHistory()
 
 nsresult
 nsDocShell::CreateContentViewer(const nsACString& aContentType,
                                 nsIRequest* aRequest,
                                 nsIStreamListener** aContentHandler)
 {
   *aContentHandler = nullptr;
 
-  if (!mTreeOwner) {
+  if (!mTreeOwner || mIsBeingDestroyed) {
     // If we don't have a tree owner, then we're in the process of being
     // destroyed. Rather than continue trying to load something, just give up.
     return NS_ERROR_DOCSHELL_DYING;
   }
 
   // Can we check the content type of the current content viewer
   // and reuse it without destroying it and re-creating it?