Bug 1091851 - Make sure that Places connections are closed timely. r=mak
authorDavid Rajchenbach-Teller <dteller@mozilla.com>
Wed, 03 Jun 2015 23:02:36 +0200
changeset 279769 1fba04d83168ca517ecaf5c295795fefa17c8cda
parent 279768 601d3d227be1c9d27a3956064a21e144e03cea0d
child 279770 ca501a8670191f5466e8b9cbbe898d7df47e36db
push id897
push userjlund@mozilla.com
push dateMon, 14 Sep 2015 18:56:12 +0000
treeherdermozilla-release@9411e2d2b214 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1091851
milestone41.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 1091851 - Make sure that Places connections are closed timely. r=mak
toolkit/components/places/PlacesUtils.jsm
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -2066,16 +2066,19 @@ XPCOMUtils.defineLazyGetter(this, "gAsyn
     Sqlite.cloneStorageConnection({
       connection: PlacesUtils.history.DBConnection,
       readOnly:   true
     }).then(conn => {
       try {
         Sqlite.shutdown.addBlocker(
           "PlacesUtils read-only connection closing",
           conn.close.bind(conn));
+        PlacesUtils.history.shutdownClient.jsclient.addBlocker(
+          "PlacesUtils read-only connection closing",
+          conn.close.bind(conn));
       } catch(ex) {
         // It's too late to block shutdown, just close the connection.
         conn.close();
         throw ex;
       }
       resolve(conn);
     });
   })
@@ -2085,22 +2088,19 @@ XPCOMUtils.defineLazyGetter(this, "gAsyn
   () => new Promise((resolve) => {
     Sqlite.wrapStorageConnection({
       connection: PlacesUtils.history.DBConnection,
     }).then(conn => {
       try {
         Sqlite.shutdown.addBlocker(
           "PlacesUtils wrapped connection closing",
           conn.close.bind(conn));
-
-        // Also ensure we close the wrapper in case Places shutdowns first.
-        Services.obs.addObserver(function observe() {
-          Services.obs.removeObserver(observe, "places-will-close-connection");
-          conn.close();
-        }, "places-will-close-connection", false);
+        PlacesUtils.history.shutdownClient.jsclient.addBlocker(
+          "PlacesUtils wrapped connection closing",
+          conn.close.bind(conn));
       } catch(ex) {
         // It's too late to block shutdown, just close the connection.
         conn.close();
         throw ex;
       }
       resolve(conn);
     });
   })