-
Notifications
You must be signed in to change notification settings - Fork 947
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
Add test for TemplateStrings caching #1424
Conversation
Safari 12 has a [bug](https://bugs.webkit.org/show_bug.cgi?id=190756) that breaks caching of `TaggedTemplateExpression`s. Test case: https://jsbin.com/leyusas/10/edit?js,console Unfortunately, it's a memory GC bug, so it's very difficult to write a test that would catch this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but maybe we could add a note to the test linking to the bug, and explaining why the test might be tricky to verify?
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, rebuild it one more time.
5cdbeef
to
1472f20
Compare
Done. |
Safari 12 has a [bug](https://bugs.webkit.org/show_bug.cgi?id=190756) that breaks caching of `TemplateStrings`. Re: compat-table/compat-table#1424
Safari 12 has a [bug](https://bugs.webkit.org/show_bug.cgi?id=190756) that breaks caching of `TemplateStrings`. Re: compat-table/compat-table#1424
@jridgewell Just come upon this when updating to the babel 7.4 (which includes the What did this bug cause to happen? Before I go and refudge my config, I was hoping to figure out if I really need to serve Safari 12 the helper-wrapped version or not. Thanks. |
The bug causes: function strings(array) {
return array;
}
function getStrings() {
return strings`foo`;
}
const ref = getStrings();
// This should always be true
// It may not be in Safari
ref === getStrings(); Many libraries use the "always the same reference" property to do caching (via |
@jridgewell Thanks for the explanation. It's unfortunate that babel preset-env currently can't handle the case of a feature having upper bounds in compat-table. BTW, you may want to add this issue to core-js as that is what babel is transitioning to it appears. There does not appear to be a template literals test in the list there. |
compat-table#1424 for context. The Safari bug revealed that `getStrings() !== new getStrings()`, making this easily testable. I've separated the original test into two: 1. Test TemplateStrings call site [revision](tc39/ecma262#890) 2. Test the buggy Safari behavior explicitly
Safari 12 has a bug that breaks caching of
TemplateStrings
.Test case: https://jsbin.com/leyusas/10/edit?js,console
Unfortunately, it's a memory GC bug, so it's very difficult to write a test that would catch this.
Re: babel/babel#9584