( compartmentPrivateFields, moduleAliases, compartment, moduleSpecifier, pendingJobs, moduleLoads, errors)
| 7884 | }; |
| 7885 | |
| 7886 | const loadWithoutErrorAnnotation= async( |
| 7887 | compartmentPrivateFields, |
| 7888 | moduleAliases, |
| 7889 | compartment, |
| 7890 | moduleSpecifier, |
| 7891 | pendingJobs, |
| 7892 | moduleLoads, |
| 7893 | errors)=> |
| 7894 | { |
| 7895 | const { importHook, moduleMap, moduleMapHook, moduleRecords}= weakmapGet( |
| 7896 | compartmentPrivateFields, |
| 7897 | compartment); |
| 7898 | |
| 7899 | |
| 7900 | // Follow moduleMap, or moduleMapHook if present. |
| 7901 | let aliasNamespace= moduleMap[moduleSpecifier]; |
| 7902 | if( aliasNamespace=== undefined&& moduleMapHook!== undefined) { |
| 7903 | aliasNamespace= moduleMapHook(moduleSpecifier); |
| 7904 | } |
| 7905 | if( typeof aliasNamespace=== 'string') { |
| 7906 | // eslint-disable-next-line @endo/no-polymorphic-call |
| 7907 | assert.fail( |
| 7908 | d `Cannot map module ${q(moduleSpecifier)} to ${q( |
| 7909 | aliasNamespace) |
| 7910 | } in parent compartment, not yet implemented`, |
| 7911 | TypeError); |
| 7912 | |
| 7913 | }else if( aliasNamespace!== undefined) { |
| 7914 | const alias= weakmapGet(moduleAliases, aliasNamespace); |
| 7915 | if( alias=== undefined) { |
| 7916 | // eslint-disable-next-line @endo/no-polymorphic-call |
| 7917 | assert.fail( |
| 7918 | d `Cannot map module ${q( |
| 7919 | moduleSpecifier) |
| 7920 | } because the value is not a module exports namespace, or is from another realm`, |
| 7921 | ReferenceError); |
| 7922 | |
| 7923 | } |
| 7924 | // Behold: recursion. |
| 7925 | // eslint-disable-next-line no-use-before-define |
| 7926 | const aliasRecord= await memoizedLoadWithErrorAnnotation( |
| 7927 | compartmentPrivateFields, |
| 7928 | moduleAliases, |
| 7929 | alias.compartment, |
| 7930 | alias.specifier, |
| 7931 | pendingJobs, |
| 7932 | moduleLoads, |
| 7933 | errors); |
| 7934 | |
| 7935 | mapSet(moduleRecords, moduleSpecifier, aliasRecord); |
| 7936 | return aliasRecord; |
| 7937 | } |
| 7938 | |
| 7939 | if( mapHas(moduleRecords, moduleSpecifier)) { |
| 7940 | return mapGet(moduleRecords, moduleSpecifier); |
| 7941 | } |
| 7942 | |
| 7943 | const staticModuleRecord= await importHook(moduleSpecifier); |
no test coverage detected