Bug 1540913 - Part 3: Exit early if worker module evaluation is aborted; r=jonco

This change addresses the second issue around worker shutdown with infinitely running dynamic
imports: As the event loop is prevented from running when the worker is dying, we do not want to
delegate to the event loop in this case. This case always has a failing promise. Since this is a
failure case related to the worker dying, we stop running code, rather
than waiting for a tick (that never comes) from the event loop.

Differential Revision: https://phabricator.services.mozilla.com/D171684
This commit is contained in:
Yulia
2023-03-14 18:16:31 +00:00
parent 09b46d0966
commit f413b4144c
4 changed files with 20 additions and 8 deletions

View File

@@ -246,6 +246,10 @@ class ModuleLoaderBase : public nsISupports {
// Called when a module script has been loaded, including imports.
virtual void OnModuleLoadComplete(ModuleLoadRequest* aRequest) = 0;
virtual bool IsModuleEvaluationAborted(ModuleLoadRequest* aRequest) {
return false;
}
// Get the error message when resolving failed. The default is to call
// nsContentUtils::FormatLoalizedString. But currently
// nsContentUtils::FormatLoalizedString cannot be called on a worklet thread,