Bug 1840182 - Do not create new XHR channel during shutdown r=necko-reviewers,kershaw

Differential Revision: https://phabricator.services.mozilla.com/D213018
This commit is contained in:
Valentin Gosu
2024-06-10 13:32:45 +00:00
parent e23b5e1040
commit 59d84590f7

View File

@@ -10,6 +10,7 @@
#ifndef XP_WIN
# include <unistd.h>
#endif
#include "mozilla/AppShutdown.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/CheckedInt.h"
@@ -1558,6 +1559,11 @@ void XMLHttpRequestMainThread::Open(const nsACString& aMethod,
return;
}
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
aRv.Throw(NS_ERROR_ILLEGAL_DURING_SHUTDOWN);
return;
}
// Gecko-specific
if (!aAsync && responsibleDocument && GetOwner()) {
// We have no extant document during unload, so the above general