Bug 614787 - Delay expiration database setup to the first expiration.

r=dietrich,sdwilsh a=blocking
This commit is contained in:
Marco Bonardo 2010-11-29 21:47:42 +01:00
parent 7d33573bea
commit a3f54fd85f

View File

@ -408,24 +408,29 @@ const EXPIRATION_QUERIES = {
function nsPlacesExpiration() 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). getService(Ci.nsPIPlacesDatabase).
DBConnection; DBConnection;
// Create a temp table for notifications. // Create the temporary notifications table.
this._db.executeSimpleSQL( let stmt = db.createAsyncStatement(
"CREATE TEMP TABLE expiration_notify ( " "CREATE TEMP TABLE expiration_notify ( "
+ " id INTEGER PRIMARY KEY " + " id INTEGER PRIMARY KEY "
+ ", v_id INTEGER " + ", v_id INTEGER "
+ ", p_id INTEGER " + ", p_id INTEGER "
+ ", url TEXT NOT NULL " + ", url TEXT NOT NULL "
+ ", visit_date INTEGER " + ", visit_date INTEGER "
+ ", expected_results INTEGER NOT NULL " + ", expected_results INTEGER NOT NULL "
+ ")" + ") ");
); stmt.executeAsync();
stmt.finalize();
////////////////////////////////////////////////////////////////////////////// return db;
//// Smart Getters });
XPCOMUtils.defineLazyServiceGetter(this, "_hsn", XPCOMUtils.defineLazyServiceGetter(this, "_hsn",
"@mozilla.org/browser/nav-history-service;1", "@mozilla.org/browser/nav-history-service;1",