зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1659736 - Move tracking of bookmark roots during IE migration later so the source is clearer. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D88059
This commit is contained in:
Родитель
eeaa6d826f
Коммит
f2e65e077b
|
@ -415,8 +415,6 @@ Bookmarks.prototype = {
|
||||||
migrate: function B_migrate(aCallback) {
|
migrate: function B_migrate(aCallback) {
|
||||||
return (async () => {
|
return (async () => {
|
||||||
// Import to the bookmarks menu.
|
// Import to the bookmarks menu.
|
||||||
this._histogramBookmarkRoots |=
|
|
||||||
MigrationUtils.SOURCE_BOOKMARK_ROOTS_BOOKMARKS_MENU;
|
|
||||||
let folderGuid = PlacesUtils.bookmarks.menuGuid;
|
let folderGuid = PlacesUtils.bookmarks.menuGuid;
|
||||||
await this._migrateFolder(this._favoritesFolder, folderGuid);
|
await this._migrateFolder(this._favoritesFolder, folderGuid);
|
||||||
Services.telemetry
|
Services.telemetry
|
||||||
|
@ -441,6 +439,15 @@ Bookmarks.prototype = {
|
||||||
if (!bookmarks.length) {
|
if (!bookmarks.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!MigrationUtils.isStartupMigration &&
|
!MigrationUtils.isStartupMigration &&
|
||||||
PlacesUtils.getChildCountForFolder(aDestFolderGuid) >
|
PlacesUtils.getChildCountForFolder(aDestFolderGuid) >
|
||||||
|
@ -474,8 +481,6 @@ Bookmarks.prototype = {
|
||||||
entry.parent.equals(this._favoritesFolder);
|
entry.parent.equals(this._favoritesFolder);
|
||||||
if (isBookmarksFolder && entry.isReadable()) {
|
if (isBookmarksFolder && entry.isReadable()) {
|
||||||
// Import to the bookmarks toolbar.
|
// Import to the bookmarks toolbar.
|
||||||
this._histogramBookmarkRoots |=
|
|
||||||
MigrationUtils.SOURCE_BOOKMARK_ROOTS_BOOKMARKS_TOOLBAR;
|
|
||||||
let folderGuid = PlacesUtils.bookmarks.toolbarGuid;
|
let folderGuid = PlacesUtils.bookmarks.toolbarGuid;
|
||||||
await this._migrateFolder(entry, folderGuid);
|
await this._migrateFolder(entry, folderGuid);
|
||||||
PlacesUIUtils.maybeToggleBookmarkToolbarVisibilityAfterMigration();
|
PlacesUIUtils.maybeToggleBookmarkToolbarVisibilityAfterMigration();
|
||||||
|
|
|
@ -13,10 +13,18 @@ add_task(async function() {
|
||||||
// on the actual favorites stored on the local machine's IE favorites database.
|
// 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
|
// As such, we can't assert that bookmarks were migrated to both the bookmarks
|
||||||
// menu and the bookmarks toolbar.
|
// menu and the bookmarks toolbar.
|
||||||
|
let bookmarkRoots = 0;
|
||||||
let itemCount = 0;
|
let itemCount = 0;
|
||||||
let listener = events => {
|
let listener = events => {
|
||||||
for (let event of events) {
|
for (let event of events) {
|
||||||
if (event.itemType == PlacesUtils.bookmarks.TYPE_BOOKMARK) {
|
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++;
|
itemCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,6 +53,17 @@ add_task(async function() {
|
||||||
itemCount,
|
itemCount,
|
||||||
"Ensure telemetry matches actual number of imported items."
|
"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;
|
||||||
|
}
|
||||||
|
info(`Expected ${bookmarkRoots}, got ${snapshot.ie.sum}`);
|
||||||
|
return snapshot.ie.sum == bookmarkRoots;
|
||||||
|
}, "Wait until telemetry is updated");
|
||||||
|
|
||||||
// Check the bookmarks have been imported to all the expected parents.
|
// Check the bookmarks have been imported to all the expected parents.
|
||||||
Assert.ok(observerNotified, "The observer should be notified upon migration");
|
Assert.ok(observerNotified, "The observer should be notified upon migration");
|
||||||
|
|
|
@ -90,10 +90,8 @@ add_task(async function() {
|
||||||
if (!snapshot || !snapshot.safari) {
|
if (!snapshot || !snapshot.safari) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let sum = arr => Object.values(arr).reduce((a, b) => a + b, 0);
|
info(`Expected ${bookmarkRoots}, got ${snapshot.safari.sum}`);
|
||||||
let sumOfValues = sum(snapshot.safari.values);
|
return snapshot.safari.sum == bookmarkRoots;
|
||||||
info(`Expected ${bookmarkRoots}, got ${sumOfValues}`);
|
|
||||||
return sumOfValues == bookmarkRoots;
|
|
||||||
},
|
},
|
||||||
"Wait until telemetry is updated"
|
"Wait until telemetry is updated"
|
||||||
);
|
);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче