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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user