“There are only two kinds of programming languages: those people always bitch about and those nobody uses.”
-Bjarne Stroustrup
Netscape
[FF]ucking up Firefox
Tue, 01/19/2010 - 14:55 | by cazlab -The other day I was contemplating recursion and wondered just how destructive it might be when misused in a web browser.
I spent the weekend experimenting with different was to crash a web browser by "infinite looping as hard as you can." A straight while(true){...} got noticed but Firefox and Chrome and as such, were not run. However using a simple recursive function got a around this, and that was left was to do was to fill up memory and spawn lots of extra processes:
function ffuck(bar)
{
setTimeout("window.open('[FF]uck.php')",Math.random()*1000);
document.all[0].innerHTML = (bar+"uck");
bar += bar;
return ffuck(bar);
}
ffuck("f");
The results of this were varied: in Firefox the host operating system would grind to a halt while Firefox slowly shat itself to death. Chrome would slow to a crawl, eventually producing its "unhappy tab" icon. IE8 did a very strange thing and attempted to download the file itself rather than render it.
Now I wondered if a normal recursive function could be so incredibly disruptive to browser behavior what would happen to an recursively increasing feedback loop? That's an experiment for another time.
