Bug 1809759 - Shutdown FileSystemManager before releasing it; r=dom-storage-reviewers,jesup

Differential Revision: https://phabricator.services.mozilla.com/D166679
This commit is contained in:
Jan Varga 2023-01-13 12:03:26 +00:00
parent 988da77e66
commit 7aeb3c3248
3 changed files with 22 additions and 3 deletions

View File

@ -0,0 +1,10 @@
<script>
document.addEventListener('DOMContentLoaded', async () => {
document.location.search = '?'
let a = self.navigator.storage
let xhr = new XMLHttpRequest()
xhr.open('POST', 'FOOBAR', false)
xhr.send()
await a.getDirectory()
})
</script>

View File

@ -3,3 +3,4 @@ defaults skip-if(Android) pref(dom.fs.enabled,true) pref(dom.fs.writable_file_st
load 1798773.html
load 1800470.html
load 1809759.html

View File

@ -730,7 +730,7 @@ StorageManager::StorageManager(nsIGlobalObject* aGlobal) : mOwner(aGlobal) {
MOZ_ASSERT(aGlobal);
}
StorageManager::~StorageManager() = default;
StorageManager::~StorageManager() { Shutdown(); }
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(StorageManager)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
@ -740,8 +740,16 @@ NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(StorageManager)
NS_IMPL_CYCLE_COLLECTING_RELEASE(StorageManager)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(StorageManager, mOwner,
mFileSystemManager)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(StorageManager)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(StorageManager)
tmp->Shutdown();
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOwner)
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(StorageManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOwner)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFileSystemManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
void StorageManager::Shutdown() {
if (mFileSystemManager) {