Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX release] Fix uglification introduced bug with super wrapping.
We check to see if a function contains `_super` / `.call` / `.apply` before attempting to super wrap a given method (this saves quite a bit of extra super wrapping for functions that do not need it). Unfortunately, a number of platforms that we support do not support calling `func.toString()` so we attempt to detect this and fall back to always super wrap everything mode. We have roughly this code (from [here](https://github.com/emberjs/ember.js/blob/b4718218dbe5ffe7736c485a594248b20977c621/packages/ember-metal/lib/utils.js#L257-L271)) to detect if we can call `toString()` and get the original source: ```javascript let sourceAvailable = (function() { return this; }).toString().indexOf('return this;') > -1; ``` This works perfectly for development builds, but unfortunately not when minified. Take a look at the minified source and you will see why: ```javascript var e=function(){return this}.toString().indexOf("return this;")>-1; ``` Note that minifier has stripped the trailing semicolon from the function body we are attempting to check against, but sadly our `indexOf` check still contains the semicolon! **tldr;** We super wrap every function in uglified builds. --- This commit removes the trailing semicolon from the source check, and adds a test that should hopefully allow us to detect if this is accidentally reintroduced.
- Loading branch information