Bug 1451913 P10 Make the inner window explicitly disconnect the IDBFactory. r=baku

This commit is contained in:
Ben Kelly 2018-04-16 06:08:53 -07:00
Родитель fefeb4c744
Коммит 4bdb579005
3 изменённых файлов: 21 добавлений и 2 удалений

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

@ -1230,7 +1230,10 @@ nsGlobalWindowInner::FreeInnerObjects()
mApplicationCache = nullptr;
}
mIndexedDB = nullptr;
if (mIndexedDB) {
mIndexedDB->DisconnectFromWindow(this);
mIndexedDB = nullptr;
}
UnlinkHostObjectURIs();
@ -1524,7 +1527,10 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindowInner)
static_cast<nsDOMOfflineResourceList*>(tmp->mApplicationCache.get())->Disconnect();
NS_IMPL_CYCLE_COLLECTION_UNLINK(mApplicationCache)
}
NS_IMPL_CYCLE_COLLECTION_UNLINK(mIndexedDB)
if (tmp->mIndexedDB) {
tmp->mIndexedDB->DisconnectFromWindow(tmp);
NS_IMPL_CYCLE_COLLECTION_UNLINK(mIndexedDB)
}
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocumentPrincipal)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTabChild)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDoc)

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

@ -895,6 +895,16 @@ IDBFactory::RebindToNewWindow(nsPIDOMWindowInner* aNewWindow)
mWindow->UpdateActiveIndexedDBDatabaseCount(mActiveDatabaseCount);
}
void
IDBFactory::DisconnectFromWindow(nsPIDOMWindowInner* aOldWindow)
{
MOZ_DIAGNOSTIC_ASSERT(aOldWindow);
// If CC unlinks us first, then mWindow might be nullptr
MOZ_DIAGNOSTIC_ASSERT(!mWindow || mWindow == aOldWindow);
mWindow = nullptr;
}
NS_IMPL_CYCLE_COLLECTING_ADDREF(IDBFactory)
NS_IMPL_CYCLE_COLLECTING_RELEASE(IDBFactory)

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

@ -230,6 +230,9 @@ public:
void
RebindToNewWindow(nsPIDOMWindowInner* aNewWindow);
void
DisconnectFromWindow(nsPIDOMWindowInner* aOldWindow);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(IDBFactory)