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

Dynamic import() is not blockable as a global #28

Open
natevw opened this issue Mar 1, 2020 · 0 comments
Open

Dynamic import() is not blockable as a global #28

natevw opened this issue Mar 1, 2020 · 0 comments
Labels

Comments

@natevw
Copy link
Owner

natevw commented Mar 1, 2020

Evel'ing this successfully returns a Promise:

import('test')

Testing in Chrome 80, the promise gets rejected with an Error: Cannot import module from an inactive browsing context. but it's possible that may vary depending on JS engine and/or iframe sandbox attribute support.

Dynamic import() works via a "function-like" keyword, not an actual call to a built-in function (e.g. it's like if or catch, rather than like eval or isNaN). We are unable to block keywords through shadowing (i.e. Function('import', "") throws just like var yield = return; would).

Even the Agoric/realms-shim ends up having to munge incoming source on account of this very issue: https://github.com/Agoric/realms-shim/blob/025d975da12c8033022c271e5d99a3810066dfa4/src/sourceParser.js#L31

@natevw natevw added the bypass label Mar 1, 2020
@natevw natevw changed the title Dynamic import works via keyword, not a global Dynamic import() is not blockable as a global Mar 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant