Add atom.crashMainProcess and atom.crashRenderProcess

This commit is contained in:
Corey Johnson & Nathan Sobo 2013-04-03 15:07:47 -07:00
parent 262e2fe1ec
commit 101605e50f
3 changed files with 14 additions and 1 deletions

View File

@ -87,6 +87,9 @@ bool AtomCefClient::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
else if (name == "getVersion") {
GetVersion(messageId, browser);
}
else if (name == "crash") {
__builtin_trap();
}
else {
return false;
}

View File

@ -24,7 +24,7 @@ namespace v8_extensions {
const char* methodNames[] = {
"writeToPasteboard", "readFromPasteboard", "quit", "watchPath",
"unwatchPath", "getWatchedPaths", "unwatchAllPaths", "moveToTrash",
"reload", "setWindowState", "getWindowState", "beep"
"reload", "setWindowState", "getWindowState", "beep", "crash"
};
CefRefPtr<CefV8Value> nativeObject = CefV8Value::CreateObject(NULL);
@ -166,6 +166,10 @@ namespace v8_extensions {
NSBeep();
}
else if (name == "crash") {
__builtin_trap();
}
return false;
}
};

View File

@ -246,6 +246,12 @@ _.extend atom,
getUpdateStatus: (callback) ->
@sendMessageToBrowserProcess('getUpdateStatus', [], callback)
crashMainProcess: ->
@sendMessageToBrowserProcess('crash')
crashRenderProcess: ->
$native.crash()
requireUserInitScript: ->
userInitScriptPath = fsUtils.join(config.configDirPath, "user.coffee")
try