Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#177 closed defect (fixed)

custom_rhino.jar can get tripped up by extraneous variable declarations

Reported by: eric@… Owned by: alex
Priority: high Milestone:
Component: General Version: 0.2
Keywords: compressor java Cc:
Blocked By: Blocking:

Description

Compressing this file:

var func = function(param1) {
       var item_div = document.createElement('DIV');

       item_div.func1 = function() {

               var remove_func = function() {
                       item_div.func2();
               }
       }

       item_div.func2 = function() {

       }
}

produces this correct compressed file:

var func=function(_1){
var _2=document.createElement("DIV");
_2.func1=function(){
var _3=function(){
_2.func2();
};
};
_2.func2=function(){
};
};

But if I add in an extraneous "var item_div = this;" inside item_div.func1, like so:

var func = function(param1) {
       var item_div = document.createElement('DIV');

       item_div.func1 = function() {
               var item_div = this;

               var remove_func = function() {
                       item_div.func2();
               }
       }

       item_div.func2 = function() {

       }
}



I get this this incorrect compressed file (notice that the final "item_div" in the script is not converted to "_2"):


var func=function(_1){
var _2=document.createElement("DIV");
_2.func1=function(){
var _2=this;
var _3=function(){
_2.func2();
};
};
item_div.func2=function(){
};
};


Change History (3)

comment:1 Changed 14 years ago by alex

Milestone: 0.2release
Owner: changed from anonymous to alex
Status: newassigned

this is a serious issue and seems to be related to similar compressor bugs, such as the nexted function argument naming issue.

comment:2 Changed 14 years ago by alex

Resolution: fixed
Status: assignedclosed

(In [2041]) updates to make the compressor even safer and make shortened names even smaller

fixes #177 fixes #146

comment:3 Changed 12 years ago by (none)

Milestone: 0.2release

Milestone 0.2release deleted

Note: See TracTickets for help on using tickets.