如何使用 JavaScript 强制 Chrome 页面/标签崩溃?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10965987/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 03:49:00  来源:igfitidea点击:

How do you force Chrome pages/tabs to crash using JavaScript?

javascriptgoogle-chromegoogle-chrome-extension

提问by trusktr

Trying to set window.locationor using window.navigate()to make the browser go to about:crashor chrome://crashdoesn't work. Is there a way to do it?

试图设置window.location或使用window.navigate()使浏览器转到about:crashchrome://crash不起作用。有没有办法做到这一点?

回答by u283863

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/

http://jsfiddle.net/DerekL/M45Cn/1/

enter image description here

在此处输入图片说明

Sorry for the Chinese characters...

对不起,汉字...



Extra

额外的

Fun Fun Loop also works on Firefox! enter image description here

Fun Fun Loop 也适用于 Firefox! 在此处输入图片说明

And I have to give an applause to Safari, because it automaticallyreload the page when it is about to crash! Good job Webkit developers!

我不得不为 Safari 鼓掌,因为它会在即将崩溃时自动重新加载页面!Webkit 开发人员干得好!

Oh yeah...

哦耶...

WARNING: Don't try it in Internet Explorer...Because it crashed not my browser, instead, it crashed my Windows 7... enter image description hereYes. I have to restart the computer after that thing.

警告:不要在 Internet Explorer 中尝试它......因为它不是我的浏览器崩溃,而是它使我的 Windows 7 崩溃...... 在此处输入图片说明是的。那件事之后我必须重新启动计算机。

回答by nyuszika7h

I realize this question is over a year old, but apparentlyyou can use chrome://inducebrowsercrashforrealz.

我意识到这个问题已经有一年多了,但显然你可以使用chrome://inducebrowsercrashforrealz.

Here is a list of additional debug chrome://URLs, taken from chrome://about:

以下是其他调试chrome://URL的列表,取自chrome://about

chrome://crash
chrome://kill
chrome://hang
chrome://shorthang
chrome://gpuclean
chrome://gpucrash
chrome://gpuhang
chrome://ppapiflashcrash
chrome://ppapiflashhang
chrome://restart

回答by Danio

Simple enter the following line of code into the chrome address bar to see a Chrome tab crash simulation:

简单的在chrome地址栏中输入下面这行代码,就可以看到一个Chrome选项卡崩溃模拟:

chrome://crash