()
| 75 | } |
| 76 | |
| 77 | function prepareShadowRealmExecution() { |
| 78 | // Patch the process object with legacy properties and normalizations. |
| 79 | // Do not expand argv1 as it is not available in ShadowRealm. |
| 80 | patchProcessObject(false); |
| 81 | setupDebugEnv(); |
| 82 | |
| 83 | // Disable custom loaders in ShadowRealm. |
| 84 | initializeModuleLoaders({ shouldSpawnLoaderHookWorker: false, shouldPreloadModules: false }); |
| 85 | const { |
| 86 | privateSymbols: { |
| 87 | host_defined_option_symbol, |
| 88 | }, |
| 89 | } = internalBinding('util'); |
| 90 | const { |
| 91 | vm_dynamic_import_default_internal, |
| 92 | } = internalBinding('symbols'); |
| 93 | |
| 94 | // For ShadowRealm.prototype.importValue(), the referrer name is |
| 95 | // always null, so the native ImportModuleDynamically() callback would |
| 96 | // always fallback to look up the host-defined option from the |
| 97 | // global object using host_defined_option_symbol. Using |
| 98 | // vm_dynamic_import_default_internal as the host-defined option |
| 99 | // instructs the JS-land importModuleDynamicallyCallback() to |
| 100 | // proxy the request to defaultImportModuleDynamically(). |
| 101 | globalThis[host_defined_option_symbol] = |
| 102 | vm_dynamic_import_default_internal; |
| 103 | } |
| 104 | |
| 105 | function prepareExecution(options) { |
| 106 | const { expandArgv1, initializeModules, isMainThread, shouldSpawnLoaderHookWorker, shouldPreloadModules } = options; |
no test coverage detected
searching dependent graphs…