Hi I'm creating a Chrome extension to purposely crash a Chrome tab. My methods are not working the way I would like. I am trying:
chrome.tabs.update({url: "about:crash"});
chrome.tabs.update({url: "chrome://crash"});
window.location = 'about:crash';
window.location = 'chrome://crash';
None of these work.
However if I replace the URL with something like 'about:blank' or 'http://google.com', it works!
Does Chrome have some sort of security measure in place, if so... any suggestions for a work around?
I would like to avoid overloading the memory with infinite loops if possible.
Google's Chrome browser can be crashed by typing in, clicking on, or even just hovering a mouse cursor over a 16-character link. The flaw will either crash individual Chrome tabs or the whole Chrome browser.
Type chrome://inducebrowsercrashforrealz/ in the URL bar. This is a built-in debugging link that simulates a browser crash. Keep in mind that this will crash the Chromebook, so you will lose any unsaved work.
http://a/%%30%30 is decoded as http://a/%00 because %30 is 0. http://a/%00 is then further decoded by another piece of code as http://a/<NULL> because %00 is the NULL character. The bug was originally demonstrated by Andris Atteka who simply added a null character to the string.
If crash reporting is enabled, browse to chrome://crashes to find the crash IDs and file a bug. If you have problems with Chrome on a Microsoft® Windows® device, use Windows Process Explorer logs to gather details about how Chrome interacts with Windows.
Load chrome://kill
on the tab.
For example, to kill this tab on chrome, enter chrome://kill
in the URL bar and hit enter.
Extra fun as of Chrome 20: chrome://favicon/size/1/http://gonna.crash.you/
Got this working and packaged up as an extension. Here's the relevant code:
// Called when the user clicks on the browser action.
chrome.browserAction.onClicked.addListener(function(tab) {
queryInfo = new Object();
chrome.tabs.query(queryInfo, function(result) {
var i;
for (i=0; i < result.length; i += 1) {
chrome.experimental.processes.getProcessIdForTab(result[i].id, function(processId) {
chrome.experimental.processes.terminate(processId);
});
}
});
});
With the experimental processes API, you can end processes, including those that belong to tabs.
I have thought of that exact same use case - if you ever complete your extension I'd like to try it!
Though maybe a better idea for now could be for your background page could redirect tabs to a data uri based on the page, such as
data:text/html,<a href="http://www.google.com/">click here to restore</a>
or maybe an extension page that generates pages based on its query parameters:
my_extension_page.html?url=http://www.google.com/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With