So it's not the loop -- it's the printing of a lot of data really fast. Here's an infinite loop with a small sleep with no issue in it: https://repl.it/@amasad/forever
It's funny, it's both a regression and an improvement. We started using XTerm.js with a PTY[1] and we stopped throttling output[2] which reintroduces the "browser locking up from too much output" bug. We'll need to introduce backpressure.