Bug 1490059 - Also call "session-save" in the SmSaveGlobal case r=stransky

With modern desktop, the difference between SmSaveGlobal and SmSaveLocal has
faded, moreover the libSM documentation states that: "If save_type is
SmSaveGlobal the user wants the client to commit all of its data to permanent,
globally accessible storage.", it's difficult to understand why firefox
wouldn't save its session state in that case.

gnome-session is using SmSaveGlobal when closing the user session, that means
that under GNOME, firefox blocks the closing of the session and complains that
it has crashed on restart.

With this patch, "session-save" is sent in all cases, that means that the two
issues noted in the original bug are fixed.

Differential Revision: https://phabricator.services.mozilla.com/D47500

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Laurent Bigonville 2019-10-01 10:32:09 +00:00
parent a2f5a15e2f
commit d6b35f20ab

View File

@ -326,22 +326,20 @@ void nsNativeAppSupportUnix::SaveYourselfCB(SmcConn smc_conn,
}
bool status = false;
if (save_style != SmSaveGlobal) {
nsCOMPtr<nsISupportsPRBool> didSaveSession =
do_CreateInstance(NS_SUPPORTS_PRBOOL_CONTRACTID);
nsCOMPtr<nsISupportsPRBool> didSaveSession =
do_CreateInstance(NS_SUPPORTS_PRBOOL_CONTRACTID);
if (!didSaveSession) {
SmcSaveYourselfDone(smc_conn, True);
return;
}
// Notify observers to save the session state
didSaveSession->SetData(false);
obsServ->NotifyObservers(didSaveSession, "session-save", nullptr);
didSaveSession->GetData(&status);
if (!didSaveSession) {
SmcSaveYourselfDone(smc_conn, True);
return;
}
// Notify observers to save the session state
didSaveSession->SetData(false);
obsServ->NotifyObservers(didSaveSession, "session-save", nullptr);
didSaveSession->GetData(&status);
// If the interact style permits us to, we are shutting down and we didn't
// manage to (or weren't asked to) save the local state, then notify the user
// in advance that we are doing to quit (assuming that we aren't already