How do you force Chrome pages/tabs to crash using JavaScript?
FUN FUN LOOP:
txt = "a"; while(1){ txt = txt += "a"; //add as much as the browser can handle } //[evil laugh] BOOM! All memory used up, and it is now CRASHED!
http://jsfiddle.net/DerekL/M45Cn/1/
Sorry for the Chinese characters...
Extra
Fun Fun Loop also works on Firefox!
And I have to give an applause to Safari, because it automatically reload the page when it is about to crash! Good job Webkit developers!
Oh yeah...
WARNING: Don't try it in Internet Explorer... Because it crashed not my browser, instead, it crashed my Windows 7... Yes. I have to restart the computer after that thing.
This is by far the most simple way. Create an Array with the largest number possible for Arrays. This will not take up a computer's memory, but it will crash the page in a number of seconds.
[...Array(2**32-1)]
Let's say that your computer can handle this (it shouldn't). Try this to give your computer more stress:
[...Array(2**32-1)].map(_=>Math.ceil(Math.random()*111))
These can be called from the address bar with:
javascript:[...Array(2**32-1)]
or
javascript:[...Array(2**32-1)].map(_=>Math.ceil(Math.random()*111))
I realize this question is over a year old, but apparently you can use chrome://inducebrowsercrashforrealz
.
Here is a list of additional debug chrome://
URLs, taken from chrome://about
:
chrome://crash
chrome://kill
chrome://hang
chrome://shorthang
chrome://gpuclean
chrome://gpucrash
chrome://gpuhang
chrome://ppapiflashcrash
chrome://ppapiflashhang
chrome://restart