From 274c9d04b1e463ec4fe4e517d93b74ac52022a20 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 17 Feb 2014 16:25:00 +0800 Subject: [PATCH] Enable the quitAndInstall to be cancelled by beforeunload handler. --- browser/api/atom_api_auto_updater.cc | 4 +--- browser/api/lib/auto-updater.coffee | 5 +---- renderer/lib/init.coffee | 10 ---------- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/browser/api/atom_api_auto_updater.cc b/browser/api/atom_api_auto_updater.cc index b1fe2915d331..6375e19a9218 100644 --- a/browser/api/atom_api_auto_updater.cc +++ b/browser/api/atom_api_auto_updater.cc @@ -81,10 +81,8 @@ void AutoUpdater::QuitAndInstall( const v8::FunctionCallbackInfo& args) { AutoUpdater* self = AutoUpdater::Unwrap(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 diff --git a/browser/api/lib/auto-updater.coffee b/browser/api/lib/auto-updater.coffee index 39097314978d..4cd8dc9cb7e9 100644 --- a/browser/api/lib/auto-updater.coffee +++ b/browser/api/lib/auto-updater.coffee @@ -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 diff --git a/renderer/lib/init.coffee b/renderer/lib/init.coffee index 64d9b75af177..8c061149cd46 100644 --- a/renderer/lib/init.coffee +++ b/renderer/lib/init.coffee @@ -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 = {}