Bug 1674091 - Don't update the state of the Other Bookmarks shortcut folder if the personal-bookmarks item has been placed in the palette. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D96764
This commit is contained in:
Jared Wein 2020-11-12 21:23:54 +00:00
Родитель 3c8613ae90
Коммит 34cd6804d1
2 изменённых файлов: 29 добавлений и 3 удалений

Просмотреть файл

@ -2318,19 +2318,21 @@ var BookmarkingUI = {
},
async maybeShowOtherBookmarksFolder() {
// otherBookmarks may be null if personal-bookmarks is in the palette.
let otherBookmarks = document.getElementById("OtherBookmarks");
// Only show the "Other Bookmarks" folder in the toolbar if pref is enabled.
if (!gBookmarksToolbar2h2020) {
if (!gBookmarksToolbar2h2020 || !otherBookmarks) {
return;
}
let unfiledGuid = PlacesUtils.bookmarks.unfiledGuid;
let numberOfBookmarks = PlacesUtils.getChildCountForFolder(unfiledGuid);
let otherBookmarks = document.getElementById("OtherBookmarks");
let placement = CustomizableUI.getPlacementOfWidget("personal-bookmarks");
if (
numberOfBookmarks > 0 &&
placement.area == CustomizableUI.AREA_BOOKMARKS
placement?.area == CustomizableUI.AREA_BOOKMARKS
) {
let otherBookmarksPopup = document.getElementById("OtherBookmarksPopup");
let result = PlacesUtils.getFolderContents(unfiledGuid);

Просмотреть файл

@ -219,6 +219,30 @@ add_task(async function testDeletingMenuItems() {
await closeMenuPopup("#OtherBookmarksPopup");
});
add_task(async function no_errors_when_bookmarks_placed_in_palette() {
CustomizableUI.removeWidgetFromArea("personal-bookmarks");
let consoleErrors = 0;
let errorListener = {
observe(error) {
ok(false, error.message);
consoleErrors++;
},
};
Services.console.registerListener(errorListener);
let bookmarks = await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.unfiledGuid,
children: bookmarksInfo,
});
is(consoleErrors, 0, "There should be no console errors");
Services.console.unregisterListener(errorListener);
await PlacesUtils.bookmarks.remove(bookmarks);
CustomizableUI.reset();
});
/**
* Tests whether or not the "Other Bookmarks" folder is visible.
*/