forked from mirrors/gecko-dev
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:
parent
6c5beed2e2
commit
2e8899ceb2
1 changed files with 7 additions and 1 deletions
|
|
@ -997,7 +997,12 @@ ModuleLoaderBase::~ModuleLoaderBase() {
|
||||||
|
|
||||||
void ModuleLoaderBase::Shutdown() {
|
void ModuleLoaderBase::Shutdown() {
|
||||||
CancelAndClearDynamicImports();
|
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) {
|
for (const auto& entry : mFetchedModules) {
|
||||||
if (entry.GetData()) {
|
if (entry.GetData()) {
|
||||||
|
|
@ -1005,6 +1010,7 @@ void ModuleLoaderBase::Shutdown() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mFetchingModules.Clear();
|
||||||
mFetchedModules.Clear();
|
mFetchedModules.Clear();
|
||||||
mGlobalObject = nullptr;
|
mGlobalObject = nullptr;
|
||||||
mEventTarget = nullptr;
|
mEventTarget = nullptr;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue