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

Minified/Uglified Issue #1

Open
chriscoyier opened this issue Feb 22, 2017 · 2 comments
Open

Minified/Uglified Issue #1

chriscoyier opened this issue Feb 22, 2017 · 2 comments
Assignees

Comments

@chriscoyier
Copy link
Member

Say you take the entire https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react.min.js and instrument it with what is here.

You'll get some invalid JS. Here's a formatted-ish chunk of the broken JS:

if (window.CP.shouldStopExecution(22)){break;}
  d=g.value,y=h+r(d,x++),v+=o(d,y,n,i);}

// Invalid right here.
window.CP.exitedLoop(22);

else for(;!(g=E.next()).done;){if (window.CP.shouldStopExecution(23)){break;}var _=g.value;_&&(d=_[1],y=h+c.escape(_[0])+f+r(d,0),v+=o(d,y,n,i))}
window.CP.exitedLoop(23);
}

I added the stuff required for testing as 8-in.js and 8-out-broken.js.

You can run node output-checker.js to instrument and see results quickly.

@ariya ariya self-assigned this Feb 23, 2017
@ariya
Copy link

ariya commented Mar 31, 2017

A reduced test case is the following:

if (1)
    for (;;) { doSomething(); }
else {
    doThat();
}

that got modified (incorrectly) to:

if (1)
    for (;;) {if (window.CP.shouldStopExecution(1)){break;} doSomething(); }
window.CP.exitedLoop(1);

else {
    doThat();
}

which is of course invalid because that else is dangling (since the for loop is a clause inside the if statement, and it is not enclosed by curly braces to form a block).

I believe the fix is to ensure that a loop is enclosed properly. Let me think of something.

@normlee1977
Copy link

[InfiniteLoop2668619f04c1820a204676c8aa187709d87cd.zip](https://github.com/codepen/InfiniteLoopBuster/files/6824830

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

3 participants