зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1692668 - Update bookmarks context menu for clarity. r=Gijs,fluent-reviewers,flod
Differential Revision: https://phabricator.services.mozilla.com/D106046
This commit is contained in:
Родитель
dc5c1a0789
Коммит
7563ded7df
|
@ -1688,7 +1688,7 @@ var BookmarkingUI = {
|
|||
|
||||
// Used by the Places context menu in the Bookmarks Toolbar
|
||||
// when nothing is selected
|
||||
menu.setAttribute("selectiontype", "none");
|
||||
menu.setAttribute("selectiontype", "none|single");
|
||||
|
||||
MozXULElement.insertFTLIfNeeded("browser/toolbarContextMenu.ftl");
|
||||
let menuItems = [
|
||||
|
|
|
@ -260,6 +260,9 @@ PlacesViewBase.prototype = {
|
|||
);
|
||||
existingOtherBookmarksItem?.remove();
|
||||
|
||||
let manageBookmarksMenu = aPopup.querySelector(
|
||||
"#placesContext_showAllBookmarks"
|
||||
);
|
||||
// Add the View menu for the Bookmarks Toolbar and "Show Other Bookmarks" menu item
|
||||
// if the click originated from the Bookmarks Toolbar.
|
||||
if (gBookmarksToolbar2h2020) {
|
||||
|
@ -267,13 +270,16 @@ PlacesViewBase.prototype = {
|
|||
existingSubmenu?.remove();
|
||||
let bookmarksToolbar = document.getElementById("PersonalToolbar");
|
||||
if (bookmarksToolbar?.contains(aPopup.triggerNode)) {
|
||||
manageBookmarksMenu.removeAttribute("hidden");
|
||||
|
||||
let menu = BookmarkingUI.buildBookmarksToolbarSubmenu(bookmarksToolbar);
|
||||
aPopup.appendChild(menu);
|
||||
aPopup.insertBefore(menu, manageBookmarksMenu);
|
||||
|
||||
if (
|
||||
aPopup.triggerNode.id === "OtherBookmarks" ||
|
||||
aPopup.triggerNode.id === "PlacesChevron" ||
|
||||
aPopup.triggerNode.id === "PlacesToolbarItems"
|
||||
aPopup.triggerNode.id === "PlacesToolbarItems" ||
|
||||
aPopup.triggerNode.parentNode.id === "PlacesToolbarItems"
|
||||
) {
|
||||
let otherBookmarksMenuItem = BookmarkingUI.buildShowOtherBookmarksMenuItem();
|
||||
|
||||
|
@ -284,7 +290,11 @@ PlacesViewBase.prototype = {
|
|||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
manageBookmarksMenu.setAttribute("hidden", "true");
|
||||
}
|
||||
} else {
|
||||
manageBookmarksMenu.setAttribute("hidden", "true");
|
||||
}
|
||||
|
||||
return this.controller.buildContextMenu(aPopup);
|
||||
|
|
|
@ -549,6 +549,8 @@ PlacesController.prototype = {
|
|||
* true if it should be hidden inside the private browsing mode
|
||||
* 9) The "forcehideintabbrowser" attribute may be set on a menu-item if
|
||||
* it should be hidden when we're in a tabbed browsing window.
|
||||
* 10) The "forcehidenotintabbrowser" attribute may be set on a menu-item if
|
||||
* it should be hidden when we're not in a tabbed browsing window.
|
||||
* @param aPopup
|
||||
* The menupopup to build children into.
|
||||
* @return true if at least one item is visible, false otherwise.
|
||||
|
@ -587,12 +589,16 @@ PlacesController.prototype = {
|
|||
var hideIfInTabBrowser =
|
||||
item.getAttribute("forcehideintabbrowser") == "true" &&
|
||||
window.top.gBrowser;
|
||||
var hideIfNotInTabBrowser =
|
||||
item.getAttribute("forcehidenotintabbrowser") == "true" &&
|
||||
!window.top.gBrowser;
|
||||
var hideIfPrivate =
|
||||
item.getAttribute("hideifprivatebrowsing") == "true" &&
|
||||
PrivateBrowsingUtils.isWindowPrivate(window);
|
||||
var shouldHideItem =
|
||||
hideIfNoIP ||
|
||||
hideIfInTabBrowser ||
|
||||
hideIfNotInTabBrowser ||
|
||||
hideIfPrivate ||
|
||||
!this._shouldShowMenuItem(item, metadata);
|
||||
item.hidden = item.disabled = shouldHideItem;
|
||||
|
@ -621,20 +627,32 @@ PlacesController.prototype = {
|
|||
// New separator, count again:
|
||||
visibleItemsBeforeSep = false;
|
||||
}
|
||||
|
||||
if (item.id === "placesContext_deleteBookmark") {
|
||||
document.l10n.setAttributes(item, "places-remove-bookmark", {
|
||||
count: metadata.length,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Set Open Folder/Links In Tabs items enabled state if they're visible
|
||||
// Set Open Folder/Links In Tabs or Open Bookmark item's enabled state if they're visible
|
||||
if (usableItemCount > 0) {
|
||||
var openContainerInTabsItem = document.getElementById(
|
||||
let openContainerInTabsItem = document.getElementById(
|
||||
"placesContext_openContainer:tabs"
|
||||
);
|
||||
if (!openContainerInTabsItem.hidden) {
|
||||
var containerToUse = this._view.selectedNode || this._view.result.root;
|
||||
if (PlacesUtils.nodeIsContainer(containerToUse)) {
|
||||
if (!PlacesUtils.hasChildURIs(containerToUse)) {
|
||||
openContainerInTabsItem.disabled = true;
|
||||
// Ensure that we don't display the menu if nothing is enabled:
|
||||
usableItemCount--;
|
||||
let openBookmarksItem = document.getElementById(
|
||||
"placesContext_openBookmarkContainer:tabs"
|
||||
);
|
||||
for (let menuItem of [openContainerInTabsItem, openBookmarksItem]) {
|
||||
if (!menuItem.hidden) {
|
||||
var containerToUse =
|
||||
this._view.selectedNode || this._view.result.root;
|
||||
if (PlacesUtils.nodeIsContainer(containerToUse)) {
|
||||
if (!PlacesUtils.hasChildURIs(containerToUse)) {
|
||||
menuItem.disabled = true;
|
||||
// Ensure that we don't display the menu if nothing is enabled:
|
||||
usableItemCount--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -229,10 +229,12 @@ var PlacesOrganizer = {
|
|||
}
|
||||
}
|
||||
|
||||
// remove the "Properties" context-menu item, we've our own details pane
|
||||
document
|
||||
.getElementById("placesContext")
|
||||
.removeChild(document.getElementById("placesContext_show:info"));
|
||||
// remove the "Edit" and "Edit Bookmark" context-menu item, we're in our own details pane
|
||||
let contextMenu = document.getElementById("placesContext");
|
||||
contextMenu.removeChild(document.getElementById("placesContext_show:info"));
|
||||
contextMenu.removeChild(
|
||||
document.getElementById("placesContext_show_bookmark:info")
|
||||
);
|
||||
|
||||
if (!Services.policies.isAllowed("profileImport")) {
|
||||
document
|
||||
|
|
|
@ -177,13 +177,13 @@
|
|||
<menupopup id="organizeButtonPopup">
|
||||
<menuitem id="newbookmark"
|
||||
command="placesCmd_new:bookmark"
|
||||
data-l10n-id="places-new-bookmark"/>
|
||||
data-l10n-id="places-add-bookmark"/>
|
||||
<menuitem id="newfolder"
|
||||
command="placesCmd_new:folder"
|
||||
data-l10n-id="places-new-folder"/>
|
||||
data-l10n-id="places-add-folder"/>
|
||||
<menuitem id="newseparator"
|
||||
command="placesCmd_new:separator"
|
||||
data-l10n-id="places-new-separator"/>
|
||||
data-l10n-id="places-add-separator"/>
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
<menuseparator id="orgDeleteSeparator"/>
|
||||
|
|
|
@ -12,9 +12,16 @@
|
|||
selectiontype="single"
|
||||
selection="link"
|
||||
forcehideintabbrowser="true"/>
|
||||
<menuitem id="placesContext_openBookmarkContainer:tabs"
|
||||
oncommand="PlacesUIUtils.openSelectionInTabs(event);"
|
||||
onclick="checkForMiddleClick(this, event);"
|
||||
data-l10n-id="places-open-all-bookmarks"
|
||||
selectiontype="single|none|multiple"
|
||||
selection="folder"
|
||||
forcehidenotintabbrowser="true"/>
|
||||
<menuitem id="placesContext_open:newtab"
|
||||
command="placesCmd_open:tab"
|
||||
data-l10n-id="places-open-tab"
|
||||
data-l10n-id="places-open-in-tab"
|
||||
selectiontype="single"
|
||||
selection="link"/>
|
||||
<menuitem id="placesContext_openContainer:tabs"
|
||||
|
@ -22,69 +29,48 @@
|
|||
onclick="checkForMiddleClick(this, event);"
|
||||
data-l10n-id="places-open-all-in-tabs"
|
||||
selectiontype="single|none"
|
||||
selection="folder|host|query"/>
|
||||
selection="folder|host|query"
|
||||
forcehideselection="bookmark"
|
||||
forcehideintabbrowser="true"/>
|
||||
<menuitem id="placesContext_openLinks:tabs"
|
||||
oncommand="PlacesUIUtils.openSelectionInTabs(event);"
|
||||
onclick="checkForMiddleClick(this, event);"
|
||||
data-l10n-id="places-open-all-in-tabs"
|
||||
selectiontype="multiple"
|
||||
selection="link"/>
|
||||
selection="link"
|
||||
forcehideintabbrowser="true"/>
|
||||
<menuitem id="placesContext_open:newwindow"
|
||||
command="placesCmd_open:window"
|
||||
data-l10n-id="places-open-window"
|
||||
data-l10n-id="places-open-in-window"
|
||||
selectiontype="single"
|
||||
selection="link"/>
|
||||
<menuitem id="placesContext_open:newprivatewindow"
|
||||
command="placesCmd_open:privatewindow"
|
||||
data-l10n-id="places-open-private-window"
|
||||
data-l10n-id="places-open-in-private-window"
|
||||
selectiontype="single"
|
||||
selection="link"
|
||||
hideifprivatebrowsing="true"/>
|
||||
<menuseparator id="placesContext_openSeparator"/>
|
||||
<menuitem id="placesContext_new:bookmark"
|
||||
command="placesCmd_new:bookmark"
|
||||
data-l10n-id="places-new-bookmark"
|
||||
selectiontype="any"
|
||||
hideifnoinsertionpoint="true"/>
|
||||
<menuitem id="placesContext_new:folder"
|
||||
command="placesCmd_new:folder"
|
||||
data-l10n-id="places-new-folder-contextmenu"
|
||||
selectiontype="any"
|
||||
hideifnoinsertionpoint="true"/>
|
||||
<menuitem id="placesContext_new:separator"
|
||||
command="placesCmd_new:separator"
|
||||
data-l10n-id="places-new-separator"
|
||||
<menuitem id="placesContext_show_bookmark:info"
|
||||
command="placesCmd_show:info"
|
||||
data-l10n-id="places-edit-bookmark"
|
||||
selection="bookmark"/>
|
||||
<menuitem id="placesContext_show:info"
|
||||
command="placesCmd_show:info"
|
||||
data-l10n-id="places-edit-generic"
|
||||
selection="folder|query"/>
|
||||
<menuitem id="placesContext_deleteBookmark"
|
||||
data-l10n-id="places-remove-bookmark"
|
||||
data-l10n-args='{"count":"1"}'
|
||||
command="placesCmd_delete"
|
||||
closemenu="single"
|
||||
selectiontype="any"
|
||||
hideifnoinsertionpoint="true"/>
|
||||
<menuseparator id="placesContext_newSeparator"/>
|
||||
<menuitem id="placesContext_createBookmark"
|
||||
command="placesCmd_createBookmark"
|
||||
selection="link"
|
||||
forcehideselection="bookmark|tagChild"/>
|
||||
<menuitem id="placesContext_cut"
|
||||
command="placesCmd_cut"
|
||||
data-l10n-id="text-action-cut"
|
||||
closemenu="single"
|
||||
selection="bookmark|folder|separator|query"
|
||||
forcehideselection="tagChild"/>
|
||||
<menuitem id="placesContext_copy"
|
||||
command="placesCmd_copy"
|
||||
data-l10n-id="text-action-copy"
|
||||
closemenu="single"
|
||||
selection="any"/>
|
||||
<menuitem id="placesContext_paste"
|
||||
data-l10n-id="text-action-paste"
|
||||
command="placesCmd_paste"
|
||||
closemenu="single"
|
||||
selectiontype="any"
|
||||
hideifnoinsertionpoint="true"/>
|
||||
<menuseparator id="placesContext_editSeparator"/>
|
||||
selection="bookmark"/>
|
||||
<menuitem id="placesContext_delete"
|
||||
data-l10n-id="text-action-delete"
|
||||
command="placesCmd_delete"
|
||||
closemenu="single"
|
||||
selection="bookmark|tagChild|folder|query|dynamiccontainer|separator|host"/>
|
||||
selection="tagChild|folder|query|dynamiccontainer|separator|host"
|
||||
forcehideselection="bookmark"/>
|
||||
<menuitem id="placesContext_delete_history"
|
||||
command="placesCmd_delete"
|
||||
closemenu="single"
|
||||
|
@ -98,14 +84,62 @@
|
|||
selectiontype="single"
|
||||
forcehideselection="bookmark"/>
|
||||
<menuseparator id="placesContext_deleteSeparator"/>
|
||||
<menuitem id="placesContext_cut"
|
||||
command="placesCmd_cut"
|
||||
data-l10n-id="text-action-cut"
|
||||
closemenu="single"
|
||||
selection="bookmark|folder|separator|query"
|
||||
forcehideselection="tagChild"/>
|
||||
<menuitem id="placesContext_copy"
|
||||
command="placesCmd_copy"
|
||||
data-l10n-id="text-action-copy"
|
||||
closemenu="single"
|
||||
selection="any"/>
|
||||
<menuitem id="placesContext_paste_group"
|
||||
data-l10n-id="text-action-paste"
|
||||
command="placesCmd_paste"
|
||||
closemenu="single"
|
||||
selection="any"
|
||||
hideifnoinsertionpoint="true"/>
|
||||
<menuseparator id="placesContext_editSeparator"/>
|
||||
<menuitem id="placesContext_new:bookmark"
|
||||
command="placesCmd_new:bookmark"
|
||||
data-l10n-id="places-add-bookmark"
|
||||
selectiontype="any"
|
||||
hideifnoinsertionpoint="true"/>
|
||||
<menuitem id="placesContext_new:folder"
|
||||
command="placesCmd_new:folder"
|
||||
data-l10n-id="places-add-folder-contextmenu"
|
||||
selectiontype="any"
|
||||
hideifnoinsertionpoint="true"/>
|
||||
<menuitem id="placesContext_new:separator"
|
||||
command="placesCmd_new:separator"
|
||||
data-l10n-id="places-add-separator"
|
||||
closemenu="single"
|
||||
selectiontype="any"
|
||||
hideifnoinsertionpoint="true"/>
|
||||
<menuseparator id="placesContext_newSeparator"/>
|
||||
<menuitem id="placesContext_paste"
|
||||
data-l10n-id="text-action-paste"
|
||||
command="placesCmd_paste"
|
||||
closemenu="single"
|
||||
selectiontype="none"
|
||||
hideifnoinsertionpoint="true"/>
|
||||
<menuseparator id="placesContext_pasteSeparator"/>
|
||||
<menuitem id="placesContext_createBookmark"
|
||||
command="placesCmd_createBookmark"
|
||||
selection="link"
|
||||
forcehideselection="bookmark|tagChild"/>
|
||||
<menuitem id="placesContext_sortBy:name"
|
||||
command="placesCmd_sortBy:name"
|
||||
data-l10n-id="places-sortby-name"
|
||||
closemenu="single"
|
||||
selection="folder"/>
|
||||
<menuseparator id="placesContext_sortSeparator"/>
|
||||
<menuitem id="placesContext_show:info"
|
||||
command="placesCmd_show:info"
|
||||
data-l10n-id="places-properties"
|
||||
selection="bookmark|folder|query"/>
|
||||
<menuitem id="placesContext_showAllBookmarks"
|
||||
data-l10n-id="places-manage-bookmarks"
|
||||
command="Browser:ShowAllBookmarks"
|
||||
ignoreitem="true"
|
||||
hidden="true"/>
|
||||
|
||||
</menupopup>
|
||||
|
|
|
@ -16,6 +16,7 @@ skip-if = (verify && debug)
|
|||
[browser_autoshow_bookmarks_toolbar.js]
|
||||
[browser_bookmark_add_tags.js]
|
||||
[browser_bookmark_backup_export_import.js]
|
||||
[browser_bookmark_context_menu_contents.js]
|
||||
[browser_bookmark_change_location.js]
|
||||
[browser_bookmark_folder_moveability.js]
|
||||
[browser_bookmark_menu_ctrl_click.js]
|
||||
|
|
|
@ -52,9 +52,13 @@ add_task(async function test_change_location_from_Toolbar() {
|
|||
button: 2,
|
||||
type: "contextmenu",
|
||||
});
|
||||
console.log("JKJKJKJKJKafterBEFORE");
|
||||
await promisePopup;
|
||||
console.log("JKJKJKJKJKafter");
|
||||
|
||||
let properties = document.getElementById("placesContext_show:info");
|
||||
let properties = document.getElementById(
|
||||
"placesContext_show_bookmark:info"
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(properties, {});
|
||||
},
|
||||
async function test(dialogWin) {
|
||||
|
|
|
@ -0,0 +1,249 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Test removing bookmarks from the Bookmarks Toolbar and Library.
|
||||
*/
|
||||
const BOOKMARKS_H2_2020_PREF = "browser.toolbars.bookmarks.2h2020";
|
||||
const bookmarksInfo = [
|
||||
{
|
||||
title: "firefox",
|
||||
url: "http://example.com",
|
||||
},
|
||||
{
|
||||
title: "rules",
|
||||
url: "http://example.com/2",
|
||||
},
|
||||
{
|
||||
title: "yo",
|
||||
url: "http://example.com/2",
|
||||
},
|
||||
];
|
||||
const TEST_URL = "about:mozilla";
|
||||
|
||||
add_task(async function setup() {
|
||||
await PlacesUtils.bookmarks.eraseEverything();
|
||||
|
||||
let toolbar = document.getElementById("PersonalToolbar");
|
||||
let wasCollapsed = toolbar.collapsed;
|
||||
|
||||
// Uncollapse the personal toolbar if needed.
|
||||
if (wasCollapsed) {
|
||||
await promiseSetToolbarVisibility(toolbar, true);
|
||||
}
|
||||
|
||||
registerCleanupFunction(async () => {
|
||||
// Collapse the personal toolbar if needed.
|
||||
if (wasCollapsed) {
|
||||
await promiseSetToolbarVisibility(toolbar, false);
|
||||
}
|
||||
await PlacesUtils.bookmarks.eraseEverything();
|
||||
});
|
||||
});
|
||||
|
||||
let OptionItemExists = elementId => {
|
||||
let optionItem = document.getElementById(elementId);
|
||||
|
||||
Assert.ok(optionItem, "Context menu contains the appropriate option");
|
||||
Assert.ok(
|
||||
BrowserTestUtils.is_visible(optionItem),
|
||||
"Context menu option is visible"
|
||||
);
|
||||
};
|
||||
|
||||
let OptionsMatchExpected = (contextMenu, expectedOptionItems) => {
|
||||
let idList = [];
|
||||
for (let elem of contextMenu.children) {
|
||||
if (
|
||||
BrowserTestUtils.is_visible(elem) &&
|
||||
elem.localName !== "menuseparator"
|
||||
) {
|
||||
idList.push(elem.id);
|
||||
}
|
||||
}
|
||||
|
||||
Assert.deepEqual(
|
||||
idList.sort(),
|
||||
expectedOptionItems.sort(),
|
||||
"Content is the same across both lists"
|
||||
);
|
||||
};
|
||||
|
||||
let checkContextMenu = async (cbfunc, optionItems) => {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [[BOOKMARKS_H2_2020_PREF, true]],
|
||||
});
|
||||
await PlacesUtils.bookmarks.insert({
|
||||
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
|
||||
title: "Second Bookmark Title",
|
||||
url: TEST_URL,
|
||||
});
|
||||
|
||||
await PlacesUtils.bookmarks.insertTree({
|
||||
guid: PlacesUtils.bookmarks.unfiledGuid,
|
||||
children: bookmarksInfo,
|
||||
});
|
||||
|
||||
let contextMenu = await cbfunc();
|
||||
|
||||
for (let item of optionItems) {
|
||||
OptionItemExists(item);
|
||||
}
|
||||
|
||||
OptionsMatchExpected(contextMenu, optionItems);
|
||||
contextMenu.hidePopup();
|
||||
await PlacesUtils.bookmarks.eraseEverything();
|
||||
};
|
||||
|
||||
add_task(async function test_bookmark_contextmenu_contents() {
|
||||
let optionItems = [
|
||||
"placesContext_open:newtab",
|
||||
"placesContext_open:newwindow",
|
||||
"placesContext_open:newprivatewindow",
|
||||
"placesContext_show_bookmark:info",
|
||||
"placesContext_deleteBookmark",
|
||||
"placesContext_cut",
|
||||
"placesContext_copy",
|
||||
"placesContext_paste_group",
|
||||
"placesContext_new:bookmark",
|
||||
"placesContext_new:folder",
|
||||
"placesContext_new:separator",
|
||||
"placesContext_showAllBookmarks",
|
||||
"toggle_PersonalToolbar",
|
||||
"show-other-bookmarks_PersonalToolbar",
|
||||
];
|
||||
|
||||
await checkContextMenu(async function() {
|
||||
let toolbarBookmark = await PlacesUtils.bookmarks.insert({
|
||||
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
|
||||
title: "Bookmark Title",
|
||||
url: TEST_URL,
|
||||
});
|
||||
|
||||
let toolbarNode = getToolbarNodeForItemGuid(toolbarBookmark.guid);
|
||||
|
||||
let contextMenu = document.getElementById("placesContext");
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(
|
||||
contextMenu,
|
||||
"popupshown"
|
||||
);
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(toolbarNode, {
|
||||
button: 2,
|
||||
type: "contextmenu",
|
||||
});
|
||||
await popupShownPromise;
|
||||
return contextMenu;
|
||||
}, optionItems);
|
||||
});
|
||||
|
||||
add_task(async function test_empty_contextmenu_contents() {
|
||||
let optionItems = [
|
||||
"placesContext_openBookmarkContainer:tabs",
|
||||
"placesContext_new:bookmark",
|
||||
"placesContext_new:folder",
|
||||
"placesContext_new:separator",
|
||||
"placesContext_paste",
|
||||
"placesContext_showAllBookmarks",
|
||||
"toggle_PersonalToolbar",
|
||||
"show-other-bookmarks_PersonalToolbar",
|
||||
];
|
||||
|
||||
await checkContextMenu(async function() {
|
||||
let contextMenu = document.getElementById("placesContext");
|
||||
let toolbar = document.querySelector("#PlacesToolbarItems");
|
||||
let openToolbarContextMenuPromise = BrowserTestUtils.waitForPopupEvent(
|
||||
contextMenu,
|
||||
"shown"
|
||||
);
|
||||
|
||||
// Use the end of the toolbar because the beginning (and even middle, on
|
||||
// some resolutions) might be occluded by the empty toolbar message, which
|
||||
// has a different context menu.
|
||||
let bounds = toolbar.getBoundingClientRect();
|
||||
EventUtils.synthesizeMouse(toolbar, bounds.width - 5, 5, {
|
||||
type: "contextmenu",
|
||||
});
|
||||
|
||||
await openToolbarContextMenuPromise;
|
||||
return contextMenu;
|
||||
}, optionItems);
|
||||
});
|
||||
|
||||
add_task(async function test_separator_contextmenu_contents() {
|
||||
let optionItems = [
|
||||
"placesContext_delete",
|
||||
"placesContext_cut",
|
||||
"placesContext_copy",
|
||||
"placesContext_paste_group",
|
||||
"placesContext_new:bookmark",
|
||||
"placesContext_new:folder",
|
||||
"placesContext_new:separator",
|
||||
"placesContext_showAllBookmarks",
|
||||
"toggle_PersonalToolbar",
|
||||
"show-other-bookmarks_PersonalToolbar",
|
||||
];
|
||||
|
||||
await checkContextMenu(async function() {
|
||||
let sep = await PlacesUtils.bookmarks.insert({
|
||||
type: PlacesUtils.bookmarks.TYPE_SEPARATOR,
|
||||
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
|
||||
});
|
||||
|
||||
let toolbarNode = getToolbarNodeForItemGuid(sep.guid);
|
||||
let contextMenu = document.getElementById("placesContext");
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(
|
||||
contextMenu,
|
||||
"popupshown"
|
||||
);
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(toolbarNode, {
|
||||
button: 2,
|
||||
type: "contextmenu",
|
||||
});
|
||||
await popupShownPromise;
|
||||
return contextMenu;
|
||||
}, optionItems);
|
||||
});
|
||||
|
||||
add_task(async function test_folder_contextmenu_contents() {
|
||||
let optionItems = [
|
||||
"placesContext_openBookmarkContainer:tabs",
|
||||
"placesContext_show:info",
|
||||
"placesContext_delete",
|
||||
"placesContext_cut",
|
||||
"placesContext_copy",
|
||||
"placesContext_paste_group",
|
||||
"placesContext_new:bookmark",
|
||||
"placesContext_new:folder",
|
||||
"placesContext_new:separator",
|
||||
"placesContext_sortBy:name",
|
||||
"placesContext_showAllBookmarks",
|
||||
"toggle_PersonalToolbar",
|
||||
"show-other-bookmarks_PersonalToolbar",
|
||||
];
|
||||
|
||||
await checkContextMenu(async function() {
|
||||
let folder = await PlacesUtils.bookmarks.insert({
|
||||
type: PlacesUtils.bookmarks.TYPE_FOLDER,
|
||||
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
|
||||
});
|
||||
|
||||
let toolbarNode = getToolbarNodeForItemGuid(folder.guid);
|
||||
let contextMenu = document.getElementById("placesContext");
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(
|
||||
contextMenu,
|
||||
"popupshown"
|
||||
);
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(toolbarNode, {
|
||||
button: 2,
|
||||
type: "contextmenu",
|
||||
});
|
||||
await popupShownPromise;
|
||||
return contextMenu;
|
||||
}, optionItems);
|
||||
});
|
|
@ -107,7 +107,9 @@ add_task(async function test_remove_tags_from_Toolbar() {
|
|||
});
|
||||
await promisePopup;
|
||||
|
||||
let properties = document.getElementById("placesContext_show:info");
|
||||
let properties = document.getElementById(
|
||||
"placesContext_show_bookmark:info"
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(properties, {});
|
||||
},
|
||||
async function test(dialogWin) {
|
||||
|
|
|
@ -116,7 +116,9 @@ add_task(async function test_change_title_from_Toolbar() {
|
|||
});
|
||||
await promisePopup;
|
||||
|
||||
let properties = document.getElementById("placesContext_show:info");
|
||||
let properties = document.getElementById(
|
||||
"placesContext_show_bookmark:info"
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(properties, {});
|
||||
},
|
||||
async function test(dialogWin) {
|
||||
|
|
|
@ -37,7 +37,7 @@ add_task(async function testPopup() {
|
|||
);
|
||||
ok(!bookmarksToolbar.collapsed, "Bookmarks toolbar should be visible");
|
||||
|
||||
// 1. Right-click on a bookmark and check that the submenu is not visible
|
||||
// 1. Right-click on a bookmark and check that the submenu is visible
|
||||
let bookmarkItem = bookmarksToolbar.querySelector(
|
||||
`.bookmark-item[label="firefox"]`
|
||||
);
|
||||
|
@ -45,8 +45,8 @@ add_task(async function testPopup() {
|
|||
let contextMenu = document.getElementById("placesContext");
|
||||
let popup = await openContextMenu(contextMenu, bookmarkItem);
|
||||
ok(
|
||||
popup.target.querySelector("#toggle_PersonalToolbar").hidden,
|
||||
"Bookmarks toolbar submenu should not appear on a .bookmark-item"
|
||||
!popup.target.querySelector("#toggle_PersonalToolbar").hidden,
|
||||
"Bookmarks toolbar submenu should appear on a .bookmark-item"
|
||||
);
|
||||
contextMenu.hidePopup();
|
||||
|
||||
|
|
|
@ -63,7 +63,9 @@ add_task(async function test_panelview_bookmarks_delete() {
|
|||
});
|
||||
observer.observe(list, { childList: true });
|
||||
});
|
||||
let placesContextDelete = document.getElementById("placesContext_delete");
|
||||
let placesContextDelete = document.getElementById(
|
||||
"placesContext_deleteBookmark"
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(placesContextDelete, {});
|
||||
await promise;
|
||||
|
||||
|
|
|
@ -51,7 +51,9 @@ add_task(async function test_remove_bookmark_from_toolbar() {
|
|||
});
|
||||
await popupShownPromise;
|
||||
|
||||
let contextMenuDeleteItem = document.getElementById("placesContext_delete");
|
||||
let contextMenuDeleteBookmark = document.getElementById(
|
||||
"placesContext_deleteBookmark"
|
||||
);
|
||||
|
||||
let removePromise = PlacesTestUtils.waitForNotification(
|
||||
"bookmark-removed",
|
||||
|
@ -59,7 +61,7 @@ add_task(async function test_remove_bookmark_from_toolbar() {
|
|||
"places"
|
||||
);
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(contextMenuDeleteItem, {});
|
||||
EventUtils.synthesizeMouseAtCenter(contextMenuDeleteBookmark, {});
|
||||
|
||||
await removePromise;
|
||||
|
||||
|
@ -106,8 +108,8 @@ add_task(async function test_remove_bookmark_from_library() {
|
|||
);
|
||||
|
||||
let contextMenu = library.document.getElementById("placesContext");
|
||||
let contextMenuDeleteItem = library.document.getElementById(
|
||||
"placesContext_delete"
|
||||
let contextMenuDeleteBookmark = library.document.getElementById(
|
||||
"placesContext_deleteBookmark"
|
||||
);
|
||||
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(
|
||||
|
@ -143,7 +145,7 @@ add_task(async function test_remove_bookmark_from_library() {
|
|||
events => events.some(event => event.url == uris[0]),
|
||||
"places"
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(contextMenuDeleteItem, {}, library);
|
||||
EventUtils.synthesizeMouseAtCenter(contextMenuDeleteBookmark, {}, library);
|
||||
|
||||
await removePromise;
|
||||
|
||||
|
|
|
@ -218,8 +218,10 @@ add_task(async function testDeletingMenuItems() {
|
|||
await popupEventPromise;
|
||||
|
||||
info("Delete bookmark menu item from popup.");
|
||||
let deleteMenuItem = document.getElementById("placesContext_delete");
|
||||
EventUtils.synthesizeMouseAtCenter(deleteMenuItem, {});
|
||||
let deleteMenuBookmark = document.getElementById(
|
||||
"placesContext_deleteBookmark"
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(deleteMenuBookmark, {});
|
||||
|
||||
await TestUtils.waitForCondition(() => {
|
||||
let popup = document.querySelector("#OtherBookmarksPopup");
|
||||
|
|
|
@ -5,30 +5,33 @@
|
|||
places-open =
|
||||
.label = Open
|
||||
.accesskey = O
|
||||
places-open-tab =
|
||||
.label = Open in a New Tab
|
||||
places-open-in-tab =
|
||||
.label = Open in New Tab
|
||||
.accesskey = w
|
||||
places-open-all-bookmarks =
|
||||
.label = Open All Bookmarks
|
||||
.accesskey = O
|
||||
places-open-all-in-tabs =
|
||||
.label = Open All in Tabs
|
||||
.accesskey = O
|
||||
places-open-window =
|
||||
.label = Open in a New Window
|
||||
places-open-in-window =
|
||||
.label = Open in New Window
|
||||
.accesskey = N
|
||||
places-open-private-window =
|
||||
.label = Open in a New Private Window
|
||||
places-open-in-private-window =
|
||||
.label = Open in New Private Window
|
||||
.accesskey = P
|
||||
|
||||
places-new-bookmark =
|
||||
.label = New Bookmark…
|
||||
places-add-bookmark =
|
||||
.label = Add Bookmark…
|
||||
.accesskey = B
|
||||
places-new-folder-contextmenu =
|
||||
.label = New Folder…
|
||||
places-add-folder-contextmenu =
|
||||
.label = Add Folder…
|
||||
.accesskey = F
|
||||
places-new-folder =
|
||||
.label = New Folder…
|
||||
places-add-folder =
|
||||
.label = Add Folder…
|
||||
.accesskey = o
|
||||
places-new-separator =
|
||||
.label = New Separator
|
||||
places-add-separator =
|
||||
.label = Add Separator
|
||||
.accesskey = S
|
||||
|
||||
places-view =
|
||||
|
@ -61,8 +64,12 @@ places-delete-domain-data =
|
|||
places-sortby-name =
|
||||
.label = Sort By Name
|
||||
.accesskey = r
|
||||
places-properties =
|
||||
.label = Properties
|
||||
# places-edit-bookmark and places-edit-generic will show one or the other and can have the same access key.
|
||||
places-edit-bookmark =
|
||||
.label = Edit Bookmark…
|
||||
.accesskey = i
|
||||
places-edit-generic =
|
||||
.label = Edit…
|
||||
.accesskey = i
|
||||
|
||||
# Managed bookmarks are created by an administrator and cannot be changed by the user.
|
||||
|
@ -75,3 +82,17 @@ managed-bookmarks-subfolder =
|
|||
# This label is used for the "Other Bookmarks" folder that appears in the bookmarks toolbar.
|
||||
other-bookmarks-folder =
|
||||
.label = Other Bookmarks
|
||||
|
||||
# Variables:
|
||||
# $count (number) - The number of elements being selected for removal.
|
||||
places-remove-bookmark =
|
||||
.label =
|
||||
{ $count ->
|
||||
[1] Remove Bookmark
|
||||
*[other] Remove Bookmarks
|
||||
}
|
||||
.accesskey = e
|
||||
|
||||
places-manage-bookmarks =
|
||||
.label = Manage Bookmarks
|
||||
.accesskey = M
|
||||
|
|
Загрузка…
Ссылка в новой задаче