зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 37ef0aa2d2b5 (bug 1857298) for causing bc failures on browser_recentlyclosed_firefoxview.js.
This commit is contained in:
Родитель
08b0885295
Коммит
08629b9d2c
|
@ -108,6 +108,14 @@ fxview-category-button[name="history"]::part(icon) {
|
|||
background-image: url("chrome://browser/content/firefoxview/category-history.svg");
|
||||
}
|
||||
|
||||
fxview-tab-list.with-dismiss-button::part(secondary-button) {
|
||||
background-image: url("chrome://global/skin/icons/close.svg");
|
||||
}
|
||||
|
||||
fxview-tab-list.with-context-menu::part(secondary-button) {
|
||||
background-image: url("chrome://global/skin/icons/more.svg");
|
||||
}
|
||||
|
||||
.sticky-container {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
|
|
|
@ -47,8 +47,6 @@ if (!window.IS_STORYBOOK) {
|
|||
* @property {number} maxTabsLength - The max number of tabs for the list
|
||||
* @property {Array} tabItems - Items to show in the tab list
|
||||
* @property {string} searchQuery - The query string to highlight, if provided.
|
||||
* @property {string} secondaryActionClass - The class used to style the secondary action element
|
||||
* @property {string} tertiaryActionClass - The class used to style the tertiary action element
|
||||
*/
|
||||
export default class FxviewTabList extends MozLitElement {
|
||||
constructor() {
|
||||
|
@ -76,8 +74,6 @@ export default class FxviewTabList extends MozLitElement {
|
|||
tabItems: { type: Array },
|
||||
updatesPaused: { type: Boolean },
|
||||
searchQuery: { type: String },
|
||||
secondaryActionClass: { type: String },
|
||||
tertiaryActionClass: { type: String },
|
||||
};
|
||||
|
||||
static queries = {
|
||||
|
@ -171,38 +167,6 @@ export default class FxviewTabList extends MozLitElement {
|
|||
);
|
||||
}
|
||||
|
||||
navigateRight(fxviewTabRow) {
|
||||
if (
|
||||
(fxviewTabRow.soundPlaying || fxviewTabRow.muted) &&
|
||||
this.currentActiveElementId === "fxview-tab-row-main"
|
||||
) {
|
||||
this.currentActiveElementId = fxviewTabRow.focusMediaButton();
|
||||
} else if (
|
||||
this.currentActiveElementId === "fxview-tab-row-media-button" ||
|
||||
this.currentActiveElementId === "fxview-tab-row-main"
|
||||
) {
|
||||
this.currentActiveElementId = fxviewTabRow.focusSecondaryButton();
|
||||
} else if (
|
||||
fxviewTabRow.tertiaryButtonEl &&
|
||||
this.currentActiveElementId === "fxview-tab-row-secondary-button"
|
||||
) {
|
||||
this.currentActiveElementId = fxviewTabRow.focusTertiaryButton();
|
||||
}
|
||||
}
|
||||
|
||||
navigateLeft(fxviewTabRow) {
|
||||
if (this.currentActiveElementId === "fxview-tab-row-tertiary-button") {
|
||||
this.currentActiveElementId = fxviewTabRow.focusSecondaryButton();
|
||||
} else if (
|
||||
(fxviewTabRow.soundPlaying || fxviewTabRow.muted) &&
|
||||
this.currentActiveElementId === "fxview-tab-row-secondary-button"
|
||||
) {
|
||||
this.currentActiveElementId = fxviewTabRow.focusMediaButton();
|
||||
} else {
|
||||
this.currentActiveElementId = fxviewTabRow.focusLink();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Focuses the expected element (either the link or button) within fxview-tab-row
|
||||
* The currently focused/active element ID within a row is stored in this.currentActiveElementId
|
||||
|
@ -222,18 +186,42 @@ export default class FxviewTabList extends MozLitElement {
|
|||
// set this.currentActiveElementId to that element's ID
|
||||
e.preventDefault();
|
||||
if (document.dir == "rtl") {
|
||||
this.navigateLeft(fxviewTabRow);
|
||||
if (
|
||||
(fxviewTabRow.soundPlaying || fxviewTabRow.muted) &&
|
||||
this.currentActiveElementId === "fxview-tab-row-secondary-button"
|
||||
) {
|
||||
this.currentActiveElementId = fxviewTabRow.focusMediaButton();
|
||||
} else {
|
||||
this.currentActiveElementId = fxviewTabRow.focusLink();
|
||||
}
|
||||
} else if (
|
||||
(fxviewTabRow.soundPlaying || fxviewTabRow.muted) &&
|
||||
this.currentActiveElementId === "fxview-tab-row-main"
|
||||
) {
|
||||
this.currentActiveElementId = fxviewTabRow.focusMediaButton();
|
||||
} else {
|
||||
this.navigateRight(fxviewTabRow);
|
||||
this.currentActiveElementId = fxviewTabRow.focusButton();
|
||||
}
|
||||
} else if (e.code == "ArrowLeft") {
|
||||
// Focus either the link or the button in the current row and
|
||||
// set this.currentActiveElementId to that element's ID
|
||||
e.preventDefault();
|
||||
if (document.dir == "rtl") {
|
||||
this.navigateRight(fxviewTabRow);
|
||||
if (
|
||||
(fxviewTabRow.soundPlaying || fxviewTabRow.muted) &&
|
||||
this.currentActiveElementId === "fxview-tab-row-main"
|
||||
) {
|
||||
this.currentActiveElementId = fxviewTabRow.focusMediaButton();
|
||||
} else {
|
||||
this.currentActiveElementId = fxviewTabRow.focusButton();
|
||||
}
|
||||
} else if (
|
||||
(fxviewTabRow.soundPlaying || fxviewTabRow.muted) &&
|
||||
this.currentActiveElementId === "fxview-tab-row-secondary-button"
|
||||
) {
|
||||
this.currentActiveElementId = fxviewTabRow.focusMediaButton();
|
||||
} else {
|
||||
this.navigateLeft(fxviewTabRow);
|
||||
this.currentActiveElementId = fxviewTabRow.focusLink();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -313,10 +301,6 @@ export default class FxviewTabList extends MozLitElement {
|
|||
role="listitem"
|
||||
.secondaryL10nId=${tabItem.secondaryL10nId}
|
||||
.secondaryL10nArgs=${ifDefined(tabItem.secondaryL10nArgs)}
|
||||
.tertiaryL10nId=${ifDefined(tabItem.tertiaryL10nId)}
|
||||
.tertiaryL10nArgs=${ifDefined(tabItem.tertiaryL10nArgs)}
|
||||
.secondaryActionClass=${this.secondaryActionClass}
|
||||
.tertiaryActionClass=${ifDefined(this.tertiaryActionClass)}
|
||||
.attention=${ifDefined(tabItem.attention)}
|
||||
.soundPlaying=${ifDefined(tabItem.soundPlaying)}
|
||||
.sourceClosedId=${ifDefined(tabItem.sourceClosedId)}
|
||||
|
@ -389,7 +373,7 @@ customElements.define("fxview-tab-list", FxviewTabList);
|
|||
* @property {object} containerObj - Info about an open tab's container if within one
|
||||
* @property {string} currentActiveElementId - ID of currently focused element within each tab item
|
||||
* @property {string} dateTimeFormat - Expected format for date and/or time
|
||||
* @property {string} hasPopup - The aria-haspopup attribute for the secondary or tertiary action, if required
|
||||
* @property {string} hasPopup - The aria-haspopup attribute for the secondary action, if required
|
||||
* @property {boolean} isBookmark - Whether an open tab is bookmarked
|
||||
* @property {number} closedId - The tab ID for when the tab item was closed.
|
||||
* @property {number} sourceClosedId - The closedId of the closed window its from if applicable
|
||||
|
@ -401,10 +385,6 @@ customElements.define("fxview-tab-list", FxviewTabList);
|
|||
* @property {string} primaryL10nArgs - The l10n args used for the primary action element
|
||||
* @property {string} secondaryL10nId - The l10n id used for the secondary action button
|
||||
* @property {string} secondaryL10nArgs - The l10n args used for the secondary action element
|
||||
* @property {string} secondaryActionClass - The class used to style the secondary action element
|
||||
* @property {string} tertiaryL10nId - The l10n id used for the tertiary action button
|
||||
* @property {string} tertiaryL10nArgs - The l10n args used for the tertiary action element
|
||||
* @property {string} tertiaryActionClass - The class used to style the tertiary action element
|
||||
* @property {boolean} attention - Whether to show a notification dot
|
||||
* @property {boolean} soundPlaying - Whether an open tab has soundPlaying
|
||||
* @property {object} tabElement - The MozTabbrowserTab element for the tab item.
|
||||
|
@ -437,10 +417,6 @@ export class FxviewTabRow extends MozLitElement {
|
|||
primaryL10nArgs: { type: String },
|
||||
secondaryL10nId: { type: String },
|
||||
secondaryL10nArgs: { type: String },
|
||||
secondaryActionClass: { type: String },
|
||||
tertiaryL10nId: { type: String },
|
||||
tertiaryL10nArgs: { type: String },
|
||||
tertiaryActionClass: { type: String },
|
||||
soundPlaying: { type: Boolean },
|
||||
closedId: { type: Number },
|
||||
sourceClosedId: { type: Number },
|
||||
|
@ -457,8 +433,7 @@ export class FxviewTabRow extends MozLitElement {
|
|||
|
||||
static queries = {
|
||||
mainEl: ".fxview-tab-row-main",
|
||||
secondaryButtonEl: "#fxview-tab-row-secondary-button",
|
||||
tertiaryButtonEl: "#fxview-tab-row-tertiary-button",
|
||||
buttonEl: "#fxview-tab-row-secondary-button:not([hidden])",
|
||||
mediaButtonEl: "#fxview-tab-row-media-button",
|
||||
};
|
||||
|
||||
|
@ -474,14 +449,9 @@ export class FxviewTabRow extends MozLitElement {
|
|||
this.currentFocusable.focus();
|
||||
}
|
||||
|
||||
focusSecondaryButton() {
|
||||
this.secondaryButtonEl.focus();
|
||||
return this.secondaryButtonEl.id;
|
||||
}
|
||||
|
||||
focusTertiaryButton() {
|
||||
this.tertiaryButtonEl.focus();
|
||||
return this.tertiaryButtonEl.id;
|
||||
focusButton() {
|
||||
this.buttonEl.focus();
|
||||
return this.buttonEl.id;
|
||||
}
|
||||
|
||||
focusMediaButton() {
|
||||
|
@ -607,23 +577,6 @@ export class FxviewTabRow extends MozLitElement {
|
|||
}
|
||||
}
|
||||
|
||||
tertiaryActionHandler(event) {
|
||||
if (
|
||||
(event.type == "click" && event.detail && !event.altKey) ||
|
||||
// detail=0 is from keyboard
|
||||
(event.type == "click" && !event.detail)
|
||||
) {
|
||||
event.preventDefault();
|
||||
this.dispatchEvent(
|
||||
new CustomEvent("fxview-tab-list-tertiary-action", {
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
detail: { originalEvent: event, item: this },
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
muteOrUnmuteTab() {
|
||||
this.tabElement.toggleMuteAudio();
|
||||
this.muted = !this.muted;
|
||||
|
@ -645,7 +598,6 @@ export class FxviewTabRow extends MozLitElement {
|
|||
const timeString = this.timeFluentId(this.dateTimeFormat);
|
||||
const time = this.time;
|
||||
const timeArgs = JSON.stringify({ time });
|
||||
|
||||
return html`
|
||||
${when(
|
||||
this.containerObj,
|
||||
|
@ -774,14 +726,9 @@ export class FxviewTabRow extends MozLitElement {
|
|||
${when(
|
||||
this.secondaryL10nId && this.secondaryActionHandler,
|
||||
() => html`<button
|
||||
class=${classMap({
|
||||
"fxview-tab-row-button": true,
|
||||
"ghost-button": true,
|
||||
"icon-button": true,
|
||||
"semi-transparent": true,
|
||||
[this.secondaryActionClass]: this.secondaryActionClass,
|
||||
})}
|
||||
class="fxview-tab-row-button ghost-button icon-button semi-transparent"
|
||||
id="fxview-tab-row-secondary-button"
|
||||
part="secondary-button"
|
||||
data-l10n-id=${this.secondaryL10nId}
|
||||
data-l10n-args=${ifDefined(this.secondaryL10nArgs)}
|
||||
aria-haspopup=${ifDefined(this.hasPopup)}
|
||||
|
@ -792,27 +739,6 @@ export class FxviewTabRow extends MozLitElement {
|
|||
: "-1"}"
|
||||
></button>`
|
||||
)}
|
||||
${when(
|
||||
this.tertiaryL10nId && this.tertiaryActionHandler,
|
||||
() => html`<button
|
||||
class=${classMap({
|
||||
"fxview-tab-row-button": true,
|
||||
"ghost-button": true,
|
||||
"icon-button": true,
|
||||
"semi-transparent": true,
|
||||
[this.tertiaryActionClass]: this.tertiaryActionClass,
|
||||
})}
|
||||
id="fxview-tab-row-tertiary-button"
|
||||
data-l10n-id=${this.tertiaryL10nId}
|
||||
data-l10n-args=${ifDefined(this.tertiaryL10nArgs)}
|
||||
aria-haspopup=${ifDefined(this.hasPopup)}
|
||||
@click=${this.tertiaryActionHandler}
|
||||
tabindex="${this.active &&
|
||||
this.currentActiveElementId === "fxview-tab-row-tertiary-button"
|
||||
? "0"
|
||||
: "-1"}"
|
||||
></button>`
|
||||
)}
|
||||
`;
|
||||
}
|
||||
|
||||
|
|
|
@ -179,14 +179,6 @@
|
|||
&[soundplaying="true"] {
|
||||
background-image: url("chrome://global/skin/media/audio.svg");
|
||||
}
|
||||
|
||||
&.dismiss-button {
|
||||
background-image: url("chrome://global/skin/icons/close.svg");
|
||||
}
|
||||
|
||||
&.options-button {
|
||||
background-image: url("chrome://global/skin/icons/more.svg");
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-contrast) {
|
||||
|
|
|
@ -418,7 +418,7 @@ class HistoryInView extends ViewPage {
|
|||
></h3>
|
||||
<fxview-tab-list
|
||||
slot="main"
|
||||
secondaryActionClass="options-button"
|
||||
class="with-context-menu"
|
||||
dateTimeFormat=${historyItem.l10nId.includes("prev-month")
|
||||
? "dateTime"
|
||||
: "time"}
|
||||
|
|
|
@ -497,18 +497,6 @@ class OpenTabsInViewCard extends ViewPageContent {
|
|||
}
|
||||
}
|
||||
|
||||
closeTab(event) {
|
||||
const tab = event.originalTarget.tabElement;
|
||||
tab?.ownerGlobal.gBrowser.removeTab(tab);
|
||||
|
||||
Services.telemetry.recordEvent(
|
||||
"firefoxview_next",
|
||||
"close_open_tab",
|
||||
"tabs",
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
viewVisibleCallback() {
|
||||
this.getRootNode().host.toggleVisibilityInCardContainer(true);
|
||||
}
|
||||
|
@ -543,13 +531,11 @@ class OpenTabsInViewCard extends ViewPageContent {
|
|||
)}
|
||||
<div class="fxview-tab-list-container" slot="main">
|
||||
<fxview-tab-list
|
||||
class="with-context-menu"
|
||||
.hasPopup=${"menu"}
|
||||
?compactRows=${this.classList.contains("width-limited")}
|
||||
@fxview-tab-list-primary-action=${this.onTabListRowClick}
|
||||
@fxview-tab-list-secondary-action=${this.openContextMenu}
|
||||
@fxview-tab-list-tertiary-action=${this.closeTab}
|
||||
secondaryActionClass="options-button"
|
||||
tertiaryActionClass="dismiss-button"
|
||||
.maxTabsLength=${this.getMaxTabsLength()}
|
||||
.tabItems=${this.searchResults || getTabListItems(this.tabs)}
|
||||
.searchQuery=${this.searchQuery}
|
||||
|
@ -663,6 +649,12 @@ class OpenTabsContextMenu extends MozLitElement {
|
|||
this.ownerViewPage.recordContextMenuTelemetry("copy-link", e);
|
||||
}
|
||||
|
||||
closeTab(e) {
|
||||
const tab = this.triggerNode.tabElement;
|
||||
tab?.ownerGlobal.gBrowser.removeTab(tab);
|
||||
this.ownerViewPage.recordContextMenuTelemetry("close-tab", e);
|
||||
}
|
||||
|
||||
moveTabsToStart(e) {
|
||||
const tab = this.triggerNode.tabElement;
|
||||
tab?.ownerGlobal.gBrowser.moveTabsToStart(tab);
|
||||
|
@ -756,6 +748,11 @@ class OpenTabsContextMenu extends MozLitElement {
|
|||
href="chrome://browser/content/firefoxview/firefoxview.css"
|
||||
/>
|
||||
<panel-list data-tab-type="opentabs">
|
||||
<panel-item
|
||||
data-l10n-id="fxviewtabrow-close-tab"
|
||||
data-l10n-attrs="accesskey"
|
||||
@click=${this.closeTab}
|
||||
></panel-item>
|
||||
<panel-item
|
||||
data-l10n-id="fxviewtabrow-move-tab"
|
||||
data-l10n-attrs="accesskey"
|
||||
|
@ -826,8 +823,6 @@ function getTabListItems(tabs) {
|
|||
primaryL10nArgs: JSON.stringify({ url }),
|
||||
secondaryL10nId: "fxviewtabrow-options-menu-button",
|
||||
secondaryL10nArgs: JSON.stringify({ tabTitle: tab.label }),
|
||||
tertiaryL10nId: "fxviewtabrow-close-tab-button",
|
||||
tertiaryL10nArgs: JSON.stringify({ tabTitle: tab.label }),
|
||||
soundPlaying: tab.hasAttribute("soundplaying"),
|
||||
tabElement: tab,
|
||||
time: tab.lastAccessed,
|
||||
|
|
|
@ -399,8 +399,6 @@ class RecentlyClosedTabsInView extends ViewPage {
|
|||
.tabItems=${this.searchResults || this.recentlyClosedTabs}
|
||||
@fxview-tab-list-secondary-action=${this.onDismissTab}
|
||||
@fxview-tab-list-primary-action=${this.onReopenTab}
|
||||
secondaryActionClass="dismiss-button"
|
||||
;
|
||||
></fxview-tab-list>
|
||||
`
|
||||
)}
|
||||
|
|
|
@ -426,8 +426,6 @@ class SyncedTabsInView extends ViewPage {
|
|||
maxTabsLength=${this.showAll ? -1 : this.maxTabsLength}
|
||||
@fxview-tab-list-primary-action=${this.onOpenLink}
|
||||
@fxview-tab-list-secondary-action=${this.onContextMenu}
|
||||
secondaryActionClass="options-button"
|
||||
,
|
||||
>
|
||||
${this.panelListTemplate()}
|
||||
</fxview-tab-list>`;
|
||||
|
|
|
@ -27,31 +27,37 @@ skip-if = ["true"] # Bug 1869605 and # Bug 1870296
|
|||
|
||||
["browser_firefoxview.js"]
|
||||
|
||||
["browser_firefoxview_tab.js"]
|
||||
|
||||
["browser_notification_dot.js"]
|
||||
skip-if = ["true"] # Bug 1851453
|
||||
|
||||
["browser_opentabs_changes.js"]
|
||||
|
||||
["browser_reload_firefoxview.js"]
|
||||
|
||||
["browser_tab_close_last_tab.js"]
|
||||
|
||||
["browser_tab_on_close_warning.js"]
|
||||
|
||||
["browser_firefoxview_paused.js"]
|
||||
|
||||
["browser_firefoxview_general_telemetry.js"]
|
||||
|
||||
["browser_firefoxview_navigation.js"]
|
||||
|
||||
["browser_firefoxview_paused.js"]
|
||||
|
||||
["browser_firefoxview_search_telemetry.js"]
|
||||
|
||||
["browser_firefoxview_tab.js"]
|
||||
|
||||
["browser_firefoxview_virtual_list.js"]
|
||||
|
||||
["browser_history_firefoxview.js"]
|
||||
skip-if = ["true"] # Bug 1877594
|
||||
|
||||
["browser_notification_dot.js"]
|
||||
skip-if = ["true"] # Bug 1851453
|
||||
["browser_opentabs_firefoxview.js"]
|
||||
|
||||
["browser_opentabs_cards.js"]
|
||||
fail-if = ["a11y_checks"] # Bugs 1858041, 1854625, and 1872174 clicked Show all link is not accessible because it is "hidden" when clicked
|
||||
|
||||
["browser_opentabs_changes.js"]
|
||||
|
||||
["browser_opentabs_firefoxview.js"]
|
||||
|
||||
["browser_opentabs_recency.js"]
|
||||
skip-if = [
|
||||
"os == 'win'",
|
||||
|
@ -63,14 +69,6 @@ skip-if = [
|
|||
|
||||
["browser_recentlyclosed_firefoxview.js"]
|
||||
|
||||
["browser_reload_firefoxview.js"]
|
||||
|
||||
["browser_syncedtabs_errors_firefoxview.js"]
|
||||
|
||||
["browser_syncedtabs_firefoxview.js"]
|
||||
|
||||
["browser_tab_close_last_tab.js"]
|
||||
|
||||
["browser_tab_list_keyboard_navigation.js"]
|
||||
|
||||
["browser_tab_on_close_warning.js"]
|
||||
|
|
|
@ -198,11 +198,7 @@ add_task(async function test_context_menu_new_window_telemetry() {
|
|||
let firstTabList = historyComponent.lists[0];
|
||||
let firstItem = firstTabList.rowEls[0];
|
||||
let panelList = historyComponent.panelList;
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
firstItem.secondaryButtonEl,
|
||||
{},
|
||||
content
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(firstItem.buttonEl, {}, content);
|
||||
await BrowserTestUtils.waitForEvent(panelList, "shown");
|
||||
await clearAllParentTelemetryEvents();
|
||||
let panelItems = Array.from(panelList.children).filter(
|
||||
|
@ -258,22 +254,14 @@ add_task(async function test_context_menu_private_window_telemetry() {
|
|||
let firstTabList = historyComponent.lists[0];
|
||||
let firstItem = firstTabList.rowEls[0];
|
||||
let panelList = historyComponent.panelList;
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
firstItem.secondaryButtonEl,
|
||||
{},
|
||||
content
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(firstItem.buttonEl, {}, content);
|
||||
await BrowserTestUtils.waitForEvent(panelList, "shown");
|
||||
await clearAllParentTelemetryEvents();
|
||||
let panelItems = Array.from(panelList.children).filter(
|
||||
panelItem => panelItem.nodeName === "PANEL-ITEM"
|
||||
);
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
firstItem.secondaryButtonEl,
|
||||
{},
|
||||
content
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(firstItem.buttonEl, {}, content);
|
||||
info("Context menu button clicked.");
|
||||
await BrowserTestUtils.waitForEvent(panelList, "shown");
|
||||
info("Context menu shown.");
|
||||
|
@ -335,22 +323,14 @@ add_task(async function test_context_menu_delete_from_history_telemetry() {
|
|||
let firstTabList = historyComponent.lists[0];
|
||||
let firstItem = firstTabList.rowEls[0];
|
||||
let panelList = historyComponent.panelList;
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
firstItem.secondaryButtonEl,
|
||||
{},
|
||||
content
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(firstItem.buttonEl, {}, content);
|
||||
await BrowserTestUtils.waitForEvent(panelList, "shown");
|
||||
await clearAllParentTelemetryEvents();
|
||||
let panelItems = Array.from(panelList.children).filter(
|
||||
panelItem => panelItem.nodeName === "PANEL-ITEM"
|
||||
);
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
firstItem.secondaryButtonEl,
|
||||
{},
|
||||
content
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(firstItem.buttonEl, {}, content);
|
||||
info("Context menu button clicked.");
|
||||
await BrowserTestUtils.waitForEvent(panelList, "shown");
|
||||
info("Context menu shown.");
|
||||
|
|
|
@ -106,7 +106,7 @@ async function getContextMenuPanelListForCard(card) {
|
|||
async function openContextMenuForItem(tabItem, card) {
|
||||
// click on the item's button element (more menu)
|
||||
// and wait for the panel list to be shown
|
||||
tabItem.secondaryButtonEl.click();
|
||||
tabItem.buttonEl.click();
|
||||
// NOTE: menu must populate with devices data before it can be rendered
|
||||
// so the creation of the panel-list can be async
|
||||
let panelList = await getContextMenuPanelListForCard(card);
|
||||
|
@ -148,44 +148,6 @@ async function moreMenuSetup() {
|
|||
return [cards, rows];
|
||||
}
|
||||
|
||||
add_task(async function test_close_open_tab() {
|
||||
await withFirefoxView({}, async browser => {
|
||||
const [cards, rows] = await moreMenuSetup();
|
||||
const firstTab = rows[0];
|
||||
const tertiaryButtonEl = firstTab.tertiaryButtonEl;
|
||||
|
||||
ok(tertiaryButtonEl, "Dismiss button exists");
|
||||
|
||||
await clearAllParentTelemetryEvents();
|
||||
let closeTabEvent = [
|
||||
["firefoxview_next", "close_open_tab", "tabs", undefined],
|
||||
];
|
||||
|
||||
let tabsUpdated = BrowserTestUtils.waitForEvent(
|
||||
NonPrivateTabs,
|
||||
"TabChange"
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(tertiaryButtonEl, {}, content);
|
||||
await tabsUpdated;
|
||||
Assert.deepEqual(
|
||||
getVisibleTabURLs(),
|
||||
[TEST_URL2, TEST_URL3],
|
||||
"First tab successfully removed"
|
||||
);
|
||||
|
||||
await telemetryEvent(closeTabEvent);
|
||||
|
||||
const openTabs = cards[0].ownerDocument.querySelector(
|
||||
"view-opentabs[name=opentabs]"
|
||||
);
|
||||
await waitUntilRowsMatch(openTabs, 0, [TEST_URL2, TEST_URL3]);
|
||||
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
BrowserTestUtils.removeTab(gBrowser.tabs[0]);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_more_menus() {
|
||||
await withFirefoxView({}, async browser => {
|
||||
let win = browser.ownerGlobal;
|
||||
|
@ -194,11 +156,11 @@ add_task(async function test_more_menus() {
|
|||
gBrowser.selectedTab = gBrowser.visibleTabs[0];
|
||||
Assert.equal(
|
||||
gBrowser.selectedTab.linkedBrowser.currentURI.spec,
|
||||
"about:mozilla",
|
||||
"Selected tab is about:mozilla"
|
||||
"about:blank",
|
||||
"Selected tab is about:blank"
|
||||
);
|
||||
|
||||
info(`Loading ${TEST_URL1} into the selected about:mozilla tab`);
|
||||
info(`Loading ${TEST_URL1} into the selected about:blank tab`);
|
||||
let tabLoaded = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
|
||||
win.gURLBar.focus();
|
||||
|
@ -214,18 +176,64 @@ add_task(async function test_more_menus() {
|
|||
"Prepared 3 open tabs"
|
||||
);
|
||||
|
||||
// Move Tab submenu item
|
||||
let firstTab = rows[0];
|
||||
// Open the panel list (more menu) from the first list item
|
||||
let panelList = await openContextMenuForItem(firstTab, cards[0]);
|
||||
|
||||
// Close Tab menu item
|
||||
info("Panel list shown. Clicking on panel-item");
|
||||
let panelItem = panelList.querySelector(
|
||||
"panel-item[data-l10n-id=fxviewtabrow-close-tab]"
|
||||
);
|
||||
let panelItemButton = panelItem.shadowRoot.querySelector(
|
||||
"button[role=menuitem]"
|
||||
);
|
||||
ok(panelItem, "Close Tab panel item exists");
|
||||
ok(
|
||||
panelItemButton,
|
||||
"Close Tab panel item button with role=menuitem exists"
|
||||
);
|
||||
|
||||
await clearAllParentTelemetryEvents();
|
||||
let contextMenuEvent = [
|
||||
[
|
||||
"firefoxview_next",
|
||||
"context_menu",
|
||||
"tabs",
|
||||
undefined,
|
||||
{ menu_action: "close-tab", data_type: "opentabs" },
|
||||
],
|
||||
];
|
||||
|
||||
// close a tab via the menu
|
||||
let tabChangeRaised = BrowserTestUtils.waitForEvent(
|
||||
NonPrivateTabs,
|
||||
"TabChange"
|
||||
);
|
||||
menuHidden = BrowserTestUtils.waitForEvent(panelList, "hidden");
|
||||
panelItemButton.click();
|
||||
info("Waiting for result of closing a tab via the menu");
|
||||
await tabChangeRaised;
|
||||
await cards[0].getUpdateComplete();
|
||||
await menuHidden;
|
||||
await telemetryEvent(contextMenuEvent);
|
||||
|
||||
Assert.deepEqual(
|
||||
getVisibleTabURLs(),
|
||||
[TEST_URL2, TEST_URL3],
|
||||
"Got the expected 2 open tabs"
|
||||
);
|
||||
|
||||
let openTabs = cards[0].ownerDocument.querySelector(
|
||||
"view-opentabs[name=opentabs]"
|
||||
);
|
||||
await waitUntilRowsMatch(openTabs, 0, [TEST_URL1, TEST_URL2, TEST_URL3]);
|
||||
await waitUntilRowsMatch(openTabs, 0, [TEST_URL2, TEST_URL3]);
|
||||
|
||||
is(firstTab.url, TEST_URL1, `First tab list item is ${TEST_URL1}`);
|
||||
// Move Tab submenu item
|
||||
firstTab = rows[0];
|
||||
is(firstTab.url, TEST_URL2, `First tab list item is ${TEST_URL2}`);
|
||||
|
||||
panelList = await openContextMenuForItem(firstTab, cards[0]);
|
||||
let moveTabsPanelItem = panelList.querySelector(
|
||||
"panel-item[data-l10n-id=fxviewtabrow-move-tab]"
|
||||
);
|
||||
|
@ -235,14 +243,15 @@ add_task(async function test_more_menus() {
|
|||
);
|
||||
ok(moveTabsSubmenuList, "Move tabs submenu panel list exists");
|
||||
|
||||
// navigate to the "Move tabs" submenu option, and
|
||||
// navigate down to the "Move tabs" submenu option, and
|
||||
// open it with the right arrow key
|
||||
EventUtils.synthesizeKey("KEY_ArrowDown", {});
|
||||
shown = BrowserTestUtils.waitForEvent(moveTabsSubmenuList, "shown");
|
||||
EventUtils.synthesizeKey("KEY_ArrowRight", {});
|
||||
await shown;
|
||||
|
||||
await clearAllParentTelemetryEvents();
|
||||
let contextMenuEvent = [
|
||||
contextMenuEvent = [
|
||||
[
|
||||
"firefoxview_next",
|
||||
"context_menu",
|
||||
|
@ -255,7 +264,7 @@ add_task(async function test_more_menus() {
|
|||
// click on the first option, which should be "Move to the end" since
|
||||
// this is the first tab
|
||||
menuHidden = BrowserTestUtils.waitForEvent(panelList, "hidden");
|
||||
let tabChangeRaised = BrowserTestUtils.waitForEvent(
|
||||
tabChangeRaised = BrowserTestUtils.waitForEvent(
|
||||
NonPrivateTabs,
|
||||
"TabChange"
|
||||
);
|
||||
|
@ -267,7 +276,7 @@ add_task(async function test_more_menus() {
|
|||
|
||||
Assert.deepEqual(
|
||||
getVisibleTabURLs(),
|
||||
[TEST_URL2, TEST_URL3, TEST_URL1],
|
||||
[TEST_URL3, TEST_URL2],
|
||||
"The last tab became the first tab"
|
||||
);
|
||||
|
||||
|
@ -275,15 +284,15 @@ add_task(async function test_more_menus() {
|
|||
// closing a tab since it very clearly reveals the issues
|
||||
// outlined in bug 1852622 when there are 3 or more tabs open
|
||||
// and one is moved via the more menus.
|
||||
await waitUntilRowsMatch(openTabs, 0, [TEST_URL2, TEST_URL3, TEST_URL1]);
|
||||
await waitUntilRowsMatch(openTabs, 0, [TEST_URL3, TEST_URL2]);
|
||||
|
||||
// Copy Link menu item (copyLink function that's called is a member of Viewpage.mjs)
|
||||
panelList = await openContextMenuForItem(firstTab, cards[0]);
|
||||
firstTab = rows[0];
|
||||
let panelItem = panelList.querySelector(
|
||||
panelItem = panelList.querySelector(
|
||||
"panel-item[data-l10n-id=fxviewtabrow-copy-link]"
|
||||
);
|
||||
let panelItemButton = panelItem.shadowRoot.querySelector(
|
||||
panelItemButton = panelItem.shadowRoot.querySelector(
|
||||
"button[role=menuitem]"
|
||||
);
|
||||
ok(panelItem, "Copy link panel item exists");
|
||||
|
@ -314,7 +323,7 @@ add_task(async function test_more_menus() {
|
|||
"text/plain",
|
||||
Ci.nsIClipboard.kGlobalClipboard
|
||||
);
|
||||
is(copiedText, TEST_URL2, "The correct url has been copied and pasted");
|
||||
is(copiedText, TEST_URL3, "The correct url has been copied and pasted");
|
||||
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
BrowserTestUtils.removeTab(gBrowser.tabs[0]);
|
||||
|
@ -340,11 +349,11 @@ add_task(async function test_send_device_submenu() {
|
|||
.callsFake(() => fxaDevicesWithCommands);
|
||||
|
||||
await withFirefoxView({}, async browser => {
|
||||
// TEST_URL1 is our only tab, left over from previous test
|
||||
// TEST_URL2 is our only tab, left over from previous test
|
||||
Assert.deepEqual(
|
||||
getVisibleTabURLs(),
|
||||
[TEST_URL1],
|
||||
`We initially have a single ${TEST_URL1} tab`
|
||||
[TEST_URL2],
|
||||
`We initially have a single ${TEST_URL2} tab`
|
||||
);
|
||||
let shown;
|
||||
|
||||
|
@ -369,6 +378,8 @@ add_task(async function test_send_device_submenu() {
|
|||
// open it with the right arrow key
|
||||
EventUtils.synthesizeKey("KEY_ArrowDown", {});
|
||||
EventUtils.synthesizeKey("KEY_ArrowDown", {});
|
||||
EventUtils.synthesizeKey("KEY_ArrowDown", {});
|
||||
|
||||
shown = BrowserTestUtils.waitForEvent(sendTabSubmenuList, "shown");
|
||||
EventUtils.synthesizeKey("KEY_ArrowRight", {});
|
||||
await shown;
|
||||
|
@ -378,9 +389,9 @@ add_task(async function test_send_device_submenu() {
|
|||
.expects("sendTabToDevice")
|
||||
.once()
|
||||
.withExactArgs(
|
||||
TEST_URL1,
|
||||
TEST_URL2,
|
||||
[fxaDevicesWithCommands[0]],
|
||||
"Gort! Klaatu barada nikto!"
|
||||
"mochitest index /"
|
||||
)
|
||||
.returns(true);
|
||||
|
||||
|
|
|
@ -1,161 +0,0 @@
|
|||
const { NonPrivateTabs } = ChromeUtils.importESModule(
|
||||
"resource:///modules/OpenTabs.sys.mjs"
|
||||
);
|
||||
|
||||
add_task(async function test_open_tab_row_navigation() {
|
||||
await withFirefoxView({}, async browser => {
|
||||
const { document } = browser.contentWindow;
|
||||
let win = browser.ownerGlobal;
|
||||
|
||||
await navigateToCategoryAndWait(document, "opentabs");
|
||||
const openTabs = document.querySelector("view-opentabs[name=opentabs]");
|
||||
|
||||
await TestUtils.waitForCondition(
|
||||
() => openTabs.viewCards[0].tabList?.rowEls.length === 1,
|
||||
"The tab list hasn't rendered"
|
||||
);
|
||||
|
||||
// Focus tab row
|
||||
let tabRow = openTabs.viewCards[0].tabList.rowEls[0];
|
||||
let tabRowFocused = BrowserTestUtils.waitForEvent(tabRow, "focus", win);
|
||||
tabRow.focus();
|
||||
await tabRowFocused;
|
||||
info("The tab row main element has focus.");
|
||||
|
||||
// Navigate right to context menu button
|
||||
let secondaryButtonFocused = BrowserTestUtils.waitForEvent(
|
||||
tabRow.secondaryButtonEl,
|
||||
"focus",
|
||||
win
|
||||
);
|
||||
EventUtils.synthesizeKey("KEY_ArrowRight", {}, win);
|
||||
await secondaryButtonFocused;
|
||||
info("The context menu button has focus.");
|
||||
|
||||
// Navigate right to close button
|
||||
let tertiaryButtonFocused = BrowserTestUtils.waitForEvent(
|
||||
tabRow.tertiaryButtonEl,
|
||||
"focus",
|
||||
win
|
||||
);
|
||||
EventUtils.synthesizeKey("KEY_ArrowRight", {}, win);
|
||||
await tertiaryButtonFocused;
|
||||
info("The close button has focus");
|
||||
|
||||
// Navigate left to context menu button
|
||||
secondaryButtonFocused = BrowserTestUtils.waitForEvent(
|
||||
tabRow.secondaryButtonEl,
|
||||
"focus",
|
||||
win
|
||||
);
|
||||
EventUtils.synthesizeKey("KEY_ArrowLeft", {}, win);
|
||||
await secondaryButtonFocused;
|
||||
info("The context menu button has focus.");
|
||||
|
||||
// Navigate left to tab row main element
|
||||
tabRowFocused = BrowserTestUtils.waitForEvent(tabRow.mainEl, "focus", win);
|
||||
EventUtils.synthesizeKey("KEY_ArrowLeft", {}, win);
|
||||
await tabRowFocused;
|
||||
info("The tab row main element has focus.");
|
||||
});
|
||||
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
BrowserTestUtils.removeTab(gBrowser.tabs[0]);
|
||||
}
|
||||
});
|
||||
|
||||
add_task(async function test_open_tab_row_with_sound_navigation() {
|
||||
const tabWithSound = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
"http://mochi.test:8888/browser/dom/base/test/file_audioLoop.html",
|
||||
true
|
||||
);
|
||||
const tabsUpdated = await BrowserTestUtils.waitForEvent(
|
||||
NonPrivateTabs,
|
||||
"TabChange"
|
||||
);
|
||||
await withFirefoxView({}, async browser => {
|
||||
const { document } = browser.contentWindow;
|
||||
let win = browser.ownerGlobal;
|
||||
|
||||
await navigateToCategoryAndWait(document, "opentabs");
|
||||
const openTabs = document.querySelector("view-opentabs[name=opentabs]");
|
||||
await TestUtils.waitForCondition(() =>
|
||||
tabWithSound.hasAttribute("soundplaying")
|
||||
);
|
||||
await tabsUpdated;
|
||||
await openTabs.updateComplete;
|
||||
|
||||
await TestUtils.waitForCondition(
|
||||
() => openTabs.viewCards[0].tabList?.rowEls.length === 2,
|
||||
"The tab list hasn't rendered"
|
||||
);
|
||||
|
||||
// Focus tab row
|
||||
let tabRow = openTabs.viewCards[0].tabList.rowEls[1];
|
||||
let tabRowFocused = BrowserTestUtils.waitForEvent(tabRow, "focus", win);
|
||||
tabRow.focus();
|
||||
await tabRowFocused;
|
||||
info("The tab row main element has focus.");
|
||||
|
||||
// Navigate right to media button
|
||||
let mediaButtonFocused = BrowserTestUtils.waitForEvent(
|
||||
tabRow.mediaButtonEl,
|
||||
"focus",
|
||||
win
|
||||
);
|
||||
EventUtils.synthesizeKey("KEY_ArrowRight", {}, win);
|
||||
await mediaButtonFocused;
|
||||
info("The media button has focus.");
|
||||
|
||||
// Navigate right to context menu button
|
||||
let secondaryButtonFocused = BrowserTestUtils.waitForEvent(
|
||||
tabRow.secondaryButtonEl,
|
||||
"focus",
|
||||
win
|
||||
);
|
||||
EventUtils.synthesizeKey("KEY_ArrowRight", {}, win);
|
||||
await secondaryButtonFocused;
|
||||
info("The context menu button has focus.");
|
||||
|
||||
// Navigate right to close button
|
||||
let tertiaryButtonFocused = BrowserTestUtils.waitForEvent(
|
||||
tabRow.tertiaryButtonEl,
|
||||
"focus",
|
||||
win
|
||||
);
|
||||
EventUtils.synthesizeKey("KEY_ArrowRight", {}, win);
|
||||
await tertiaryButtonFocused;
|
||||
info("The close button has focus");
|
||||
|
||||
// Navigate left to context menuo button
|
||||
secondaryButtonFocused = BrowserTestUtils.waitForEvent(
|
||||
tabRow.secondaryButtonEl,
|
||||
"focus",
|
||||
win
|
||||
);
|
||||
EventUtils.synthesizeKey("KEY_ArrowLeft", {}, win);
|
||||
await secondaryButtonFocused;
|
||||
info("The context menu button has focus.");
|
||||
|
||||
// Navigate left to media button
|
||||
mediaButtonFocused = BrowserTestUtils.waitForEvent(
|
||||
tabRow.mediaButtonEl,
|
||||
"focus",
|
||||
win
|
||||
);
|
||||
EventUtils.synthesizeKey("KEY_ArrowLeft", {}, win);
|
||||
await mediaButtonFocused;
|
||||
info("The media button has focus.");
|
||||
|
||||
// Navigate left to main element of tab row
|
||||
tabRowFocused = BrowserTestUtils.waitForEvent(tabRow.mainEl, "focus", win);
|
||||
EventUtils.synthesizeKey("KEY_ArrowLeft", {}, win);
|
||||
await tabRowFocused;
|
||||
info("The tab row main element has focus.");
|
||||
});
|
||||
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
BrowserTestUtils.removeTab(gBrowser.tabs[0]);
|
||||
}
|
||||
});
|
|
@ -308,12 +308,12 @@
|
|||
);
|
||||
await arrowRight();
|
||||
ok(
|
||||
isActiveElement(tabItems[0].secondaryButtonEl),
|
||||
isActiveElement(tabItems[0].buttonEl),
|
||||
"Focus should be on the first row's context menu button element of the list"
|
||||
);
|
||||
await arrowDown();
|
||||
ok(
|
||||
isActiveElement(tabItems[1].secondaryButtonEl),
|
||||
isActiveElement(tabItems[1].buttonEl),
|
||||
"Focus should be on the second row's context menu button element of the list"
|
||||
);
|
||||
await arrowLeft();
|
||||
|
|
|
@ -80,11 +80,7 @@ You'll need to pass along some of the following properties:
|
|||
* `primaryL10nId` (**Optional**) - The l10n id to be used for the primary action element. This fluent string should ONLY define a `.title` attribute to describe the link element in each row.
|
||||
* `primaryL10nArgs` (**Optional**) - The l10n args you can optionally pass for the primary action element
|
||||
* `secondaryL10nId` (**Optional**) - The l10n id to be used for the secondary action button. This fluent string should ONLY define a `.title` attribute to describe the secondary button in each row.
|
||||
* `tertiaryL10nId` (**Optional**) - The l10n id to be used for the tertiary action button. This fluent string should ONLY define a `.title` attribute to describe the secondary button in each row.
|
||||
* `secondaryL10nArgs` (**Optional**) - The l10n args you can optionally pass for the secondary action button
|
||||
* `tertiaryL10nArgs` (**Optional**) - The l10n args you can optionally pass for the tertiary action button
|
||||
* `secondaryActionClass` (**Optional**) - The class used to style the secondary action button. `options-button` or `dismiss-button`
|
||||
* `tertiaryActionClass` (**Optional**) - The class used to style the tertiary action button. `options-button` or `dismiss-button`
|
||||
* `tabElement` (**Optional**) - The MozTabbrowserTab element for the tab item.
|
||||
* `sourceClosedId` (**Optional**) - The closedId of the closed window the tab is from if applicable.
|
||||
* `sourceWindowId` (**Optional**) - The SessionStore id of the window the tab is from if applicable.
|
||||
|
|
|
@ -15,11 +15,6 @@ fxviewtabrow-time = { DATETIME($time, timeStyle: "short") }
|
|||
fxviewtabrow-tabs-list-tab =
|
||||
.title = Open { $targetURI } in a new tab
|
||||
|
||||
# Variables:
|
||||
# $tabTitle (string) - Title of tab being closed
|
||||
fxviewtabrow-close-tab-button =
|
||||
.title = Close { $tabTitle }
|
||||
|
||||
# Variables:
|
||||
# $tabTitle (string) - Title of tab being dismissed
|
||||
fxviewtabrow-dismiss-tab-button =
|
||||
|
|
|
@ -3893,20 +3893,6 @@ firefoxview_next:
|
|||
- 1842616
|
||||
expiry_version: "never"
|
||||
release_channel_collection: opt-out
|
||||
close_open_tab:
|
||||
objects: ["tabs"]
|
||||
description: >
|
||||
Recorded when a tab is closed via the close button on an open tab row.
|
||||
notification_emails:
|
||||
- firefoxview@mozilla.com
|
||||
products:
|
||||
- "firefox"
|
||||
record_in_processes:
|
||||
- main
|
||||
bug_numbers:
|
||||
- 1857298
|
||||
expiry_version: "never"
|
||||
release_channel_collection: opt-out
|
||||
browser_context_menu:
|
||||
objects: ["tabs"]
|
||||
description: >
|
||||
|
|
Загрузка…
Ссылка в новой задаче