Reputation: 1001
I want to crash the chrome url in a separate window for my application testing purpose, But the below piece of code gives me 'Not allowed to load local resource' error.
Is there any way I can launch the chrome crash url through window.open without receiving the error ?
Here is what I tried :
<html>
<head>
<title>Sample Test</title>
<script type="text/javascript">
function crashTest() {
window.open("chrome://inducebrowsercrashforrealz", "windowInMyApp", "left=50, top=100, width=600, height=400, toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
}
</script>
</head>
<body>
<div>
<br />
<button onclick="crashTest();">Navigate</button>
</div>
</body>
</html>
Upvotes: 0
Views: 628
Reputation: 73836
chrome://
URLs intentionally.
A chrome extension can send Browser.crash
command via chrome.debugger API.
manifest.json excerpt:
"permissions": ["debugger"]
browser_action's popup.js or background.js:
chrome.tabs.create({url: 'about:blank', active: false}, ({id: tabId}) => {
chrome.debugger.attach({tabId}, '1.3', () => {
chrome.debugger.sendCommand({tabId}, 'Browser.crash');
});
});
The same command can be sent by an external CDP tool like puppeteer (example).
Upvotes: 2