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

Leaking global 'supr' symbol when calling supr using methods without proper this context #30

Open
dwt opened this issue Aug 15, 2016 · 0 comments

Comments

@dwt
Copy link
Contributor

dwt commented Aug 15, 2016

Hi there,

we just noticed that klass will leak a global 'supr' value when you call a supr-using method without a this-context.

What happens, is that the wrapper will assign this.supr to the correct super method - but of course this is now the windows (or global) object.

I'm actually not entirely sure how this should be fixed, what we came up with was to either raise if this === window or just remove this.supr after the super call has taken place if the supr key wasn't not the object before the call.

Interestingly this.supr(...) actually works, even when the wrong this context is used for a method. (Which is actually quite surprising)

Asserting that this cannot be the global object supr() using code seems to make most sense here.

What do you think?

@dwt dwt changed the title Leaking global when calling supr using methods without proper this context Leaking global 'supr' symbol when calling supr using methods without proper this context Aug 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant