Skip to content
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

JS: Incorrect renaming variables #469

Closed
malcom opened this issue Mar 18, 2022 · 5 comments
Closed

JS: Incorrect renaming variables #469

malcom opened this issue Mar 18, 2022 · 5 comments

Comments

@malcom
Copy link

malcom commented Mar 18, 2022

Probably the new/rewritten JS variable renamer introduced in v2.9.27 have some bugs that can lead to unexpected behavior in minified code.

The issue is observable and reproducible on minified Hyphenopoly_Loader.js file, for example some mismatched names:

source: s.res.he.set(t,{w:e.fetch(s.paths.patterndir+n,{credentials:s.s.CORScredentials})}),g.set(n,t)};
2.9.26: a.res.he.set(b,{w:n.fetch(a.paths.patterndir+c,{credentials:a.s.CORScredentials})}),m.set(c,b)};
2.9.27: e.res.he.set(t,{w:e.fetch(e.paths.patterndir+n,{credentials:e.s.CORScredentials})}),h.set(n,t)};
        ^                 ^       ^ ...
@ShaneMcC
Copy link

I ran a git bisect on this - and fb5ce73 is the commit that introduced the broken behaviour - so it is indeed the new variable renamer.

@jmooring
Copy link
Contributor

This appears to be a whitespace problem. If I reformat the OP's example in vscode, then minimize, vars are renamed correctly.

@tdewolff
Copy link
Owner

tdewolff commented Mar 30, 2022

Thanks for the bug report, I will be looking into this!

EDIT: the shortest I can make this is (e,s)=>{e=>0,s(e)} which incorrectly becomes (t,e)=>{e=>0,e(e)}.

@tdewolff
Copy link
Owner

This has been fixed in tdewolff/parse@3a696f8, a new released will be out soon as I have some other outstanding work

@tdewolff
Copy link
Owner

tdewolff commented Apr 8, 2022

This has been fixed and released in v.2.11.0!

@tdewolff tdewolff closed this as completed Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants