GithubHelp home page GithubHelp logo

infiniteloopbuster's People

Contributors

chriscoyier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

infiniteloopbuster's Issues

On Wrong React code Codepen freezes browser (and eventually results in system crash)

Consider this snippet
https://codepen.io/gaearon/pen/aWWQOG?editors=0010

Just try writing
<button className="square" onClick={this.setState({value: 'X'})>

instead of
<button className="square" onClick={() => this.setState({value: 'X'})}>

Codepen just auto refreshes when typing the first statement, hangs eventually leading to browser and system crash (Latest chrome, Ubuntu 16).

I'm not sure if this is the right place to report this, but this is really a pain. The code is not even saved, and codepen just starts refreshing while typing and just crashes.

Minified/Uglified Issue

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.

Loop Case

var isSquare = function(arr){
  var num = 0;
if (arr.length < 1) {
  return undefined;
};
for (var i = 0; i < arr.length; i++) {
  for (var x = 0; x < arr[i]; x++) {
    if (arr[i] === 1) {
      num += 1;
    } else if (x * x === arr[i]) {
      num += 1;
    }
  }
};
  if (num === arr.length) {
    return true;
  } else {
    return false;
  }
};
console.log(isSquare([1, 4, 9, 16, 25, 36, 225, 7225, 9604, 5563518921]));

Another Un-Stopped Case

function timer() {
  var stop = false;
  window.setTimeout(function() {
    stop = true;
  }, 5000);
  while(!stop) {
    window.setInterval(function() {
      console.log("1");
    }, 1000);
  }
  
}

function endClock() {
  
}

timer();

Incorrect behaviour when it encounters a bodyless loop

When I pass the while(1) console.log(Date.now()) loop, the output is

while(1) {
    if (window.CP.shouldStopExecution(1)) {
        break;
    }
    console.log(Date.now());
    window.CP.exitedLoop(1);
}

Which isn't correct, since window.CP.exitedLoop(1); should come after the closing bracket. If I however pass it the same function but with a body (aka. while(1) { console.log(Date.now()); }) I get

while(1) { 
    if (window.CP.shouldStopExecution(1)) { 
        break;
    } 
    console.log(Date.now()); 
}
window.CP.exitedLoop(1);

Possible solution

I'll get this out of the way first: I have absolutely no idea why this works, I stumbled upon it by accident.

Switching the last two lines in

patches.push({ pos: start, str: prolog });
patches.push({ pos: end, str: epilog });
patches.push({ pos: node.range[1], str: LOOP_EXIT.replace('%d', loopId) });

To get

patches.push({ pos: start, str: prolog });
patches.push({ pos: node.range[1], str: LOOP_EXIT.replace('%d', loopId) });
patches.push({ pos: end, str: epilog });

Solves this problem for me.

codepen frees dashboard

I am learning react so i wrote wrong code for one my event handlers on react, and this made the whole browser page to freeze. I also cannot acces my codepen dashboard because of that.I cant send you the link to the proplematic pen because i cant even open any of the pens on the dashboard. my user name is Clayton Sibanda. i dont know if you guys can help with that

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.