Bug 1413989 - include Timer.jsm in MigrationUtils.jsm r=MattN
authorDoug Thayer <dothayer@mozilla.com>
Tue, 07 Nov 2017 15:48:02 -0800
changeset 444059 d0280b48ef5828a886d582c4162835b694ccafd3
parent 444058 6646fb7959a8c7c78179fa09b6522b7a0f805f97
child 444060 cae09668c272af64a2726a60a224ef7378442844
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1413989
milestone58.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 1413989 - include Timer.jsm in MigrationUtils.jsm r=MattN setTimeout was previously undefined. Created a test specifically for MigrationUtils, since trying to test this through an actual Chrome migration path seemed trickier and more fragile. MozReview-Commit-ID: 33U7ZzzG1CC
browser/components/migration/MigrationUtils.jsm
browser/components/migration/tests/unit/test_MigrationUtils_timedRetry.js
browser/components/migration/tests/unit/xpcshell.ini
--- a/browser/components/migration/MigrationUtils.jsm
+++ b/browser/components/migration/MigrationUtils.jsm
@@ -30,16 +30,18 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 XPCOMUtils.defineLazyModuleGetter(this, "ResponsivenessMonitor",
                                   "resource://gre/modules/ResponsivenessMonitor.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "Sqlite",
                                   "resource://gre/modules/Sqlite.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
                                   "resource://gre/modules/TelemetryStopwatch.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "WindowsRegistry",
                                   "resource://gre/modules/WindowsRegistry.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "setTimeout",
+                                  "resource://gre/modules/Timer.jsm");
 
 var gMigrators = null;
 var gProfileStartup = null;
 var gMigrationBundle = null;
 var gPreviousDefaultBrowserKey = "";
 
 let gKeepUndoData = false;
 let gUndoData = null;
new file mode 100644
--- /dev/null
+++ b/browser/components/migration/tests/unit/test_MigrationUtils_timedRetry.js
@@ -0,0 +1,26 @@
+"use strict";
+
+XPCOMUtils.defineLazyModuleGetter(this, "OS",
+                                  "resource://gre/modules/osfile.jsm");
+
+let tmpFile = FileUtils.getDir("TmpD", [], true);
+let dbConn;
+
+add_task(async function setup() {
+  tmpFile.append("TestDB");
+  dbConn = await Sqlite.openConnection({ path: tmpFile.path });
+
+  do_register_cleanup(() => {
+    dbConn.close();
+    OS.File.remove(tmpFile.path);
+  });
+});
+
+add_task(async function testgetRowsFromDBWithoutLocksRetries() {
+  let promise = MigrationUtils.getRowsFromDBWithoutLocks(tmpFile.path,
+                                                         "Temp DB",
+                                                         "SELECT * FROM moz_temp_table");
+  await new Promise(resolve => do_timeout(50, resolve));
+  dbConn.execute("CREATE TABLE moz_temp_table (id INTEGER PRIMARY KEY)");
+  await promise;
+});
--- a/browser/components/migration/tests/unit/xpcshell.ini
+++ b/browser/components/migration/tests/unit/xpcshell.ini
@@ -18,10 +18,11 @@ skip-if = os != "win"
 skip-if = os != "win"
 [test_fx_telemetry.js]
 [test_IE_bookmarks.js]
 skip-if = !(os == "win" && bits == 64) # bug 1392396
 [test_IE_cookies.js]
 skip-if = os != "win"
 [test_IE7_passwords.js]
 skip-if = os != "win"
+[test_MigrationUtils_timedRetry.js]
 [test_Safari_bookmarks.js]
 skip-if = os != "mac"