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 '', 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.
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.
Share Improve this question edited Jul 14, 2012 at 11:31 Andy asked Jul 14, 2012 at 10:44 AndyAndy 772 silver badges8 bronze badges 6 | Show 1 more comment5 Answers
Reset to default 7Load 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/
The close methods of the tabs object should do that in an orderly fashion, documentation is here : http://code.google.com/chrome/extensions/tabs.html#method-remove
Cheers, T.
Use following FUN FUN LOOP as described here!
txt = "a";
while(1)
{
txt = txt += "a"; //add as much as the browser can handle
}
//<i>[evil laugh]</i> BOOM! All memory used up, and it is now <b>CRASHED</b>!
"Error during tabs.update: I'm sorry. I'm afraid I can't do that."
. – Rob W Commented Jul 14, 2012 at 11:02