Bug 1864517 - "See tabs from synced devices" should link to the synced tabs category in Firefox View r=fxview-reviewers,markh,kcochrane

Previously the "See tabs from synced devices" button redirected to `about:firefoxview`.

This patch updates the `openTab` function to accept a category instead of an entryPoint or event.

For previous instances where `openTab` passed an event, `openTab` has been replaced with `openToolbarMouseEvent` to handle event.

We should open an issue in FxA to update the following `entryPoint` from "preferences" to "syncedtabs".
2b2ee47c4b/packages/fxa-content-server/app/scripts/views/pair/auth_complete.js (L55-L63)

Depends on D196208

Differential Revision: https://phabricator.services.mozilla.com/D196881
This commit is contained in:
Nikki Sharpley 2024-01-09 22:11:25 +00:00
parent e2612abe35
commit 808439ab98
3 changed files with 15 additions and 10 deletions

View File

@ -9980,10 +9980,7 @@ var FirefoxViewHandler = {
this.button.removeAttribute("open");
}
},
openTab(event) {
if (event?.type == "mousedown" && event?.button != 0) {
return;
}
openTab(section) {
if (!CustomizableUI.getPlacementOfWidget(this.BUTTON_ID)) {
CustomizableUI.addWidgetToArea(
this.BUTTON_ID,
@ -9991,7 +9988,10 @@ var FirefoxViewHandler = {
CustomizableUI.getPlacementOfWidget("tabbrowser-tabs").position
);
}
const viewURL = "about:firefoxview";
let viewURL = "about:firefoxview";
if (section) {
viewURL = `${viewURL}#${section}`;
}
// Need to account for navigation to Firefox View pages
if (
this.tab &&
@ -10013,6 +10013,12 @@ var FirefoxViewHandler = {
this._closeDeviceConnectedTab();
gBrowser.selectedTab = this.tab;
},
openToolbarMouseEvent(event, section) {
if (event?.type == "mousedown" && event?.button != 0) {
return;
}
this.openTab(section);
},
handleEvent(e) {
switch (e.type) {
case "TabSelect":

View File

@ -40,8 +40,8 @@
data-l10n-id="toolbar-button-firefox-view-2"
role="button"
aria-pressed="false"
oncommand="FirefoxViewHandler.openTab(event);"
onmousedown="FirefoxViewHandler.openTab(event);"
oncommand="FirefoxViewHandler.openTab();"
onmousedown="FirefoxViewHandler.openToolbarMouseEvent(event);"
cui-areatype="toolbar"
removable="true"/>

View File

@ -663,10 +663,9 @@ FxAccountsWebChannelHelpers.prototype = {
* Open Firefox View in the browser's window
*
* @param {Object} browser the browser in whose window we'll open Firefox View
* @param {String} [entryPoint] entryPoint Optional string to use for logging
*/
openFirefoxView(browser, entryPoint) {
browser.ownerGlobal.FirefoxViewHandler.openTab(entryPoint);
openFirefoxView(browser) {
browser.ownerGlobal.FirefoxViewHandler.openTab("syncedtabs");
},
/**