* V8 would make sure that as long as import() can still be initiated from * the referrer, the symbol referenced by |host_defined_option_symbol| should * be alive, which in term would keep the settings object alive through the * WeakMap, and in turn that keeps the referrer object alive, which woul
(referrer, registry)
| 168 | * @param {ModuleRegistry} registry |
| 169 | */ |
| 170 | function registerModule(referrer, registry) { |
| 171 | const idSymbol = referrer[host_defined_option_symbol]; |
| 172 | if (idSymbol === vm_dynamic_import_no_callback || |
| 173 | idSymbol === vm_dynamic_import_missing_flag || |
| 174 | idSymbol === vm_dynamic_import_main_context_default || |
| 175 | idSymbol === vm_dynamic_import_default_internal) { |
| 176 | // The referrer is compiled without custom callbacks, so there is |
| 177 | // no registry to hold on to. We'll throw |
| 178 | // ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING when a callback is |
| 179 | // needed. |
| 180 | return; |
| 181 | } |
| 182 | // To prevent it from being GC'ed. |
| 183 | registry.callbackReferrer ??= referrer; |
| 184 | moduleRegistries.set(idSymbol, registry); |
| 185 | } |
| 186 | |
| 187 | /** |
| 188 | * Initializes the `import.meta` object for a given module. This is only called when the module |
no test coverage detected