Bug 1260461 - Don't flush windows when shutting down due to a Windows log-out. r=jimm

MozReview-Commit-ID: 3WWgPTxzdcz

--HG--
extra : rebase_source : ffd5bc1a26e46244b42de9bc4d318dd43475b6e1
This commit is contained in:
Mike Conley 2016-04-01 17:15:37 -04:00
Родитель ee336d6356
Коммит 8a91920ae9
2 изменённых файлов: 15 добавлений и 7 удалений

Просмотреть файл

@ -639,7 +639,8 @@ var SessionStoreInternal = {
this.onClose(aSubject);
break;
case "quit-application-granted":
this.onQuitApplicationGranted();
let syncShutdown = aData == "syncShutdown";
this.onQuitApplicationGranted(syncShutdown);
break;
case "browser-lastwindow-close-granted":
this.onLastWindowCloseGranted();
@ -1422,7 +1423,7 @@ var SessionStoreInternal = {
/**
* On quit application granted
*/
onQuitApplicationGranted: function ssi_onQuitApplicationGranted() {
onQuitApplicationGranted: function ssi_onQuitApplicationGranted(syncShutdown=false) {
// Collect an initial snapshot of window data before we do the flush
this._forEachBrowserWindow((win) => {
this._collectWindowData(win);
@ -1440,10 +1441,16 @@ var SessionStoreInternal = {
// tabs correctly.
RunState.setQuitting();
AsyncShutdown.quitApplicationGranted.addBlocker(
"SessionStore: flushing all windows",
this.flushAllWindowsAsync(progress),
() => progress);
if (!syncShutdown) {
// We've got some time to shut down, so let's do this properly.
AsyncShutdown.quitApplicationGranted.addBlocker(
"SessionStore: flushing all windows",
this.flushAllWindowsAsync(progress),
() => progress);
} else {
// We have to shut down NOW, which means we only get to save whatever
// we already had cached.
}
},
/**

Просмотреть файл

@ -4792,7 +4792,8 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
nsCOMPtr<nsIObserverService> obsServ =
mozilla::services::GetObserverService();
NS_NAMED_LITERAL_STRING(context, "shutdown-persist");
obsServ->NotifyObservers(nullptr, "quit-application-granted", nullptr);
NS_NAMED_LITERAL_STRING(syncShutdown, "syncShutdown");
obsServ->NotifyObservers(nullptr, "quit-application-granted", syncShutdown.get());
obsServ->NotifyObservers(nullptr, "quit-application-forced", nullptr);
obsServ->NotifyObservers(nullptr, "quit-application", nullptr);
obsServ->NotifyObservers(nullptr, "profile-change-net-teardown", context.get());