Bug 1904630 - Remove existing default bookmarks in toolbar to be replaced by a bookmark style configurable messaging surface r=places-reviewers,nalexander,Standard8,fluent-reviewers,flod,tabbrowser-reviewers,extension-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D215429
This commit is contained in:
Meg Viar 2024-07-15 13:49:33 +00:00
Родитель fc2edeec85
Коммит b9b165906a
13 изменённых файлов: 95 добавлений и 46 удалений

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

@ -27,18 +27,7 @@
<h1 data-l10n-id="default-bookmarks-heading">default-bookmarks-heading</h1>
<dl><p>
<dt><h3 personal_toolbar_folder="true" data-l10n-id="default-bookmarks-toolbarfolder">default-bookmarks-toolbarfolder</h3></dt>
<dd data-l10n-id="default-bookmarks-toolbarfolder-description">default-bookmarks-toolbarfolder-description</dd>
#ifndef NIGHTLY_BUILD
#ifdef EARLY_BETA_OR_EARLIER
<dl><p>
<dt><a href="https://www.mozilla.org/firefox/central/" icon="@firefox_icon@" data-l10n-id="default-bookmarks-getting-started">default-bookmarks-getting-started</a></dt>
</dl><p>
#else
<dl><p>
<dt><a href="https://www.mozilla.org/firefox/?utm_medium=firefox-desktop&utm_source=bookmarks-toolbar&utm_campaign=new-users&utm_content=-global" icon="@firefox_icon@" data-l10n-id="default-bookmarks-getting-started">default-bookmarks-getting-started</a></dt>
</dl><p>
#endif
<dt><h3 data-l10n-id="default-bookmarks-firefox-heading">default-bookmarks-firefox-heading</h3></dt>
<dl><p>
<dt><a href="https://support.mozilla.org/products/firefox" icon="@firefox_icon@" data-l10n-id="default-bookmarks-firefox-get-help">default-bookmarks-firefox-get-help</a></dt>
@ -51,11 +40,9 @@
<dt><a href="https://www.mozilla.org/about/" icon="@mozilla_icon@" data-l10n-id="default-bookmarks-firefox-about">default-bookmarks-firefox-about</a></dt>
</dl><p>
#else
<dl><p>
<dt><a href="https://www.mozilla.org/contribute/?utm_medium=firefox-desktop&utm_source=bookmarks-toolbar&utm_campaign=new-users-nightly&utm_content=-global" icon="@mozilla_icon@" data-l10n-id="default-bookmarks-firefox-community">default-bookmarks-firefox-community</a></dt>
</dl><p>
<dt><h3 data-l10n-id="default-bookmarks-nightly-heading">default-bookmarks-nightly-heading</h3></dt>
<dl><p>
<dt><a href="https://www.mozilla.org/contribute/?utm_medium=firefox-desktop&utm_source=bookmarks-toolbar&utm_campaign=new-users-nightly&utm_content=-global" icon="@mozilla_icon@" data-l10n-id="default-bookmarks-firefox-community">default-bookmarks-firefox-community</a></dt>
<dt><a href="https://blog.nightly.mozilla.org/" icon="@mozilla_icon@" data-l10n-id="default-bookmarks-nightly-blog">default-bookmarks-nightly-blog</a></dt>
<dt><a href="https://bugzilla.mozilla.org/" icon="@bugzilla_icon@" shortcuturl="bz" data-l10n-id="default-bookmarks-bugzilla">default-bookmarks-bugzilla</a></dt>
<dt><a href="https://developer.mozilla.org/" icon="@mdn_icon@" shortcuturl="mdn" data-l10n-id="default-bookmarks-mdn">default-bookmarks-mdn</a></dt>

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

@ -269,6 +269,17 @@ add_task(async function testOverflowingBookmarksButtonContextMenu() {
* to the menu from the overflow panel, and then back to the toolbar.
*/
add_task(async function testOverflowingBookmarksItemsContextMenu() {
info("Adding a bookmark to the bookmarks toolbar.");
let addedBookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "Test",
url: "https://example.com",
});
registerCleanupFunction(async () => {
await PlacesUtils.bookmarks.remove(addedBookmark);
});
info("Ensuring panel is ready.");
await PanelUI.ensureReady();

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

@ -693,6 +693,17 @@ function bookmarkContextMenuExtension() {
}
add_task(async function test_bookmark_contextmenu() {
info("Adding a bookmark to the bookmarks toolbar.");
let addedBookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "Test",
url: "https://example.com",
});
registerCleanupFunction(async () => {
await PlacesUtils.bookmarks.remove(addedBookmark);
});
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, PAGE);
await toggleBookmarksToolbar(true);

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

@ -155,6 +155,17 @@ add_task(async function test_actionContextMenus() {
});
add_task(async function test_bookmarkContextMenu() {
info("Adding a bookmark to the bookmarks toolbar.");
let addedBookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "Test",
url: "https://example.com",
});
registerCleanupFunction(async () => {
await PlacesUtils.bookmarks.remove(addedBookmark);
});
const ext = ExtensionTestUtils.loadExtension({
manifest: {
permissions: ["menus", "bookmarks"],

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

@ -74,10 +74,8 @@ class TestReopenFromLibrary(WindowManagerMixin, MarionetteTestCase):
PlacesUtils.bookmarks.virtualToolbarGuid
);
// Bookmarks may be imported and shift the expected one, so search
// for it.
let node;
for (let i = 1; i < window.ContentTree.view.result.root.childCount; ++i) {
for (let i = 0; i < window.ContentTree.view.result.root.childCount; ++i) {
node = window.ContentTree.view.view.nodeForTreeIndex(i);
if (node.uri.endsWith("empty.html")) {
break;

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

@ -31,8 +31,7 @@ updateAppInfo({
platformVersion: "",
});
// Default bookmarks constants.
const DEFAULT_BOOKMARKS_ON_TOOLBAR = 1;
// Default bookmarks constant.
const DEFAULT_BOOKMARKS_ON_MENU = 1;
var createCorruptDB = async function () {

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

@ -36,15 +36,14 @@ add_task(async function () {
// The test will continue once import has finished.
await promiseTopicObserved("places-browser-init-complete");
// Check that default bookmarks have been restored.
// Check that default bookmarks folder has been restored.
let bm = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
parentGuid: PlacesUtils.bookmarks.menuGuid,
index: 0,
});
// Bug 1283076: Nightly bookmark points to Get Involved page, not Getting Started one
let chanTitle = AppConstants.NIGHTLY_BUILD
? "Get Involved"
: "Getting Started";
Assert.equal(bm.title, chanTitle);
? "Firefox Nightly Resources"
: "Mozilla Firefox";
Assert.equal(bm.title, chanTitle, "Default bookmarks folder restored.");
});

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

@ -127,7 +127,7 @@ add_task(async function () {
toolbarItem = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 1 + DEFAULT_BOOKMARKS_ON_TOOLBAR,
index: 1,
});
Assert.equal(toolbarItem.title, "Toolbar Folder After");
Assert.ok(

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

@ -113,13 +113,16 @@ add_task(async function test_restore() {
await simulatePlacesInit();
// Check bookmarks.html has been restored.
Assert.ok(
await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 0,
})
);
// Check default-bookmarks.html has been restored.
let bm = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.menuGuid,
index: 0,
});
let chanTitle = AppConstants.NIGHTLY_BUILD
? "Firefox Nightly Resources"
: "Mozilla Firefox";
Assert.equal(bm.title, chanTitle, "Default bookmarks folder restored.");
// Check preferences have been reverted.
Assert.ok(!Services.prefs.getBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS));
@ -147,13 +150,16 @@ add_task(async function test_restore_import() {
await simulatePlacesInit();
// Check bookmarks.html has been restored.
Assert.ok(
await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 0,
})
);
// Check default-bookmarks.html has been restored.
let bm = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.menuGuid,
index: 0,
});
let chanTitle = AppConstants.NIGHTLY_BUILD
? "Firefox Nightly Resources"
: "Mozilla Firefox";
Assert.equal(bm.title, chanTitle, "Default bookmarks folder restored.");
// Check preferences have been reverted.
Assert.ok(!Services.prefs.getBoolPref(PREF_RESTORE_DEFAULT_BOOKMARKS));

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

@ -25,6 +25,17 @@ add_task(async function test() {
ok(!tab5.multiselected, "Tab5 is not multiselected");
is(gBrowser.multiSelectedTabsCount, 2, "Two multiselected tabs");
info("Adding a bookmark to the bookmarks toolbar.");
let addedBookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "Test",
url: "https://example.com",
});
registerCleanupFunction(async () => {
await PlacesUtils.bookmarks.remove(addedBookmark);
});
// Use getElementsByClassName so the list is live and will update as items change.
let currentBookmarks =
bookmarksToolbar.getElementsByClassName("bookmark-item");

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

@ -26,6 +26,17 @@ async function expectHeightChanges(tab, expectedNewHeightChanges, msg) {
}
async function expectBmToolbarVisibilityChange(triggerFn, visible, msg) {
info("Adding a bookmark to the bookmarks toolbar.");
let addedBookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "Test",
url: "https://example.com",
});
registerCleanupFunction(async () => {
await PlacesUtils.bookmarks.remove(addedBookmark);
});
let collapsedState = BrowserTestUtils.waitForMutationCondition(
BookmarkingUI.toolbar,
{ attributes: true, attributeFilter: ["collapsed"] },

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

@ -9,12 +9,6 @@
default-bookmarks-title = Bookmarks
default-bookmarks-heading = Bookmarks
default-bookmarks-toolbarfolder = Bookmarks Toolbar Folder
default-bookmarks-toolbarfolder-description = Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar
# link title for https://www.mozilla.org/firefox/central/
default-bookmarks-getting-started = Getting Started
# Firefox links folder name
default-bookmarks-firefox-heading = Mozilla Firefox

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

@ -73,6 +73,17 @@ const click = el => {
};
add_task(async function toolbarButtons() {
info("Adding a bookmark to the bookmarks toolbar.");
let addedBookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "Test",
url: "https://example.com",
});
registerCleanupFunction(async () => {
await PlacesUtils.bookmarks.remove(addedBookmark);
});
await BrowserTestUtils.withNewTab("https://example.com", async () => {
let customButton = await new Promise(resolve => {
CustomizableUI.createWidget({