Bug 1739498 - Prevent usage of incompatible address book files. r=darktrojan
☠☠ backed out by e46a1e093353 ☠ ☠
authorJohn Bieling <john@thunderbird.net>
Fri, 21 Jan 2022 23:06:15 +0200
changeset 34822 59927c5a3a79c6157330a03b36751bbe2b794da7
parent 34821 dbd39cc59f3fef2813fd831fa926a084e558cfa3
child 34823 2c9930e8b2201b26fe1c5e7a41206f770f3c85c4
push id19582
push usermkmelin@iki.fi
push dateFri, 21 Jan 2022 21:07:32 +0000
treeherdercomm-central@2c9930e8b220 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdarktrojan
bugs1739498
Bug 1739498 - Prevent usage of incompatible address book files. r=darktrojan Differential Revision: https://phabricator.services.mozilla.com/D136269
mailnews/addrbook/modules/SQLiteDirectory.jsm
--- a/mailnews/addrbook/modules/SQLiteDirectory.jsm
+++ b/mailnews/addrbook/modules/SQLiteDirectory.jsm
@@ -168,16 +168,18 @@ class SQLiteDirectory extends AddrBookDi
       file.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o644);
     }
 
     this._fileName = fileName;
 
     super.init(uri);
 
     directories.set(fileName, this);
+    // Create the DB connection here already, to let init() throw on corrupt SQLite files.
+    this._dbConnection;
   }
   async cleanUp() {
     await super.cleanUp();
 
     if (this.hasOwnProperty("_file")) {
       await closeConnectionTo(this._file);
       delete this._file;
     }