#9693 closed defect (fixed)
minified function names not being used
Reported by: | ben hockey | Owned by: | alex |
---|---|---|---|
Priority: | high | Milestone: | 1.4 |
Component: | ShrinkSafe | Version: | 1.3.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
if you run the attached file through shrinksafe, you will see that the _handleSuccess function call in the load handler has not been replaced the _9 or whatever it should need to be now.
the circumstances producing this bug seem to be very specific. here's what i've been able to determine will cause the bug:
- the function being called in the handler has to be defined after the call to the function - whether or not you consider this good practice, it is valid JS.
- the first 'function' property in args (in this case load) gets the bug but the last one does not (have not tested with 3 'function' properties). if only one handler is defined, the bug is not revealed.
- if you define load and error like this it will work:
load: _handleSuccess, error: _handleError
however, let's just assume that this example is trivial and there could be a need to call a function in the way in which the attached file shows.
Attachments (2)
Change History (6)
Changed 11 years ago by
Attachment: | services.js added |
---|
Changed 11 years ago by
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
fwiw, this seems fixed in trunk:
sugr:shrinksafe dante$ java -jar shrinksafe.jar < tests/9693.js (function(){ var go=function(_1){ var w; if(true){ if(false){ w=new widget({handler:function(){ }}); }else{ var _2=_3(); w=new widget({handler:function(){ }}); } } }; var _3=function(){ return "foo"; }; })();
confirmed broken in 1.3 branch head
sugr:shrinksafe dante$ java -jar shrinksafe.jar tests/9693.js (function(){ var go=function(_2){ var w; if(true){ if(false){ w=new widget({handler:function(){ }}); }else{ var _4=bar(); w=new widget({handler:function(){ }}); } } }; var _5=function(){ return "foo"; }; })();
comment:3 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
fixed in trunk for release in 1.4
comment:4 Changed 11 years ago by
Milestone: | tbd → 1.4 |
---|
Note: See
TracTickets for help on using
tickets.
added a 2nd file that demonstrates what i assume is the same problem. in two.js if you comment out either one of the
w = new widget({handler: function(){}});
lines then it will work as it should but if you leave them both in there, you will see the call tovar foo = bar();
will not be using _5 or whatever it should be.