Bug 1466071: Part 2: Fix aborting flush on normal content shutdown. r=mikedeboer
authorAdam Gashlin <agashlin@mozilla.com>
Fri, 08 Jun 2018 15:16:16 -0700
changeset 422547 56381f46d1d9
parent 422546 2985d2ce41ad
child 422548 cf89498e0dec
push id34138
push userdluca@mozilla.com
push date2018-06-15 02:39 +0000
treeherdermozilla-central@e51f8dbf0397 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer
bugs1466071
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1466071: Part 2: Fix aborting flush on normal content shutdown. r=mikedeboer
browser/components/sessionstore/SessionStore.jsm
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -1621,17 +1621,23 @@ var SessionStoreInternal = {
           // Set up the list of promises that will signal a complete sessionstore
           // shutdown: either all data is saved, or we crashed or the message IPC
           // channel went away in the meantime.
           let promises = [this.flushAllWindowsAsync(progress)];
 
           const observeTopic = topic => {
             let deferred = PromiseUtils.defer();
             const cleanup = () => Services.obs.removeObserver(deferred.resolve, topic);
-            Services.obs.addObserver(deferred.resolve, topic);
+            Services.obs.addObserver(subject => {
+              // Skip abort on ipc:content-shutdown if not abnormal/crashed
+              subject.QueryInterface(Ci.nsIPropertyBag2);
+              if (!(topic == "ipc:content-shutdown" && !subject.get("abnormal"))) {
+                deferred.resolve();
+              }
+            }, topic);
             deferred.promise.then(cleanup, cleanup);
             return deferred;
           };
 
           // Build a list of deferred executions that require cleanup once the
           // Promise race is won.
           // Ensure that the timer fires earlier than the AsyncShutdown crash timer.
           let waitTimeMaxMs = Math.max(0, AsyncShutdown.DELAY_CRASH_MS - 10000);