diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2021-04-04 12:26:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-04 07:26:00 -0400 |
commit | 1312a57984d9c058e257286ea4b93dec89b3a5de (patch) | |
tree | 4153b4d2397d123acfb7dd55ddef322866d88884 /core/runtime.rs | |
parent | fe027b4a5930f6afd6e2436ae14504eb099e5d84 (diff) |
fix: Properly await already evaluating dynamic imports (#9984)
Diffstat (limited to 'core/runtime.rs')
-rw-r--r-- | core/runtime.rs | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/core/runtime.rs b/core/runtime.rs index f358cf05e..04c6ca1af 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -784,15 +784,9 @@ impl JsRuntime { module.get_status() }; - // Since the same module might be dynamically imported more than once, - // we short-circuit is it is already evaluated. - if status == v8::ModuleStatus::Evaluated { - self.dyn_import_done(load_id, id); - return Ok(()); - } - - if status != v8::ModuleStatus::Instantiated { - return Ok(()); + match status { + v8::ModuleStatus::Instantiated | v8::ModuleStatus::Evaluated => {} + _ => return Ok(()), } // IMPORTANT: Top-level-await is enabled, which means that return value |