mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Show prompt to force closing window when window is frozen.
Fixed atom/atom-shell#17.
This commit is contained in:
@@ -247,7 +247,7 @@ class AtomApplication
|
||||
if pidToKillWhenClosed?
|
||||
@pidsToOpenWindows[pidToKillWhenClosed] = openedWindow
|
||||
|
||||
openedWindow.browserWindow.on 'closed', =>
|
||||
openedWindow.browserWindow.on 'destroyed', =>
|
||||
for pid, trackedWindow of @pidsToOpenWindows when trackedWindow is openedWindow
|
||||
try
|
||||
process.kill(pid)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
BrowserWindow = require 'browser-window'
|
||||
dialog = require 'dialog'
|
||||
ipc = require 'ipc'
|
||||
|
||||
module.exports =
|
||||
@@ -21,6 +22,14 @@ class AtomWindow
|
||||
@browserWindow.on 'destroyed', =>
|
||||
global.atomApplication.removeWindow(this)
|
||||
|
||||
@browserWindow.on 'unresponsive', =>
|
||||
chosen = dialog.showMessageBox
|
||||
type: 'warning'
|
||||
buttons: ['Close', 'Keep Waiting']
|
||||
message: 'Editor window is frozen'
|
||||
detail: "The editor window becomes frozen because of JavaScript dead loop, you can force closing it or just keep waiting."
|
||||
@browserWindow.destroy() if chosen is 0
|
||||
|
||||
if @isSpec
|
||||
# Spec window's web view should always have focus
|
||||
@browserWindow.on 'blur', =>
|
||||
|
||||
Reference in New Issue
Block a user