Bug 1822452 - Reject any remaining requests; r=jonco

This patch allows us to reject any outstanding requests when terminating a worker. As this is
controlled by the module loader, the approach I took here was to reject the promises and allow the
moduleloader to
shutdown. I am open to alternatives however.

Differential Revision: https://phabricator.services.mozilla.com/D173290
This commit is contained in:
Yulia 2023-03-23 09:54:49 +00:00
Родитель 6c5beed2e2
Коммит 2e8899ceb2
1 изменённых файлов: 7 добавлений и 1 удалений

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

@ -997,7 +997,12 @@ ModuleLoaderBase::~ModuleLoaderBase() {
void ModuleLoaderBase::Shutdown() {
CancelAndClearDynamicImports();
MOZ_ASSERT(mFetchingModules.IsEmpty());
for (const auto& entry : mFetchingModules) {
if (entry.GetData()) {
entry.GetData()->Reject(NS_ERROR_FAILURE, __func__);
}
}
for (const auto& entry : mFetchedModules) {
if (entry.GetData()) {
@ -1005,6 +1010,7 @@ void ModuleLoaderBase::Shutdown() {
}
}
mFetchingModules.Clear();
mFetchedModules.Clear();
mGlobalObject = nullptr;
mEventTarget = nullptr;