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

Issues with polyfills in extensions #41297

Closed
remojansen opened this issue Jan 8, 2018 · 4 comments
Closed

Issues with polyfills in extensions #41297

remojansen opened this issue Jan 8, 2018 · 4 comments
Assignees
Labels
*caused-by-extension Issue identified to be caused by an extension extensions Issues concerning extensions

Comments

@remojansen
Copy link

remojansen commented Jan 8, 2018

The official vscode python extension recently experimented some issues caused by a polyfill.

The polyfill is the reflect-metadata module. This module overrides the Reflect global object. Every time the reflect-metadata is imported, the Reflect global is overwritten. This is a problem because this global object allows us to define metadata and it contains an internal WeakMap that stores the metadata. When the global is overwritten, the WeapMap is also overwritten and all the metadata is deleted.

If two extensions import reflect-metadata, one will remove the metadata created by the other.

We can fix this by changing the polyfill (reflect-metadata) source code but if some extension is using an outdated version or some extension is using a different polyfill we will have the same problem.

So I was wondering if it is possible for the vscode extensions runtime to isolate the globals between extensions? or prevent polyfill-related issues?

cc: @DonJayamanne

@vscodebot vscodebot bot added the extensions Issues concerning extensions label Jan 8, 2018
@jrieken jrieken added the *caused-by-extension Issue identified to be caused by an extension label Jan 15, 2018
@vscodebot
Copy link

vscodebot bot commented Jan 15, 2018

This issue is caused by an extension, please file it with the repository (or contact) the extension has linked in its overview in VS Code or the marketplace for VS Code. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot closed this as completed Jan 15, 2018
@jrieken
Copy link
Member

jrieken commented Jan 15, 2018

So I was wondering if it is possible for the vscode extensions runtime to isolate the globals between extensions?

The idea is cool but I am afraid it's too late for that. We don't know what extensions/node_modules actually depend on something like that and we wouldn't wanna break them... The only option we have to fix this at the source, e.g at reflect-metadata

@remojansen
Copy link
Author

@jrieken thanks for the help. Will see if I can try to get a fix merged into reflect-metadata.

@remojansen
Copy link
Author

The issue in reflect-metadata has been fixed. More info at inversify/InversifyJS#737 (comment)

@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*caused-by-extension Issue identified to be caused by an extension extensions Issues concerning extensions
Projects
None yet
Development

No branches or pull requests

2 participants