Bug 1064439, part 11 - Make nsWebBrowser::mDocShellTreeOwner into an nsRefPtr. r=jst

This commit is contained in:
Andrew McCreight 2014-12-16 09:18:02 -08:00
parent f2af6c4451
commit edf00d8802
2 changed files with 8 additions and 10 deletions

View File

@ -64,7 +64,7 @@ static NS_DEFINE_CID(kChildCID, NS_CHILD_CID);
//*** nsWebBrowser: Object Management
//*****************************************************************************
nsWebBrowser::nsWebBrowser() : mDocShellTreeOwner(nullptr),
nsWebBrowser::nsWebBrowser() :
mInitInfo(nullptr),
mContentType(typeContentWrapper),
mActivating(false),
@ -101,11 +101,10 @@ NS_IMETHODIMP nsWebBrowser::InternalDestroy()
SetDocShell(nullptr);
if (mDocShellTreeOwner)
{
if (mDocShellTreeOwner) {
mDocShellTreeOwner->WebBrowser(nullptr);
NS_RELEASE(mDocShellTreeOwner);
}
mDocShellTreeOwner = nullptr;
}
if (mInitInfo)
{
delete mInitInfo;
@ -502,8 +501,8 @@ NS_IMETHODIMP nsWebBrowser::FindItemWithName(const char16_t *aName,
NS_ASSERTION(mDocShellTreeOwner, "This should always be set when in this situation");
return mDocShell->FindItemWithName(aName,
static_cast<nsIDocShellTreeOwner*>(mDocShellTreeOwner),
aOriginalRequestor, _retval);
static_cast<nsIDocShellTreeOwner*>(mDocShellTreeOwner),
aOriginalRequestor, _retval);
}
nsIDocument*
@ -1633,8 +1632,6 @@ NS_IMETHODIMP nsWebBrowser::EnsureDocShellTreeOwner()
return NS_OK;
mDocShellTreeOwner = new nsDocShellTreeOwner();
NS_ADDREF(mDocShellTreeOwner);
mDocShellTreeOwner->WebBrowser(this);
return NS_OK;

View File

@ -11,6 +11,7 @@
#include "nsDocShellTreeOwner.h"
// Core Includes
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
// Interfaces needed
@ -125,7 +126,7 @@ protected:
virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion) MOZ_OVERRIDE;
protected:
nsDocShellTreeOwner* mDocShellTreeOwner;
nsRefPtr<nsDocShellTreeOwner> mDocShellTreeOwner;
nsCOMPtr<nsIDocShell> mDocShell;
nsCOMPtr<nsIInterfaceRequestor> mDocShellAsReq;
nsCOMPtr<nsIBaseWindow> mDocShellAsWin;