зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1536405 - Cycle-collect through ChromeEventHandler, r=bzbarsky
Differential Revision: https://phabricator.services.mozilla.com/D24422 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
edf28c4d07
Коммит
a39708b997
|
@ -316,7 +316,6 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext)
|
||||||
mForcedCharset(nullptr),
|
mForcedCharset(nullptr),
|
||||||
mParentCharset(nullptr),
|
mParentCharset(nullptr),
|
||||||
mTreeOwner(nullptr),
|
mTreeOwner(nullptr),
|
||||||
mChromeEventHandler(nullptr),
|
|
||||||
mDefaultScrollbarPref(Scrollbar_Auto, Scrollbar_Auto),
|
mDefaultScrollbarPref(Scrollbar_Auto, Scrollbar_Auto),
|
||||||
mCharsetReloadState(eCharsetReloadInit),
|
mCharsetReloadState(eCharsetReloadInit),
|
||||||
mOrientationLock(hal::eScreenOrientation_None),
|
mOrientationLock(hal::eScreenOrientation_None),
|
||||||
|
@ -541,7 +540,7 @@ void nsDocShell::DestroyChildren() {
|
||||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(nsDocShell, nsDocLoader,
|
NS_IMPL_CYCLE_COLLECTION_INHERITED(nsDocShell, nsDocLoader,
|
||||||
mSessionStorageManager, mScriptGlobal,
|
mSessionStorageManager, mScriptGlobal,
|
||||||
mInitialClientSource, mSessionHistory,
|
mInitialClientSource, mSessionHistory,
|
||||||
mBrowsingContext)
|
mBrowsingContext, mChromeEventHandler)
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(nsDocShell, nsDocLoader)
|
NS_IMPL_ADDREF_INHERITED(nsDocShell, nsDocLoader)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsDocShell, nsDocLoader)
|
NS_IMPL_RELEASE_INHERITED(nsDocShell, nsDocLoader)
|
||||||
|
@ -1141,7 +1140,6 @@ nsDocShell::GetOuterWindowID(uint64_t* aWindowID) {
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocShell::SetChromeEventHandler(EventTarget* aChromeEventHandler) {
|
nsDocShell::SetChromeEventHandler(EventTarget* aChromeEventHandler) {
|
||||||
// Weak reference. Don't addref.
|
|
||||||
mChromeEventHandler = aChromeEventHandler;
|
mChromeEventHandler = aChromeEventHandler;
|
||||||
|
|
||||||
if (mScriptGlobal) {
|
if (mScriptGlobal) {
|
||||||
|
@ -1154,7 +1152,7 @@ nsDocShell::SetChromeEventHandler(EventTarget* aChromeEventHandler) {
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocShell::GetChromeEventHandler(EventTarget** aChromeEventHandler) {
|
nsDocShell::GetChromeEventHandler(EventTarget** aChromeEventHandler) {
|
||||||
NS_ENSURE_ARG_POINTER(aChromeEventHandler);
|
NS_ENSURE_ARG_POINTER(aChromeEventHandler);
|
||||||
nsCOMPtr<EventTarget> handler = mChromeEventHandler;
|
RefPtr<EventTarget> handler = mChromeEventHandler;
|
||||||
handler.forget(aChromeEventHandler);
|
handler.forget(aChromeEventHandler);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -4199,7 +4197,7 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
|
||||||
errorPage.AssignLiteral("tabcrashed");
|
errorPage.AssignLiteral("tabcrashed");
|
||||||
error = "tabcrashed";
|
error = "tabcrashed";
|
||||||
|
|
||||||
nsCOMPtr<EventTarget> handler = mChromeEventHandler;
|
RefPtr<EventTarget> handler = mChromeEventHandler;
|
||||||
if (handler) {
|
if (handler) {
|
||||||
nsCOMPtr<Element> element = do_QueryInterface(handler);
|
nsCOMPtr<Element> element = do_QueryInterface(handler);
|
||||||
element->GetAttribute(NS_LITERAL_STRING("crashedPageTitle"), messageStr);
|
element->GetAttribute(NS_LITERAL_STRING("crashedPageTitle"), messageStr);
|
||||||
|
@ -4993,6 +4991,8 @@ nsDocShell::Destroy() {
|
||||||
|
|
||||||
mTabChild = nullptr;
|
mTabChild = nullptr;
|
||||||
|
|
||||||
|
mChromeEventHandler = nullptr;
|
||||||
|
|
||||||
mOnePermittedSandboxedNavigator = nullptr;
|
mOnePermittedSandboxedNavigator = nullptr;
|
||||||
|
|
||||||
// required to break ref cycle
|
// required to break ref cycle
|
||||||
|
|
|
@ -1036,8 +1036,9 @@ class nsDocShell final : public nsDocLoader,
|
||||||
// Note these are intentionally not addrefd. Doing so will create a cycle.
|
// Note these are intentionally not addrefd. Doing so will create a cycle.
|
||||||
// For that reasons don't use nsCOMPtr.
|
// For that reasons don't use nsCOMPtr.
|
||||||
|
|
||||||
nsIDocShellTreeOwner* mTreeOwner; // Weak Reference
|
nsIDocShellTreeOwner* mTreeOwner; // Weak Reference
|
||||||
mozilla::dom::EventTarget* mChromeEventHandler; // Weak Reference
|
|
||||||
|
RefPtr<mozilla::dom::EventTarget> mChromeEventHandler;
|
||||||
|
|
||||||
nsIntPoint mDefaultScrollbarPref; // persistent across doc loads
|
nsIntPoint mDefaultScrollbarPref; // persistent across doc loads
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче