Usually the function name is dropped if the function is a function expression. But when `ie8` option is enabled, the function name is kept and mangled which may break legacy Safari for said reason. Since symbol names are now [mangled from within](https://github.com/mishoo/UglifyJS2/pull/2948#issuecomment-368095376), this fix adds argument names to existing names when mangling the name of a function expression.
27 lines
904 B
JavaScript
27 lines
904 B
JavaScript
var assert = require('assert');
|
|
var UglifyJS = require('../..');
|
|
|
|
describe('legacy safari', function() {
|
|
it('Should make sure mangled function name is different from its argument names', function () {
|
|
assert.strictEqual(
|
|
UglifyJS.minify([
|
|
'function main() {',
|
|
' "use strict";',
|
|
' ',
|
|
' function n(a,b,c) {',
|
|
' console.log(c)',
|
|
' }',
|
|
' E.on = function f2() {',
|
|
' E.on(function(e) {',
|
|
' return n(this,e)',
|
|
' })',
|
|
' }',
|
|
'}'
|
|
].join('\n'), {
|
|
ie8: true
|
|
}).code,
|
|
'function main(){"use strict";E.on=function(){E.on(function(n){return function c(n,o,t){console.log(t)}()})}}'
|
|
)
|
|
})
|
|
})
|