New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetModuleNamespace has an incorrect assertion #1155

Open
jorendorff opened this Issue Mar 27, 2018 · 6 comments

Comments

Projects
None yet
7 participants
@jorendorff

jorendorff commented Mar 27, 2018

According to this bug:

In https://tc39.github.io/ecma262/#sec-getmodulenamespace, the assertion in step 3

  1. Assert: If module.[[Status]] is "evaluated", module.[[EvaluationError]] is undefined.

is incorrect.

Test case using the dynamic import() proposal which results in the same spec assertion.

m.js

import("./a.js");
import("./b.js");

a.js:

throw undefined;

b.js:

import * as ns0 from "./a.js";
@allenwb

This comment has been minimized.

Show comment
Hide comment
@allenwb

allenwb Mar 27, 2018

Member

I think every place in spec. text that talks about execution values and might be using undefined as a marker for no exception needs to be examined.

I know I never considered the possibility somebody might actually do throw undefined;

Member

allenwb commented Mar 27, 2018

I think every place in spec. text that talks about execution values and might be using undefined as a marker for no exception needs to be examined.

I know I never considered the possibility somebody might actually do throw undefined;

@domenic

This comment has been minimized.

Show comment
Hide comment
@domenic

domenic Mar 27, 2018

Member

In the case you mention [[EvaluationError]] will not be undefined. It will be Completion{[[Type]]: throw, [[Target]]: empty, [[Value]]: undefined}.

Member

domenic commented Mar 27, 2018

In the case you mention [[EvaluationError]] will not be undefined. It will be Completion{[[Type]]: throw, [[Target]]: empty, [[Value]]: undefined}.

@littledan

This comment has been minimized.

Show comment
Hide comment
@littledan

littledan Apr 4, 2018

Member

I share @domenic's reading. Should we just close this issue?

Member

littledan commented Apr 4, 2018

I share @domenic's reading. Should we just close this issue?

@anba

This comment has been minimized.

Show comment
Hide comment
@anba

anba Apr 4, 2018

Contributor

No. This issue also applies when other things are thrown, e.g. throw new Error;.

import("./a.js"); and import("./b.js"); result in two distinct module declaration and module evaluation passes. After the pass for import("./a.js"); has finished, the module state for the a.js module is [[Status]] = "Evaluated" and [[EvaluationError]] contains an abrupt completion record. So when 15.2.1.16.4.2 ModuleDeclarationEnvironmentSetup for b.js is executed, 15.2.1.16.4.2 step 8.c.i will call 15.2.1.18 GetModuleNamespace for a.js. And then the assertion in 15.2.1.18 step 3 will fire, because [[EvaluationError]] for a.js is not undefined.

Contributor

anba commented Apr 4, 2018

No. This issue also applies when other things are thrown, e.g. throw new Error;.

import("./a.js"); and import("./b.js"); result in two distinct module declaration and module evaluation passes. After the pass for import("./a.js"); has finished, the module state for the a.js module is [[Status]] = "Evaluated" and [[EvaluationError]] contains an abrupt completion record. So when 15.2.1.16.4.2 ModuleDeclarationEnvironmentSetup for b.js is executed, 15.2.1.16.4.2 step 8.c.i will call 15.2.1.18 GetModuleNamespace for a.js. And then the assertion in 15.2.1.18 step 3 will fire, because [[EvaluationError]] for a.js is not undefined.

@GeorgNeis

This comment has been minimized.

Show comment
Hide comment
@GeorgNeis

GeorgNeis May 25, 2018

Contributor

Yes, the assertion is incorrect. I believe it's safe to remove it.

Contributor

GeorgNeis commented May 25, 2018

Yes, the assertion is incorrect. I believe it's safe to remove it.

@littledan

This comment has been minimized.

Show comment
Hide comment
@littledan

littledan Jun 24, 2018

Member

Thanks for explaining. Does anyone want to make a PR to remove the assertion?

Member

littledan commented Jun 24, 2018

Thanks for explaining. Does anyone want to make a PR to remove the assertion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment