Merge inbound to mozilla-central. a=merge
authorNoemi Erli <nerli@mozilla.com>
Sat, 15 Dec 2018 11:39:40 +0200
changeset 450835 5b0b8a39d09e49efe283b94deba6853e223edad3
parent 450834 10aa1d02448438169fc49d467dd7f9a0fd70ca1f (current diff)
parent 450813 1b960c462dcbb0e6dcf0223e068317845f0f60c4 (diff)
child 450836 4b48d8884cdbf198543623dc3bbb8c6154e48c96
child 450847 00a5c85fba1ecfe9e3af8a02040d990d513890e0
push id110543
push usernerli@mozilla.com
push dateSat, 15 Dec 2018 09:43:22 +0000
treeherdermozilla-inbound@4b48d8884cdb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone66.0a1
first release with
nightly linux32
5b0b8a39d09e / 66.0a1 / 20181215094001 / files
nightly linux64
5b0b8a39d09e / 66.0a1 / 20181215094001 / files
nightly mac
5b0b8a39d09e / 66.0a1 / 20181215094001 / files
nightly win32
5b0b8a39d09e / 66.0a1 / 20181215094001 / files
nightly win64
5b0b8a39d09e / 66.0a1 / 20181215094001 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge inbound to mozilla-central. a=merge
toolkit/mozapps/extensions/internal/AddonTestUtils.jsm
--- a/services/sync/tests/unit/test_bookmark_engine.js
+++ b/services/sync/tests/unit/test_bookmark_engine.js
@@ -40,23 +40,27 @@ async function fetchAllRecordIds() {
   for (let row of rows) {
     let recordId = PlacesSyncUtils.bookmarks.guidToRecordId(
       row.getResultByName("guid"));
     recordIds.add(recordId);
   }
   return recordIds;
 }
 
-async function cleanup(engine, server) {
+async function cleanupEngine(engine) {
+  await engine._tracker.stop();
   await engine._store.wipe();
   await engine.resetClient();
   Svc.Prefs.resetBranch("");
   Service.recordManager.clearCache();
+}
+
+async function cleanup(engine, server) {
   await promiseStopServer(server);
-  await engine._tracker.stop();
+  await cleanupEngine(engine);
 }
 
 add_task(async function setup() {
   await generateNewKeys(Service.collectionKeys);
   await Service.engineManager.unregister("bookmarks");
 
   Service.recordTelemetryEvent = (object, method, value, extra = undefined) => {
     recordedEvents.push({ object, method, value, extra });
@@ -564,16 +568,17 @@ add_task(async function test_mismatched_
     let oldInfo = await PlacesUtils.bookmarks.fetch(oldR.id);
     Assert.equal(oldInfo.type, PlacesUtils.bookmarks.TYPE_FOLDER);
 
     await store.applyIncoming(newR);
     await Assert.rejects(PlacesUtils.promiseItemId(newR.id),
       /no item found for the given GUID/, "Should not apply Livemark");
   } finally {
     await cleanup(engine, server);
+    await engine.finalize();
   }
 });
 
 add_task(async function test_bookmark_guidMap_fail() {
   _("Ensure that failures building the GUID map cause early death.");
 
   let engine = new BookmarksEngine(Service);
   await engine.initialize();
@@ -632,18 +637,18 @@ add_task(async function test_bookmark_gu
   } catch (e) {}
 
   deepEqual(ping.engines.find(e => e.name == "bookmarks").failureReason, {
     name: "unexpectederror",
     error: "Nooo",
   });
 
   PlacesUtils.promiseBookmarksTree = pbt;
-  await PlacesSyncUtils.bookmarks.reset();
-  await promiseStopServer(server);
+  await cleanup(engine, server);
+  await engine.finalize();
 });
 
 add_task(async function test_bookmark_tag_but_no_uri() {
   _("Ensure that a bookmark record with tags, but no URI, doesn't throw an exception.");
 
   let engine = new BookmarksEngine(Service);
   await engine.initialize();
   let store = engine._store;
@@ -680,16 +685,19 @@ add_task(async function test_bookmark_ta
     tags:        ["foo"],
     title:       "Taggy tag",
     type:        "folder",
   });
 
   await store.create(record);
   record.tags = ["bar"];
   await store.update(record);
+
+  await cleanupEngine(engine);
+  await engine.finalize();
 });
 
 add_bookmark_test(async function test_misreconciled_root(engine) {
   _("Ensure that we don't reconcile an arbitrary record with a root.");
 
   let store = engine._store;
   let server = await serverForFoo(engine);
   await SyncTestingInfrastructure(server);
@@ -934,16 +942,17 @@ add_task(async function test_buffer_hasD
     // We should set hasDupe on weakly uploaded records.
     Assert.ok(!record.deleted);
     Assert.ok(record.hasDupe,
       "Buffered bookmark engine should set hasDupe for weakly uploaded records.");
 
     await sync_engine_and_validate_telem(engine, false);
   } finally {
     await cleanup(engine, server);
+    await engine.finalize();
   }
 });
 
 // Bug 890217.
 add_task(async function test_sync_imap_URLs() {
   await Service.recordManager.clearCache();
   await PlacesSyncUtils.bookmarks.reset();
   let engine = new BookmarksEngine(Service);
@@ -991,16 +1000,17 @@ add_task(async function test_sync_imap_U
 
     let bPayload = collection.cleartext("bookmarkBBBB");
     equal(bPayload.bmkUri, "imap://eleven.vs.solnicky.cz:993/" +
       "fetch%3EUID%3E/CURRENT%3E2433?part=1.2&type=text/html&filename=" +
       "TomEdwards.html",
       "Local bookmark B with IMAP URL should exist remotely");
   } finally {
     await cleanup(engine, server);
+    await engine.finalize();
   }
 });
 
 add_task(async function test_resume_buffer() {
   await Service.recordManager.clearCache();
   let engine = new BufferedBookmarksEngine(Service);
   await engine.initialize();
   await engine._store.wipe();
@@ -1085,16 +1095,17 @@ add_task(async function test_resume_buff
     await sync_engine_and_validate_telem(engine, false);
 
     // Check that all the children made it onto the correct record.
     let toolbarRecord = await engine._store.createRecord("toolbar");
     Assert.deepEqual(toolbarRecord.children.sort(), children.sort());
 
   } finally {
     await cleanup(engine, server);
+    await engine.finalize();
   }
 });
 
 add_task(async function test_legacy_migrate_sync_metadata() {
   let legacyEngine = new BookmarksEngine(Service);
   await legacyEngine.initialize();
   await legacyEngine.resetClient();
 
@@ -1125,17 +1136,18 @@ add_task(async function test_legacy_migr
   strictEqual(await legacyEngine.getLastSync(), 0,
     "Changing legacy engine sync ID should clear last sync in Places");
 
   equal(Svc.Prefs.get(`${legacyEngine.name}.syncID`), newSyncID,
     "Changing legacy engine sync ID should update prefs");
   strictEqual(Svc.Prefs.get(`${legacyEngine.name}.lastSync`), "0",
     "Changing legacy engine sync ID should clear last sync pref");
 
-  await legacyEngine.wipeClient();
+  await cleanupEngine(legacyEngine);
+  await legacyEngine.finalize();
 });
 
 add_task(async function test_buffered_migate_sync_metadata() {
   let bufferedEngine = new BufferedBookmarksEngine(Service);
   await bufferedEngine.initialize();
   await bufferedEngine.resetClient();
 
   let syncID = Utils.makeGUID();
@@ -1165,17 +1177,18 @@ add_task(async function test_buffered_mi
   equal(await bufferedEngine.getSyncID(), newSyncID,
     "Changing buffered engine sync ID should update Places");
 
   equal(Svc.Prefs.get(`${bufferedEngine.name}.syncID`), newSyncID,
     "Changing buffered engine sync ID should update prefs");
   strictEqual(Svc.Prefs.get(`${bufferedEngine.name}.lastSync`), "0",
     "Changing buffered engine sync ID should clear last sync pref");
 
-  await bufferedEngine.wipeClient();
+  await cleanupEngine(bufferedEngine);
+  await bufferedEngine.finalize();
 });
 
 // The buffered engine stores the sync ID and last sync time in three places:
 // prefs, Places, and the mirror. We can remove the prefs entirely in bug
 // 1443021, and drop the last sync time from Places once we remove the legacy
 // engine. This test ensures we keep them in sync (^_^), and handle mismatches
 // in case the user copies Places or the mirror between accounts. See
 // bug 1199077, comment 84 for the gory details.
@@ -1266,17 +1279,18 @@ add_task(async function test_mirror_sync
   equal(await PlacesSyncUtils.bookmarks.getSyncId(), newSyncID,
     "Should set new sync ID in Places");
   equal(await buf.getSyncId(), newSyncID,
     "Should update new sync ID in mirror");
 
   strictEqual(await buf.getCollectionHighWaterMark(), 0,
     "Should reset high water mark on sync ID change in Places");
 
-  await bufferedEngine.wipeClient();
+  await cleanupEngine(bufferedEngine);
+  await bufferedEngine.finalize();
 });
 
 add_bookmark_test(async function test_livemarks(engine) {
   _("Ensure we replace new and existing livemarks with tombstones");
 
   let server = await serverForFoo(engine);
   await SyncTestingInfrastructure(server);
 
@@ -1352,17 +1366,17 @@ add_bookmark_test(async function test_li
       type: "livemark",
       feedUri: "http://example.com/c",
       parentName: "unfiled",
       title: "C",
       parentid: "unfiled",
     }), now / 1000);
 
     _("Bump last sync time to ignore A");
-    await engine.setLastSync(Date.now() / 1000 - 60);
+    await engine.setLastSync(now / 1000 - 60);
 
     _("Sync");
     await sync_engine_and_validate_telem(engine, false);
 
     deepEqual(collection.keys().sort(), ["livemarkAAAA", "livemarkBBBB",
       "livemarkCCCC", "menu", "mobile", "toolbar", "unfiled"],
       "Should store original livemark A and tombstones for B and C on server");
 
--- a/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm
@@ -18,21 +18,20 @@ ChromeUtils.import("resource://gre/modul
 ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/Timer.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 const {EventEmitter} = ChromeUtils.import("resource://gre/modules/EventEmitter.jsm", {});
 const {OS} = ChromeUtils.import("resource://gre/modules/osfile.jsm", {});
 
-
 ChromeUtils.defineModuleGetter(this, "AMTelemetry",
                                "resource://gre/modules/AddonManager.jsm");
-ChromeUtils.defineModuleGetter(this, "Extension",
-                               "resource://gre/modules/Extension.jsm");
+ChromeUtils.defineModuleGetter(this, "ExtensionTestCommon",
+                               "resource://testing-common/ExtensionTestCommon.jsm");
 XPCOMUtils.defineLazyGetter(this, "Management", () => {
   let {Management} = ChromeUtils.import("resource://gre/modules/Extension.jsm", {});
   return Management;
 });
 
 ChromeUtils.defineModuleGetter(this, "FileTestUtils",
                                "resource://testing-common/FileTestUtils.jsm");
 ChromeUtils.defineModuleGetter(this, "HttpServer",
@@ -1127,21 +1126,21 @@ var AddonTestUtils = {
   },
 
   /**
    * Creates an XPI file for some WebExtension data in the temporary directory and
    * returns the nsIFile for it. The file will be deleted when the test completes.
    *
    * @param {Object} data
    *        The object holding data about the add-on, as expected by
-   *        |Extension.generateXPI|.
+   *        |ExtensionTestCommon.generateXPI|.
    * @return {nsIFile} A file pointing to the created XPI file
    */
   createTempWebExtensionFile(data) {
-    let file = Extension.generateXPI(data);
+    let file = ExtensionTestCommon.generateXPI(data);
     this.tempXPIs.push(file);
     return file;
   },
 
   /**
    * Creates an XPI with the given files and installs it.
    *
    * @param {object} files