diff --git a/toolkit/components/places/src/nsPlacesExpiration.js b/toolkit/components/places/src/nsPlacesExpiration.js index f35bbaa80e6..8206a679984 100644 --- a/toolkit/components/places/src/nsPlacesExpiration.js +++ b/toolkit/components/places/src/nsPlacesExpiration.js @@ -408,24 +408,29 @@ const EXPIRATION_QUERIES = { function nsPlacesExpiration() { - this._db = Cc["@mozilla.org/browser/nav-history-service;1"]. + ////////////////////////////////////////////////////////////////////////////// + //// Smart Getters + + XPCOMUtils.defineLazyGetter(this, "_db", function () { + let db = Cc["@mozilla.org/browser/nav-history-service;1"]. getService(Ci.nsPIPlacesDatabase). DBConnection; - // Create a temp table for notifications. - this._db.executeSimpleSQL( - "CREATE TEMP TABLE expiration_notify ( " - + " id INTEGER PRIMARY KEY " - + ", v_id INTEGER " - + ", p_id INTEGER " - + ", url TEXT NOT NULL " - + ", visit_date INTEGER " - + ", expected_results INTEGER NOT NULL " - + ")" - ); + // Create the temporary notifications table. + let stmt = db.createAsyncStatement( + "CREATE TEMP TABLE expiration_notify ( " + + " id INTEGER PRIMARY KEY " + + ", v_id INTEGER " + + ", p_id INTEGER " + + ", url TEXT NOT NULL " + + ", visit_date INTEGER " + + ", expected_results INTEGER NOT NULL " + + ") "); + stmt.executeAsync(); + stmt.finalize(); - ////////////////////////////////////////////////////////////////////////////// - //// Smart Getters + return db; + }); XPCOMUtils.defineLazyServiceGetter(this, "_hsn", "@mozilla.org/browser/nav-history-service;1",