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 422537 56381f46d1d93f0f0f72a5dafdefc8e00a23c5bd
parent 422536 2985d2ce41ad650a55e3b4204fe5e483d2e56b1f
child 422538 cf89498e0dec1ca39b4e0c35b1f83263d6c823bb
push id104286
push userrgurzau@mozilla.com
push dateThu, 14 Jun 2018 15:25:50 +0000
treeherdermozilla-inbound@cf89498e0dec [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);