mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +00:00
Backed out 2 changesets (bug 1911626
) for causing mochitest crashes on browser_view_sidebar_menu.js (finished). CLOSED TREE
Backed out changeset ed0f57c2d2af (bug1911626
) Backed out changeset 2ee9263eea02 (bug1911626
)
This commit is contained in:
parent
3223cbcbcc
commit
e62eba3857
@ -300,11 +300,6 @@
|
||||
<menuitem data-l10n-id="sidebar-context-menu-open-in-private-window"
|
||||
id="sidebar-synced-tabs-context-open-in-private-window"/>
|
||||
<menuseparator/>
|
||||
<menuitem data-l10n-id="sidebar-context-menu-close-remote-tab"
|
||||
id="sidebar-context-menu-close-remote-tab"
|
||||
data-l10n-args='{"deviceName": ""}'
|
||||
disabled="true"/>
|
||||
<menuseparator/>
|
||||
<menuitem data-l10n-id="sidebar-context-menu-bookmark-tab"
|
||||
id="sidebar-synced-tabs-context-bookmark-tab"/>
|
||||
<menuitem data-l10n-id="sidebar-context-menu-copy-link"
|
||||
|
@ -6,8 +6,6 @@ const lazy = {};
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
|
||||
SyncedTabs: "resource://services-sync/SyncedTabs.sys.mjs",
|
||||
SyncedTabsManagement: "resource://services-sync/SyncedTabs.sys.mjs",
|
||||
COMMAND_CLOSETAB: "resource://gre/modules/FxAccountsCommon.sys.mjs",
|
||||
});
|
||||
|
||||
import { SyncedTabsErrorHandler } from "resource:///modules/firefox-view-synced-tabs-error-handler.sys.mjs";
|
||||
@ -71,11 +69,6 @@ export class SyncedTabsController {
|
||||
this.observe = this.observe.bind(this);
|
||||
this.host = host;
|
||||
this.host.addController(this);
|
||||
// Track tabs requested close per device but not-yet-sent,
|
||||
// it'll be in the form of {fxaDeviceId: Set(urls)}
|
||||
this._pendingCloseTabs = new Map();
|
||||
// The last closed URL, for undo purposes
|
||||
this.lastClosedURL = null;
|
||||
}
|
||||
|
||||
hostConnected() {
|
||||
@ -141,10 +134,6 @@ export class SyncedTabsController {
|
||||
await this.updateStates(errorState);
|
||||
}
|
||||
if (topic == SYNCED_TABS_CHANGED) {
|
||||
// Usually this means we performed a sync, so clear the
|
||||
// "in-queue" things as those most likely got flushed
|
||||
this._pendingCloseTabs = new Map();
|
||||
this.lastClosedURL = null;
|
||||
await this.getSyncedTabData();
|
||||
}
|
||||
}
|
||||
@ -243,7 +232,6 @@ export class SyncedTabsController {
|
||||
renderInfo[tab.client] = {
|
||||
name: tab.device,
|
||||
deviceType: tab.deviceType,
|
||||
canClose: !!tab.availableCommands[lazy.COMMAND_CLOSETAB],
|
||||
tabs: [],
|
||||
};
|
||||
}
|
||||
@ -306,7 +294,6 @@ export class SyncedTabsController {
|
||||
title: tab.title,
|
||||
time: tab.lastUsed * 1000,
|
||||
url: tab.url,
|
||||
fxaDeviceId: tab.fxaDeviceId,
|
||||
primaryL10nId: "firefoxview-tabs-list-tab-button",
|
||||
primaryL10nArgs: JSON.stringify({ targetURI: tab.url }),
|
||||
secondaryL10nId: this.contextMenu
|
||||
@ -343,32 +330,4 @@ export class SyncedTabsController {
|
||||
|
||||
this.updateTabsList(tabs);
|
||||
}
|
||||
|
||||
// Wrappers and helpful methods for SyncedTabManagement
|
||||
// so FxView and Sidebar don't need to import
|
||||
requestCloseRemoteTab(fxaDeviceId, url) {
|
||||
if (!this._pendingCloseTabs.has(fxaDeviceId)) {
|
||||
this._pendingCloseTabs.set(fxaDeviceId, new Set());
|
||||
}
|
||||
this._pendingCloseTabs.get(fxaDeviceId).add(url);
|
||||
this.lastClosedURL = url;
|
||||
lazy.SyncedTabsManagement.enqueueTabToClose(fxaDeviceId, url);
|
||||
}
|
||||
|
||||
removePendingTabToClose(fxaDeviceId, url) {
|
||||
const urls = this._pendingCloseTabs.get(fxaDeviceId);
|
||||
if (urls) {
|
||||
urls.delete(url);
|
||||
if (!urls.size) {
|
||||
this._pendingCloseTabs.delete(fxaDeviceId);
|
||||
}
|
||||
}
|
||||
this.lastClosedURL = null;
|
||||
lazy.SyncedTabsManagement.removePendingTabToClose(fxaDeviceId, url);
|
||||
}
|
||||
|
||||
isURLQueuedToClose(fxaDeviceId, url) {
|
||||
const urls = this._pendingCloseTabs.get(fxaDeviceId);
|
||||
return urls && urls.has(url);
|
||||
}
|
||||
}
|
||||
|
@ -37,11 +37,6 @@
|
||||
:host([compact]) & {
|
||||
grid-template-columns: min-content auto;
|
||||
}
|
||||
|
||||
&[disabled="true"] {
|
||||
pointer-events: none;
|
||||
color: var(--panel-disabled-color);
|
||||
}
|
||||
}
|
||||
|
||||
.fxview-tab-row-main,
|
||||
@ -130,8 +125,3 @@
|
||||
.fxview-tab-row-button.options-button::part(button) {
|
||||
background-image: url("chrome://global/skin/icons/more.svg");
|
||||
}
|
||||
|
||||
.fxview-tab-row-button.undo-button::part(button) {
|
||||
font-size: var(--font-size-small);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
@ -233,13 +233,11 @@ function setupRecentDeviceListMocks() {
|
||||
name: "My desktop",
|
||||
isCurrentDevice: true,
|
||||
type: "desktop",
|
||||
availableCommands: {},
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "My iphone",
|
||||
type: "mobile",
|
||||
availableCommands: {},
|
||||
},
|
||||
]);
|
||||
|
||||
@ -249,11 +247,6 @@ function setupRecentDeviceListMocks() {
|
||||
email: "email@example.com",
|
||||
});
|
||||
|
||||
// whatever was passed in was the "found" client
|
||||
sandbox
|
||||
.stub(SyncedTabs._internal, "_getClientFxaDeviceId")
|
||||
.callsFake(clientId => clientId);
|
||||
|
||||
return sandbox;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
<link rel="localization" href="browser/sidebar.ftl" />
|
||||
<link rel="localization" href="browser/firefoxView.ftl" />
|
||||
<link rel="localization" href="toolkit/branding/brandings.ftl" />
|
||||
<link rel="localization" href="toolkit/global/textActions.ftl" />
|
||||
<link rel="stylesheet" href="chrome://global/skin/global.css" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
@ -33,10 +32,6 @@
|
||||
type="module"
|
||||
src="chrome://browser/content/firefoxview/fxview-search-textbox.mjs"
|
||||
></script>
|
||||
<script
|
||||
type="module"
|
||||
src="chrome://browser/content/sidebar/sidebar-tab-list.mjs"
|
||||
></script>
|
||||
<script
|
||||
type="module"
|
||||
src="chrome://browser/content/firefoxview/fxview-tab-list.mjs"
|
||||
|
@ -30,7 +30,6 @@ class SyncedTabsInSidebar extends SidebarPage {
|
||||
constructor() {
|
||||
super();
|
||||
this.onSearchQuery = this.onSearchQuery.bind(this);
|
||||
this.onSecondaryAction = this.onSecondaryAction.bind(this);
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
@ -49,21 +48,10 @@ class SyncedTabsInSidebar extends SidebarPage {
|
||||
}
|
||||
|
||||
handleContextMenuEvent(e) {
|
||||
this.triggerNode = this.findTriggerNode(e, "sidebar-tab-row");
|
||||
this.triggerNode = this.findTriggerNode(e, "fxview-tab-row");
|
||||
if (!this.triggerNode) {
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
const contextMenu = this._contextMenu;
|
||||
const closeTabMenuItem = contextMenu.querySelector(
|
||||
"#sidebar-context-menu-close-remote-tab"
|
||||
);
|
||||
closeTabMenuItem.setAttribute(
|
||||
"data-l10n-args",
|
||||
this.triggerNode.secondaryL10nArgs
|
||||
);
|
||||
// Enable the feature only if the device supports it
|
||||
closeTabMenuItem.disabled = !this.triggerNode.canClose;
|
||||
}
|
||||
|
||||
handleCommandEvent(e) {
|
||||
@ -74,13 +62,6 @@ class SyncedTabsInSidebar extends SidebarPage {
|
||||
this.triggerNode.title
|
||||
);
|
||||
break;
|
||||
case "sidebar-context-menu-close-remote-tab":
|
||||
this.requestOrRemoveTabToClose(
|
||||
this.triggerNode.url,
|
||||
this.triggerNode.fxaDeviceId,
|
||||
this.triggerNode.secondaryActionClass
|
||||
);
|
||||
break;
|
||||
default:
|
||||
super.handleCommandEvent(e);
|
||||
break;
|
||||
@ -91,22 +72,6 @@ class SyncedTabsInSidebar extends SidebarPage {
|
||||
this.searchTextbox?.focus();
|
||||
}
|
||||
|
||||
onSecondaryAction(e) {
|
||||
const { url, fxaDeviceId, secondaryActionClass } = e.originalTarget;
|
||||
this.requestOrRemoveTabToClose(url, fxaDeviceId, secondaryActionClass);
|
||||
}
|
||||
|
||||
requestOrRemoveTabToClose(url, fxaDeviceId, secondaryActionClass) {
|
||||
if (secondaryActionClass === "dismiss-button") {
|
||||
// Set new pending close tab
|
||||
this.controller.requestCloseRemoteTab(fxaDeviceId, url);
|
||||
} else if (secondaryActionClass === "undo-button") {
|
||||
// User wants to undo
|
||||
this.controller.removePendingTabToClose(fxaDeviceId, url);
|
||||
}
|
||||
this.requestUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* The template shown when the list of synced devices is currently
|
||||
* unavailable.
|
||||
@ -172,13 +137,12 @@ class SyncedTabsInSidebar extends SidebarPage {
|
||||
icon
|
||||
class=${deviceType}
|
||||
>
|
||||
<sidebar-tab-list
|
||||
<fxview-tab-list
|
||||
compactRows
|
||||
.tabItems=${tabItems}
|
||||
.tabItems=${ifDefined(tabItems)}
|
||||
.updatesPaused=${false}
|
||||
.searchQuery=${this.controller.searchQuery}
|
||||
@fxview-tab-list-primary-action=${navigateToLink}
|
||||
@fxview-tab-list-secondary-action=${this.onSecondaryAction}
|
||||
/>
|
||||
</moz-card>`;
|
||||
}
|
||||
@ -228,13 +192,9 @@ class SyncedTabsInSidebar extends SidebarPage {
|
||||
*/
|
||||
deviceListTemplate() {
|
||||
return Object.values(this.controller.getRenderInfo()).map(
|
||||
({ name: deviceName, deviceType, tabItems, canClose, tabs }) => {
|
||||
({ name: deviceName, deviceType, tabItems, tabs }) => {
|
||||
if (tabItems.length) {
|
||||
return this.deviceTemplate(
|
||||
deviceName,
|
||||
deviceType,
|
||||
this.getTabItems(tabItems, deviceName, canClose)
|
||||
);
|
||||
return this.deviceTemplate(deviceName, deviceType, tabItems);
|
||||
} else if (tabs.length) {
|
||||
return this.noSearchResultsTemplate(deviceName, deviceType);
|
||||
}
|
||||
@ -243,50 +203,6 @@ class SyncedTabsInSidebar extends SidebarPage {
|
||||
);
|
||||
}
|
||||
|
||||
getTabItems(items, deviceName, canClose) {
|
||||
return items
|
||||
.map(item => {
|
||||
// We always show the option to close remotely on right-click but
|
||||
// disable it if the device doesn't support actually closing it
|
||||
let secondaryL10nId = "synced-tabs-context-close-tab-title";
|
||||
let secondaryL10nArgs = JSON.stringify({ deviceName });
|
||||
if (!canClose) {
|
||||
return {
|
||||
...item,
|
||||
canClose,
|
||||
secondaryL10nId,
|
||||
secondaryL10nArgs,
|
||||
};
|
||||
}
|
||||
|
||||
// Default show the close/dismiss button
|
||||
let secondaryActionClass = "dismiss-button";
|
||||
item.closeRequested = false;
|
||||
|
||||
// If this item has been requested to be closed, show
|
||||
// the undo instead
|
||||
if (item.url === this.controller.lastClosedURL) {
|
||||
secondaryActionClass = "undo-button";
|
||||
secondaryL10nId = "text-action-undo";
|
||||
secondaryL10nArgs = null;
|
||||
item.closeRequested = true;
|
||||
}
|
||||
|
||||
return {
|
||||
...item,
|
||||
canClose,
|
||||
secondaryActionClass,
|
||||
secondaryL10nId,
|
||||
secondaryL10nArgs,
|
||||
};
|
||||
})
|
||||
.filter(
|
||||
item =>
|
||||
!this.controller.isURLQueuedToClose(item.fxaDeviceId, item.url) ||
|
||||
item.url === this.controller.lastClosedURL
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
const messageCard = this.controller.getMessageCard();
|
||||
return html`
|
||||
|
@ -42,20 +42,16 @@ export class SidebarTabList extends FxviewTabListBase {
|
||||
return html`
|
||||
<sidebar-tab-row
|
||||
?active=${i == this.activeIndex}
|
||||
.canClose=${ifDefined(tabItem.canClose)}
|
||||
.closedId=${ifDefined(tabItem.closedId)}
|
||||
.closedId=${ifDefined(tabItem.closedId || tabItem.closedId)}
|
||||
compact
|
||||
.currentActiveElementId=${this.currentActiveElementId}
|
||||
.closeRequested=${tabItem.closeRequested}
|
||||
.fxaDeviceId=${ifDefined(tabItem.fxaDeviceId)}
|
||||
.favicon=${tabItem.icon}
|
||||
.hasPopup=${this.hasPopup}
|
||||
.primaryL10nArgs=${ifDefined(tabItem.primaryL10nArgs)}
|
||||
.primaryL10nId=${tabItem.primaryL10nId}
|
||||
role="listitem"
|
||||
.searchQuery=${ifDefined(this.searchQuery)}
|
||||
.secondaryActionClass=${this.secondaryActionClass ??
|
||||
tabItem.secondaryActionClass}
|
||||
.secondaryActionClass=${this.secondaryActionClass}
|
||||
.secondaryL10nArgs=${ifDefined(tabItem.secondaryL10nArgs)}
|
||||
.secondaryL10nId=${tabItem.secondaryL10nId}
|
||||
.sourceClosedId=${ifDefined(tabItem.sourceClosedId)}
|
||||
@ -98,7 +94,7 @@ export class SidebarTabRow extends FxviewTabRowBase {
|
||||
[this.secondaryActionClass]: this.secondaryActionClass,
|
||||
})}
|
||||
data-l10n-args=${ifDefined(this.secondaryL10nArgs)}
|
||||
data-l10n-id=${ifDefined(this.secondaryL10nId)}
|
||||
data-l10n-id=${this.secondaryL10nId}
|
||||
id="fxview-tab-row-secondary-button"
|
||||
type="icon ghost"
|
||||
@click=${this.secondaryActionHandler}
|
||||
@ -113,10 +109,7 @@ export class SidebarTabRow extends FxviewTabRowBase {
|
||||
href="chrome://browser/content/sidebar/sidebar-tab-row.css"
|
||||
/>
|
||||
<a
|
||||
class=${classMap({
|
||||
"fxview-tab-row-main": true,
|
||||
})}
|
||||
disabled=${this.closeRequested}
|
||||
class="fxview-tab-row-main"
|
||||
data-l10n-args=${ifDefined(this.primaryL10nArgs)}
|
||||
data-l10n-id=${ifDefined(this.primaryL10nId)}
|
||||
href=${ifDefined(this.url)}
|
||||
|
@ -7,6 +7,5 @@
|
||||
|
||||
:host(:hover) & {
|
||||
visibility: visible;
|
||||
justify-self: end;
|
||||
}
|
||||
}
|
||||
|
@ -30,11 +30,6 @@ const tabClients = [
|
||||
icon: "https://sinonjs.org/assets/images/favicon.png",
|
||||
lastUsed: 1655391592, // Thu Jun 16 2022 14:59:52 GMT+0000
|
||||
client: 1,
|
||||
fxaDeviceId: "1",
|
||||
availableCommands: {
|
||||
"https://identity.mozilla.com/cmd/close-uri/v1": "encryption_is_cool",
|
||||
},
|
||||
secondaryL10nArgs: '{"deviceName": "My Desktop"}',
|
||||
},
|
||||
{
|
||||
device: "My desktop",
|
||||
@ -45,11 +40,6 @@ const tabClients = [
|
||||
icon: "https://www.mozilla.org/media/img/favicons/mozilla/favicon.d25d81d39065.ico",
|
||||
lastUsed: 1655730486, // Mon Jun 20 2022 13:08:06 GMT+0000
|
||||
client: 1,
|
||||
fxaDeviceId: "1",
|
||||
availableCommands: {
|
||||
"https://identity.mozilla.com/cmd/close-uri/v1": "encryption_is_cool",
|
||||
},
|
||||
secondaryL10nArgs: '{"deviceName": "My Desktop"}',
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -69,9 +59,6 @@ const tabClients = [
|
||||
icon: "page-icon:https://www.theguardian.com/",
|
||||
lastUsed: 1655291890, // Wed Jun 15 2022 11:18:10 GMT+0000
|
||||
client: 2,
|
||||
fxaDeviceId: "2",
|
||||
availableCommands: {},
|
||||
secondaryL10nArgs: '{"deviceName": "My iphone"}',
|
||||
},
|
||||
{
|
||||
device: "My iphone",
|
||||
@ -82,9 +69,6 @@ const tabClients = [
|
||||
icon: "page-icon:https://www.thetimes.co.uk/",
|
||||
lastUsed: 1655727485, // Mon Jun 20 2022 12:18:05 GMT+0000
|
||||
client: 2,
|
||||
fxaDeviceId: "2",
|
||||
availableCommands: {},
|
||||
secondaryL10nArgs: '{"deviceName": "My iphone"}',
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -109,70 +93,18 @@ add_task(async function test_tabs() {
|
||||
const card = component.cards[i];
|
||||
Assert.equal(card.heading, client.name, "Device name is correct.");
|
||||
const rows = await TestUtils.waitForCondition(() => {
|
||||
const { rowEls } = card.querySelector("sidebar-tab-list");
|
||||
const { rowEls } = card.querySelector("fxview-tab-list");
|
||||
return rowEls.length === client.tabs.length && rowEls;
|
||||
}, "Device has the correct number of tabs.");
|
||||
for (const [j, row] of rows.entries()) {
|
||||
const tabData = client.tabs[j];
|
||||
Assert.equal(row.title, tabData.title, `Tab ${j + 1} has correct title.`);
|
||||
Assert.equal(row.url, tabData.url, `Tab ${j + 1} has correct URL.`);
|
||||
|
||||
// We need to wait for the document to flush to ensure it's completely opened
|
||||
let content = SidebarController.browser.contentWindow;
|
||||
await content.promiseDocumentFlushed(() => {});
|
||||
await EventUtils.synthesizeMouseAtCenter(
|
||||
row.mainEl,
|
||||
{ type: "mouseover" },
|
||||
content
|
||||
);
|
||||
|
||||
// We set the second client to not have CloseTab as an available command
|
||||
// to ensure we properly test that path
|
||||
if (client.id === 2) {
|
||||
Assert.ok(
|
||||
!row.renderRoot.querySelector(".dismiss-button"),
|
||||
`Dismiss button should NOT appear for tab ${
|
||||
j + 1
|
||||
} on the client that does not have available commands.`
|
||||
);
|
||||
} else {
|
||||
// We need to use renderRoot since Lit components querySelector
|
||||
// won't return the right things
|
||||
await BrowserTestUtils.waitForCondition(
|
||||
() => row.renderRoot.querySelector(".dismiss-button") !== null,
|
||||
`Dismiss button should appear for tab ${j + 1}`
|
||||
);
|
||||
// Check the presence of the dismiss button
|
||||
const dismissButton = row.renderRoot.querySelector(".dismiss-button");
|
||||
Assert.ok(dismissButton, `Dismiss button is present on tab ${j + 1}.`);
|
||||
// Simulate clicking the dismiss button
|
||||
EventUtils.synthesizeMouseAtCenter(dismissButton, {}, content);
|
||||
|
||||
await TestUtils.waitForCondition(() => {
|
||||
const undoButton = row.renderRoot.querySelector(".undo-button");
|
||||
return undoButton && undoButton.style.display !== "none";
|
||||
}, `Undo button is shown after dismissing tab ${j + 1}.`);
|
||||
|
||||
// Simulate clicking the undo button
|
||||
const undoButton = row.renderRoot.querySelector(".undo-button");
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
row.mainEl,
|
||||
{ type: "mouseover" },
|
||||
content
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(undoButton, {}, content);
|
||||
await TestUtils.waitForCondition(() => {
|
||||
return (
|
||||
row.renderRoot.querySelector(".dismiss-button") &&
|
||||
!row.renderRoot.querySelector(".undo-button")
|
||||
);
|
||||
}, `Dismiss button is restored after undoing tab ${j + 1}.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
info("Copy the first link.");
|
||||
const tabList = component.cards[0].querySelector("sidebar-tab-list");
|
||||
const tabList = component.cards[0].querySelector("fxview-tab-list");
|
||||
const menuItem = document.getElementById(
|
||||
"sidebar-synced-tabs-context-copy-link"
|
||||
);
|
||||
@ -200,45 +132,4 @@ add_task(async function test_syncedtabs_searchbox_focus() {
|
||||
searchTextbox,
|
||||
"Check search box is focused"
|
||||
);
|
||||
SidebarController.hide();
|
||||
});
|
||||
|
||||
add_task(async function test_close_remote_tab_context_menu() {
|
||||
const sandbox = sinon.createSandbox();
|
||||
sandbox.stub(lazy.SyncedTabsErrorHandler, "getErrorType").returns(null);
|
||||
sandbox.stub(lazy.TabsSetupFlowManager, "uiStateIndex").value(4);
|
||||
sandbox.stub(lazy.SyncedTabs, "getTabClients").resolves(tabClients);
|
||||
sandbox
|
||||
.stub(lazy.SyncedTabs, "createRecentTabsList")
|
||||
.resolves(tabClients.flatMap(client => client.tabs));
|
||||
|
||||
await SidebarController.show("viewTabsSidebar");
|
||||
const { contentDocument } = SidebarController.browser;
|
||||
const component = contentDocument.querySelector("sidebar-syncedtabs");
|
||||
Assert.ok(component, "Synced tabs panel is shown.");
|
||||
const contextMenu = SidebarController.currentContextMenu;
|
||||
|
||||
// Verify that the context menu is available
|
||||
info("Check if the context menu is present in the DOM.");
|
||||
Assert.ok(contextMenu, "Context menu is present.");
|
||||
|
||||
// Verify "Close Remote Tab" context menu item
|
||||
info("Verify 'Close Remote Tab' context menu item.");
|
||||
const rows = await TestUtils.waitForCondition(() => {
|
||||
const { rowEls } = component.cards[0].querySelector("sidebar-tab-list");
|
||||
return rowEls.length && rowEls;
|
||||
}, "Device has the correct number of tabs.");
|
||||
await openAndWaitForContextMenu(contextMenu, rows[0], () => {
|
||||
const closeTabMenuItem = contextMenu.querySelector(
|
||||
"#sidebar-context-menu-close-remote-tab"
|
||||
);
|
||||
Assert.ok(closeTabMenuItem, "'Close Remote Tab' menu item is present.");
|
||||
Assert.ok(
|
||||
!closeTabMenuItem.disabled,
|
||||
"'Close Remote Tab' menu item is enabled."
|
||||
);
|
||||
});
|
||||
|
||||
SidebarController.hide();
|
||||
sandbox.restore();
|
||||
});
|
||||
|
@ -75,10 +75,6 @@ sidebar-context-menu-bookmark-tab =
|
||||
.label = Bookmark Tab…
|
||||
sidebar-context-menu-copy-link =
|
||||
.label = Copy Link
|
||||
# Variables:
|
||||
# $deviceName (String) - The name of the device the user is closing a tab for
|
||||
sidebar-context-menu-close-remote-tab =
|
||||
.label = Close tab on { $deviceName }
|
||||
|
||||
## Labels for sidebar history context menu items
|
||||
|
||||
@ -106,12 +102,3 @@ sidebar-menu-history-header =
|
||||
.heading = History
|
||||
sidebar-menu-syncedtabs-header =
|
||||
.heading = Tabs from other devices
|
||||
|
||||
## Context for closing synced tabs when hovering over the items
|
||||
|
||||
# Context for hovering over the close tab button that will
|
||||
# send a push to the device to close said tab
|
||||
# Variables:
|
||||
# $deviceName (String) - the name of the device the user is closing a tab for
|
||||
synced-tabs-context-close-tab-title =
|
||||
.title = Close tab on { $deviceName }
|
||||
|
@ -21,12 +21,6 @@ ChromeUtils.defineLazyGetter(lazy, "weaveXPCService", function () {
|
||||
).wrappedJSObject;
|
||||
});
|
||||
|
||||
ChromeUtils.defineLazyGetter(lazy, "fxAccounts", () => {
|
||||
return ChromeUtils.importESModule(
|
||||
"resource://gre/modules/FxAccounts.sys.mjs"
|
||||
).getFxAccountsSingleton();
|
||||
});
|
||||
|
||||
// from MDN...
|
||||
function escapeRegExp(string) {
|
||||
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
@ -111,12 +105,6 @@ let SyncedTabsInternal = {
|
||||
return reFilter.test(tab.url) || reFilter.test(tab.title);
|
||||
},
|
||||
|
||||
// A wrapper for grabbing the fxaDeviceId, to make it easier for stubbing
|
||||
// for tests
|
||||
_getClientFxaDeviceId(clientId) {
|
||||
return lazy.Weave.Service.clientsEngine.getClientFxaDeviceId(clientId);
|
||||
},
|
||||
|
||||
_createRecentTabsList(
|
||||
clients,
|
||||
maxCount,
|
||||
@ -128,21 +116,9 @@ let SyncedTabsInternal = {
|
||||
if (extraParams.removeDeviceDupes) {
|
||||
client.tabs = this._filterRecentTabsDupes(client.tabs);
|
||||
}
|
||||
|
||||
// We have the client obj but we need the FxA device obj so we use the clients
|
||||
// engine to get us the FxA device
|
||||
let device =
|
||||
lazy.fxAccounts.device.recentDeviceList &&
|
||||
lazy.fxAccounts.device.recentDeviceList.find(
|
||||
d => d.id === this._getClientFxaDeviceId(client.id)
|
||||
);
|
||||
|
||||
for (let tab of client.tabs) {
|
||||
tab.device = client.name;
|
||||
tab.deviceType = client.clientType;
|
||||
// Surface broadcasted commmands for things like close remote tab
|
||||
tab.fxaDeviceId = device.id;
|
||||
tab.availableCommands = device.availableCommands;
|
||||
}
|
||||
tabs = [...tabs, ...client.tabs.reverse()];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user