From f916ec87b2bf35f8e435dee29fe1a2327e23c5d1 Mon Sep 17 00:00:00 2001 From: Razvan Maries Date: Tue, 25 Aug 2020 21:04:59 +0300 Subject: [PATCH] Backed out changeset 538c51598420 (bug 1659736) for perma failures on test_IE_bookmarks.js. CLOSED TREE --- .../components/migration/MSMigrationUtils.jsm | 21 +++++++------------ .../migration/tests/unit/test_IE_bookmarks.js | 21 ------------------- 2 files changed, 8 insertions(+), 34 deletions(-) diff --git a/browser/components/migration/MSMigrationUtils.jsm b/browser/components/migration/MSMigrationUtils.jsm index 8c02f602065d..87b936d662ad 100644 --- a/browser/components/migration/MSMigrationUtils.jsm +++ b/browser/components/migration/MSMigrationUtils.jsm @@ -414,10 +414,11 @@ Bookmarks.prototype = { _histogramBookmarkRoots: 0, migrate: function B_migrate(aCallback) { return (async () => { - await this._migrateFolder( - this._favoritesFolder, - PlacesUtils.bookmarks.menuGuid - ); + // Import to the bookmarks menu. + this._histogramBookmarkRoots |= + MigrationUtils.SOURCE_BOOKMARK_ROOTS_BOOKMARKS_MENU; + let folderGuid = PlacesUtils.bookmarks.menuGuid; + await this._migrateFolder(this._favoritesFolder, folderGuid); Services.telemetry .getKeyedHistogramById("FX_MIGRATION_BOOKMARKS_ROOTS") .add( @@ -450,15 +451,6 @@ Bookmarks.prototype = { aDestFolderGuid ); } - - if (aDestFolderGuid == PlacesUtils.bookmarks.menuGuid) { - this._histogramBookmarkRoots |= - MigrationUtils.SOURCE_BOOKMARK_ROOTS_BOOKMARKS_MENU; - } else if (aDestFolderGuid == PlacesUtils.bookmarks.toolbarGuid) { - this._histogramBookmarkRoots |= - MigrationUtils.SOURCE_BOOKMARK_ROOTS_BOOKMARKS_TOOLBAR; - } - await MigrationUtils.insertManyBookmarksWrapper(bookmarks, aDestFolderGuid); }, @@ -481,6 +473,9 @@ Bookmarks.prototype = { entry.leafName == this._toolbarFolderName && entry.parent.equals(this._favoritesFolder); if (isBookmarksFolder && entry.isReadable()) { + // Import to the bookmarks toolbar. + this._histogramBookmarkRoots |= + MigrationUtils.SOURCE_BOOKMARK_ROOTS_BOOKMARKS_TOOLBAR; let folderGuid = PlacesUtils.bookmarks.toolbarGuid; await this._migrateFolder(entry, folderGuid); PlacesUIUtils.maybeToggleBookmarkToolbarVisibilityAfterMigration(); diff --git a/browser/components/migration/tests/unit/test_IE_bookmarks.js b/browser/components/migration/tests/unit/test_IE_bookmarks.js index 1d199e314d87..57e508c6e524 100644 --- a/browser/components/migration/tests/unit/test_IE_bookmarks.js +++ b/browser/components/migration/tests/unit/test_IE_bookmarks.js @@ -13,18 +13,10 @@ add_task(async function() { // on the actual favorites stored on the local machine's IE favorites database. // As such, we can't assert that bookmarks were migrated to both the bookmarks // menu and the bookmarks toolbar. - let bookmarkRoots = 0; let itemCount = 0; let listener = events => { for (let event of events) { if (event.itemType == PlacesUtils.bookmarks.TYPE_BOOKMARK) { - if (event.parentGuid == PlacesUtils.bookmarks.toolbarGuid) { - bookmarkRoots |= - MigrationUtils.SOURCE_BOOKMARK_ROOTS_BOOKMARKS_TOOLBAR; - } else if (event.parentGuid == PlacesUtils.bookmarks.menuGuid) { - bookmarkRoots |= MigrationUtils.SOURCE_BOOKMARK_ROOTS_BOOKMARKS_MENU; - } - info("bookmark added: " + event.parentGuid); itemCount++; } } @@ -53,19 +45,6 @@ add_task(async function() { itemCount, "Ensure telemetry matches actual number of imported items." ); - await TestUtils.waitForCondition(() => { - let snapshot = Services.telemetry.getSnapshotForKeyedHistograms( - "main", - false - ).parent.FX_MIGRATION_BOOKMARKS_ROOTS; - if (!snapshot || !snapshot.ie) { - return false; - } - let sum = arr => Object.values(arr).reduce((a, b) => a + b, 0); - let sumOfValues = sum(snapshot.ie.values); - info(`Expected ${bookmarkRoots}, got ${sumOfValues}`); - return sumOfValues == bookmarkRoots; - }, "Wait until telemetry is updated"); // Check the bookmarks have been imported to all the expected parents. Assert.ok(observerNotified, "The observer should be notified upon migration");