Bug 1152333 - Lots of 'SQL statement should have been finalized' warnings at shutdown. r=ttaubert
authorMarco Bonardo <mbonardo@mozilla.com>
Tue, 28 Apr 2015 17:55:10 +0200
changeset 272989 456bf455bda4a90936f45945111ff75d6087929a
parent 272988 6d355ea89e1ac121209889f72ade35ef516f77dc
child 272990 b92329565994fd07bb9f3ffa57690d931a7fb9b5
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersttaubert
bugs1152333
milestone40.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 1152333 - Lots of 'SQL statement should have been finalized' warnings at shutdown. r=ttaubert
toolkit/components/places/PlacesUtils.jsm
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -2001,16 +2001,22 @@ 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);
       } catch(ex) {
         // It's too late to block shutdown, just close the connection.
         conn.close();
         throw ex;
       }
       resolve(conn);
     });
   })