Bug 1064439, part 5 - Use nsRefPtrs in nsDocShellTreeOwner. r=jst

This commit is contained in:
Andrew McCreight 2014-12-16 09:18:01 -08:00
Родитель 7e5d17d702
Коммит 0dae524e74
2 изменённых файлов: 7 добавлений и 10 удалений

Просмотреть файл

@ -108,9 +108,7 @@ nsDocShellTreeOwner::nsDocShellTreeOwner() :
mPrimaryContentShell(nullptr),
mWebBrowserChrome(nullptr),
mOwnerWin(nullptr),
mOwnerRequestor(nullptr),
mChromeTooltipListener(nullptr),
mChromeContextMenuListener(nullptr)
mOwnerRequestor(nullptr)
{
}
@ -823,7 +821,6 @@ nsDocShellTreeOwner::AddChromeListeners()
if (tooltipListener) {
mChromeTooltipListener = new ChromeTooltipListener(mWebBrowser,
webBrowserChrome);
NS_ADDREF(mChromeTooltipListener);
rv = mChromeTooltipListener->AddChromeListeners();
}
}
@ -837,7 +834,6 @@ nsDocShellTreeOwner::AddChromeListeners()
if (contextListener2 || contextListener) {
mChromeContextMenuListener =
new ChromeContextMenuListener(mWebBrowser, webBrowserChrome);
NS_ADDREF(mChromeContextMenuListener);
rv = mChromeContextMenuListener->AddChromeListeners();
}
}
@ -864,11 +860,11 @@ nsDocShellTreeOwner::RemoveChromeListeners()
{
if (mChromeTooltipListener) {
mChromeTooltipListener->RemoveChromeListeners();
NS_RELEASE(mChromeTooltipListener);
mChromeTooltipListener = nullptr;
}
if (mChromeContextMenuListener) {
mChromeContextMenuListener->RemoveChromeListeners();
NS_RELEASE(mChromeContextMenuListener);
mChromeContextMenuListener = nullptr;
}
nsCOMPtr<EventTarget> piTarget;

Просмотреть файл

@ -8,6 +8,7 @@
#define nsDocShellTreeOwner_h__
// Helper Classes
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsString.h"
@ -127,9 +128,9 @@ protected:
// the objects that listen for chrome events like context menus and tooltips.
// They are separate objects to avoid circular references between |this|
// and the DOM. These are strong, owning refs.
ChromeTooltipListener* mChromeTooltipListener;
ChromeContextMenuListener* mChromeContextMenuListener;
// and the DOM.
nsRefPtr<ChromeTooltipListener> mChromeTooltipListener;
nsRefPtr<ChromeContextMenuListener> mChromeContextMenuListener;
nsCOMPtr<nsIPrompt> mPrompter;
nsCOMPtr<nsIAuthPrompt> mAuthPrompter;