]> khamidou — GitHub mirrors - electron.git/commitdiff
Enable the quitAndInstall to be cancelled by beforeunload handler.
authorCheng Zhao <zcbenz@gmail.com>
Mon, 17 Feb 2014 08:25:00 +0000 (16:25 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 17 Feb 2014 08:25:00 +0000 (16:25 +0800)
browser/api/atom_api_auto_updater.cc
browser/api/lib/auto-updater.coffee
renderer/lib/init.coffee

index b1fe2915d3318d1060db0d9ecf2db58f36755573..6375e19a9218e7f0e01aed66d36ec9377cb8950a 100644 (file)
@@ -81,10 +81,8 @@ void AutoUpdater::QuitAndInstall(
     const v8::FunctionCallbackInfo<v8::Value>& args) {
   AutoUpdater* self = AutoUpdater::Unwrap<AutoUpdater>(args.This());
 
-  if (!self->quit_and_install_.is_null()) {
+  if (!self->quit_and_install_.is_null())
     self->quit_and_install_.Run();
-    self->quit_and_install_.Reset();
-  }
 }
 
 // static
index 39097314978dcba4f4fb081a285da8b570d6bff4..4cd8dc9cb7e9b1120d02475164968f2dbacfb5fb 100644 (file)
@@ -20,9 +20,6 @@ autoUpdater.quitAndInstall = ->
   app = require 'app'
   app.removeAllListeners 'window-all-closed'
   app.once 'window-all-closed', AutoUpdater::quitAndInstall.bind(this)
-
-  # Tell all windows to remove beforeunload handler and then close itself.
-  ipc = require 'ipc'
-  ipc.sendChannel win, 'ATOM_SHELL_SILENT_CLOSE' for win in windows
+  win.close() for win in windows
 
 module.exports = autoUpdater
index 64d9b75af177a813f82290b19c22706312991973..8c061149cd460ca99f953db4804c7beb189d4ae3 100644 (file)
@@ -50,16 +50,6 @@ window.onerror = (error) ->
   else
     false
 
-# Enable browser to close window silently.
-setTimeout ->
-  require('ipc').once 'ATOM_SHELL_SILENT_CLOSE', ->
-    window.onbeforeunload = null
-    window.close()
-
-# Override default window.close.
-window.close = ->
-  require('remote').getCurrentWindow().close()
-
 # Override default window.open.
 window.open = (url, name, features) ->
   options = {}