Skip to content
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

Context::get_active_script_or_module should return a script or module when using import in a generator #3790

Closed
hansl opened this issue Apr 4, 2024 · 1 comment · Fixed by #3791
Labels
bug Something isn't working

Comments

@hansl
Copy link
Contributor

hansl commented Apr 4, 2024

This is a pretty hard problem to fix for me at the moment, as I lack a lot of the internal knowledge around realms and call frames.

In the test262 test/language/expressions/dynamic-import/for-await-resolution-and-error-agen-yield.js, the following code:

async function * agen1() {
    yield import('./for-await-resolution-and-error-a_FIXTURE.js');
    yield import('./for-await-resolution-and-error-b_FIXTURE.js');
    yield import('./for-await-resolution-and-error-poisoned_FIXTURE.js');
}

Will load the call load_imported_module with the right Referrer (this file) and its path, but the second and third yield will have a Referrer of Realm which means they'll have no path associated with them and thus cannot import with a relative path.

These tests were passing before but were a false positive as the path was always resolved from the root of the module loader (which in this case is the parent of the script being run).

@hansl hansl added the bug Something isn't working label Apr 4, 2024
@jedel1043
Copy link
Member

That's interesting! We supposedly store the whole execution context before every yield, so it should be restored after a suspension, but this shows that it apparently doesn't.

I'll see what's happening here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants