[gjs/ewlsh/fix-dynamic-module-resolution: 3/4] 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: 3/4] Fix race condition in dynamic module resolution.
- Date: Tue, 27 Jul 2021 05:25:11 +0000 (UTC)
commit 2386898fdbfe034463caae94c5e00c0a7926d092
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]