You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I first used Uglify with simply compress and mangle true, but got into an issue with the arguments field being used after the function argument variable was reused and changed.
_dropAction: function(event) {
event.preventDefault();
// check acceptable file type
const fileItems = event.originalEvent.dataTransfer.items;
if (fileItems != null) {
for (let fileItem of fileItems) {
if (!this.checkType(fileItem.type)) {
this.showError_('File type is not allowed: ' + fileItem.type);
return;
}
}
}
exWidget._dropAction.apply(this, arguments);
},
Original result:
_dropAction: function (A) {
A.preventDefault();
A = A.originalEvent.dataTransfer.items;
if (null != A)
for (var e of A)
if (!this.checkType(e.type))
return void this.showError_("File type is not allowed: " + e.type);
t._dropAction.apply(this, arguments)
}
Then I tried to change it at the compress level and the file was somewhat different, but the problematic code was unchanged. I then added keep_fargs to mangle and I got very different results. Now the function argument wasn't replaced but it was still re-using the variable
Config:
Here is that output where we can see that event is being re-assigned on the 3rd line to some items. Finally at the end of the function, arguments is being passed with now incorrect content:
_dropAction: function(event) {
event.preventDefault();
event = event.originalEvent.dataTransfer.items;
if (null != event)
for (var A of event)
if (!this.checkType(A.type))
return void this.showError_("File type is not allowed: " + A.type);
e._dropAction.apply(this, arguments)
},
Finally after perusing on Github I tried the following config:
I first used Uglify with simply compress and mangle true, but got into an issue with the arguments field being used after the function argument variable was reused and changed.
Original config:
Original code:
Original result:
Then I tried to change it at the compress level and the file was somewhat different, but the problematic code was unchanged. I then added keep_fargs to mangle and I got very different results. Now the function argument wasn't replaced but it was still re-using the variable
Config:
Here is that output where we can see that event is being re-assigned on the 3rd line to some items. Finally at the end of the function, arguments is being passed with now incorrect content:
Finally after perusing on Github I tried the following config:
and now nothing is compressed or mangled at all.
So I'm very confused and even wondering if the 2nd result is a bug with UglifyJS or not, or I am totally misconfiguring this thing.
Thanks
The text was updated successfully, but these errors were encountered: