Skip to content

Spec bug: Thenable module breaks assert #424

@o-

Description

@o-

At https://tc39.es/proposal-shadowrealm/#sec-export-getter-functions the 1. Assert: exports is a module namespace exotic object does not hold given a module that is also a thenable.

Repro:

export function then(resolve) {
  resolve(42);
}
const sr = new ShadowRealm();
// Use import.meta.url to import this file itself as a module.
sr.importValue(import.meta.url, 'any_export').catch(() => {});

If I understand correctly this ends up doing:

7. Perform HostLoadImportedModule(referrer, specifierString, EMPTY, innerCapability).
-> "then it must perform FinishLoadingImportedModule(referrer, moduleRequest, payload, result)"
->  a. Perform ContinueDynamicImport(payload, result).
-> ii. Perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace »).

Which means the 42 in the above example will be passed to ExportGetter functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions