-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Error in Safari after mangling #326
Comments
The following code does not error out in Safari 6.0.5. Could it be that the issue was fixed? (function(){
"use strict";
function x(x) {
console.log(x);
}
x(10);
})(); I don't like the idea to cripple UglifyJS to work around browser bugs, though that's sometimes necessary. Not sure we should "fix" this one, any more opinions? |
If problem is in example - i'll spend time to find a better one. Current situation is, that one of #321 or #326 should be fixed for safe deploy on production sites.
|
What version of Safari are you running? |
Personally, i've tested in Safary 7, OSX. But here is confirmation for 6.1 too fontello/fontello#225 (don't pay anttention on alert on screenshot, it's caused by broken script). |
@mishoo: I've confirmed that this happens only with anonymous functions. This will give the aforementioned error: (function(){
"use strict";
(function x(x) {
console.log(x);
})(10);
})(); |
Fixes mishoo#326 and mishoo#179 It isn't a really clean solution, but it works. The idea is to "virtually" reference the function name inside the scope. But to be able know it isn't *really* referenced, we add a `virtual` flag to `AST_SymbolRef.reference`.
I've just submitted a pull request with a fix that should do the trick. It isn't nice, but it seems to work. Could you please verify? |
Mangler can produce the same name for named function & it's param. That cause error in Safary. Example:
Original:
After mangle:
That CAN be avoided, if compressor used, but:
unused: false
due Very slow processing for minified files #321Is it possible to fix?
PS. It seems, this bug already was reported in #179. There are more examples.
The text was updated successfully, but these errors were encountered: