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
ES Symbols break classes #13796
Comments
Ummm. WAT. This seems like a browser bug to me... |
If so, would be good to get a reduction. Unfortunately, I'm not familiar enough with the Ember stack to track down a Heisenbug like this. Perhaps someone can help? |
Agreed. We need to figure out what is going on here. While randomly poking at it, I noticed that this does alert the right value: const sym = Symbol('foo');
const Class = Ember.Object.extend();
alert(Class.create({
[sym]: 1,
bar() {}
}).bar); |
Thanks to @krisselden, here is a minimal reproduction: var sym = Symbol('foo');
var args = {
[sym]: 1,
bar() {}
};
function foo(obj) {
var arr = [];
for (var key in obj) {
arr.push(key);
arr.push(obj[key]);
}
return arr;
}
alert(foo(args));
var c = 30;
while (c--) {
foo({c: c});
}
alert(foo(args));
|
@chrisjshull this is fixed at least in WebKit nightly, Safari 9.1 uses over a year old WebKit version. This does not seem like something we can workaround. JITed code that reads objects with Symbols in Safari seems fatally buggy. What I don't understand is why do you have a symbol in there anyway? They are not enumerable and therefor ignored by create(). |
Ah, perhaps I over-reduced the problem. I originally hit this when doing a reopenClass, like this: https://ember-twiddle.com/176c808569ddd3c1ad7e35dfc4712c3e Since you brought it up though:
const sym = Symbol('foo');
class Foo {
[sym]() { console.log("hello"); }
public() { this[sym](); }
}
new Foo().public(); // logs "hello" (let me know and I'll file follow on issues) |
@chrisjshull @rwjblue this is not an Ember specific issue but a broader issue for |
It is a Safari issue, WebKit works now. And this has nothing to do with Ember. |
Thank you all for your efforts on this issue. Since this is not an Ember issue, I'm closing it. Thank you all! |
https://ember-twiddle.com/f2fa721c2a2e60ee3baed80c7de66e13
This alerts "1" in Safari (9.1) with the web inspector closed, and "function bar() {}" with the web inspector open. Chrome (correctly) always alerts "function bar() {}".
The text was updated successfully, but these errors were encountered: