[gjs/ewlsh/fix-dynamic-module-resolution] Fix race condition in dynamic module resolution.
- From: Evan Welsh <ewlsh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/ewlsh/fix-dynamic-module-resolution] Fix race condition in dynamic module resolution.
- Date: Sat, 10 Jul 2021 04:20:50 +0000 (UTC)
commit c443ffb1eca634ac996d2462ebbd06f618a2010b
Author: Evan Welsh <contact evanwelsh com>
Date: Fri Jul 9 21:20:24 2021 -0700
Fix race condition in dynamic module resolution.
Previously the module could resolve while we were awaiting the source
load and cause an import error.
modules/internal/loader.js | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/modules/internal/loader.js b/modules/internal/loader.js
index 63a1c405..0d44f510 100644
--- a/modules/internal/loader.js
+++ b/modules/internal/loader.js
@@ -161,6 +161,11 @@ class ModuleLoader extends InternalModuleLoader {
if (!result)
return null;
+ // Check if module loaded while awaiting.
+ module = registry.get(uri.uri);
+ if (module)
+ return module;
+
const [text, internal = false] = result;
const priv = new ModulePrivate(uri.uri, uri.uri, internal);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]