Bug 1630208 part 3: Clean up the remote XPC document accessible cache on shutdown. r=yzen

The cache should already be empty by this point unless there's a bug, but we should still clean up regardless.
Also, the hashtable itself was previously never cleaned up even if it was empty.

Differential Revision: https://phabricator.services.mozilla.com/D79781
This commit is contained in:
James Teh 2020-06-17 18:42:30 +00:00
Родитель 6a5821c667
Коммит 9d61ef8210
2 изменённых файлов: 7 добавлений и 5 удалений

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

@ -40,9 +40,9 @@ using namespace mozilla::a11y;
using namespace mozilla::dom;
StaticAutoPtr<nsTArray<DocAccessibleParent*>> DocManager::sRemoteDocuments;
nsRefPtrHashtable<nsPtrHashKey<const DocAccessibleParent>,
xpcAccessibleDocument>* DocManager::sRemoteXPCDocumentCache =
nullptr;
StaticAutoPtr<nsRefPtrHashtable<nsPtrHashKey<const DocAccessibleParent>,
xpcAccessibleDocument>>
DocManager::sRemoteXPCDocumentCache;
////////////////////////////////////////////////////////////////////////////////
// DocManager
@ -143,6 +143,7 @@ xpcAccessibleDocument* DocManager::GetXPCDocument(DocAccessibleParent* aDoc) {
sRemoteXPCDocumentCache =
new nsRefPtrHashtable<nsPtrHashKey<const DocAccessibleParent>,
xpcAccessibleDocument>;
ClearOnShutdown(&sRemoteXPCDocumentCache);
}
MOZ_ASSERT(!aDoc->IsShutdown(), "Adding a shutdown doc to remote XPC cache");

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

@ -172,8 +172,9 @@ class DocManager : public nsIWebProgressListener,
xpcAccessibleDocument>
XPCDocumentHashtable;
XPCDocumentHashtable mXPCDocumentCache;
static nsRefPtrHashtable<nsPtrHashKey<const DocAccessibleParent>,
xpcAccessibleDocument>* sRemoteXPCDocumentCache;
static StaticAutoPtr<nsRefPtrHashtable<
nsPtrHashKey<const DocAccessibleParent>, xpcAccessibleDocument>>
sRemoteXPCDocumentCache;
/*
* The list of remote top level documents.