Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Purposely Crash Chrome Tab for Chrome Extension

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.

like image 502
Andy Avatar asked Jul 14 '12 10:07

Andy


People also ask

How do I make Google Chrome crash?

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.

How do I crash my school Chromebook?

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.

What is https A /%% 30 30?

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.

Does Chrome have a crash log?

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.


3 Answers

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/

like image 149
Camilo Martin Avatar answered Sep 29 '22 10:09

Camilo Martin


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);
        });
    }
  });
});
like image 44
funroll Avatar answered Sep 29 '22 10:09

funroll


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/
like image 23
gengkev Avatar answered Sep 29 '22 11:09

gengkev