-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Idenitifier self is not declared, breaks when self
its leaked.
#1930
Comments
As far as I know as same as other global variables like I think it's expected behavior to allow setup your own environment. /cc @Blesh , @jayphelps since I could be wrong.. |
Well, it's not read only in Chrome Version 53.0.2785.92 (64-bit) - I assume in other browsers also...
This makes RxJS very prone to errors, especially for libs etc that run in uncontrolled code sites. |
Same for Firefox 48.0
|
Did this actually happen in real life or just discussing the possibility?
Any alternatives? |
This seems like trying to defend against developers defining |
I see @Blesh's point--but this is indeed a bit more insidious: function UserClassOfSomething() {
self = this;
}
user = new UserClassOfSomething();
// self === user
// whoops where as It's only a problem in ES5 when shadowing with a new declaration (function () { var undefined = 132; alert(undefined); })() ..but that's even less likely to affect us cause it would mean someone did this in code that wraps our code. There's little point to worrying about that because there are a billion similar things people could do to fuck up our code if they're wrapping it in another function. that said I don't think in practice this |
@jayphelps yes, it's a real case, we had an incident with a client's code that was overwriting |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The
self
identifier is NOT declared locally in the module and hence it comes from global - inrxjs/src/util/root.ts
Line 21 in 3793e47
So, depending on what
window.self
value might be (i.e from leaked variables, a common mistake of devs), RxJS might break.RxJS version:
5.0.0-beta.11
Code to reproduce:
Add a
window.self
variable with different values and run tests.The text was updated successfully, but these errors were encountered: