Bug 1719178 - properly disconnect nsSHistory from the owner object, r=peterv

Differential Revision: https://phabricator.services.mozilla.com/D119114
This commit is contained in:
Olli Pettay
2021-07-08 11:08:19 +00:00
parent 302362f8e4
commit 1ff477a2a4
3 changed files with 33 additions and 4 deletions

View File

@@ -139,6 +139,10 @@ CanonicalBrowsingContext::~CanonicalBrowsingContext() {
mPermanentKey.setNull();
mozilla::DropJSObjects(this);
if (mSessionHistory) {
mSessionHistory->SetBrowsingContext(nullptr);
}
}
/* static */
@@ -2512,7 +2516,9 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(CanonicalBrowsingContext)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(CanonicalBrowsingContext,
BrowsingContext)
tmp->mPermanentKey.setNull();
if (tmp->mSessionHistory) {
tmp->mSessionHistory->SetBrowsingContext(nullptr);
}
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSessionHistory, mContainerFeaturePolicy,
mCurrentBrowserParent, mWebProgress,
mSessionStoreSessionStorageUpdateTimer)