Commit Graph

288 Commits

Author SHA1 Message Date
goodusername123
c83e186cfb feat: restore "unread" tab Attribute 2025-11-06 14:13:46 +00:00
Alex Kontos
6d4862fcc8 feat: add session restore checkbox when quitting the browser
(cherry picked from commit 25890584ab485be765a2e4eff47e38f903a0ae24)
2025-11-06 14:13:37 +00:00
Jeremy Swinarton
1f70d01002 Bug 1961161: Additional metrics for closing tabs within groups r=dwalker,fxview-reviewers,tabbrowser-reviewers,nsharpley
Differential Revision: https://phabricator.services.mozilla.com/D248438
2025-05-22 22:03:01 +00:00
Jeremy Swinarton
13b5e48685 Bug 1921835: Move tab to start/end enabled when collapsed group on tab strip edge r=dao,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D249846
2025-05-21 13:55:24 +00:00
Dão Gottwald
e0a00e5f7d Bug 1966912 - Remove addTab's index alias for the tabIndex parameter. r=extension-reviewers,sessionstore-reviewers,tabbrowser-reviewers,robwu,dwalker
Differential Revision: https://phabricator.services.mozilla.com/D249783
2025-05-20 12:06:21 +00:00
Sandor Molnar
32b4815cfe Revert "Bug 1966912 - Remove addTab's index alias for the tabIndex parameter. r=extension-reviewers,sessionstore-reviewers,tabbrowser-reviewers,robwu,dwalker" for causing remote failures @ browser_TabManager.js
This reverts commit 38a0034022.
2025-05-19 21:07:58 +00:00
Dão Gottwald
38a0034022 Bug 1966912 - Remove addTab's index alias for the tabIndex parameter. r=extension-reviewers,sessionstore-reviewers,tabbrowser-reviewers,robwu,dwalker
Differential Revision: https://phabricator.services.mozilla.com/D249783
2025-05-19 19:48:54 +00:00
DJ
fb68fe5abb Bug 1966594 - fix window close logic in _beginRemoveTab. r=dao,sthompson,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D249708
2025-05-16 16:08:59 +00:00
Dão Gottwald
0007fe7bd1 Bug 1966617 - Make adoptTabGroup support both elementIndex and tabIndex, and stop converting tab indices to element indices. r=robwu,sthompson,tabbrowser-reviewers,sessionstore-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D249619
2025-05-16 00:39:26 +00:00
Rob Wu
c6223d7101 Bug 1963825 - tabGroups.move index = desired final index r=zombie,tabbrowser-reviewers,dao
To ensure that a group ends up at the position specified by `index`,
this patch adjusts the index when the tab group moves to the right.
Before this patch, the tab group appeared at a too low (left) index
because the original logic did not account for tabs shifting after a
repositioning to the right.

This also introduces stricter validation for moving tabs near pinned
tabs or other tab groups. Previously, the tabbrowser internals adjusted
the index as needed to fit adjacent to pinned tabs or groups. Now, the
extension API throws an error.

The new behavior matches developer expectations and Chrome's behavior:
https://bugzilla.mozilla.org/show_bug.cgi?id=1963825#c9

Differential Revision: https://phabricator.services.mozilla.com/D249493
2025-05-16 00:39:18 +00:00
agoloman
4b62de7961 Revert "Bug 1965343 - Adopt whole tab group at once in replaceGroupWithWindow r=tabbrowser-reviewers,sthompson" for causing bc failures @browser_tab_groups.js.
This reverts commit fac3f86e95.
2025-05-15 18:42:30 +00:00
Rob Wu
fac3f86e95 Bug 1965343 - Adopt whole tab group at once in replaceGroupWithWindow r=tabbrowser-reviewers,sthompson
The `replaceGroupWithWindow` method currently adopts a tab group in
multiple steps, asynchronously. This can result in externally observable
inconsistencies past initial adoption (see bug).

To fix this, this patch changes the adoption logic by passing the tab
group as the initial item to adopt, and adopts the whole group at once
as needed. Now the logic is similar to drag and drop adoption as
implemented in bug 1908441.

Since tabToAdopt is no longer just a tab, but also a tab group (or even
a tab group label since bug 1908441), the logic in ext-browser.js needs
to be adjusted to make sure that it does not mistake non-tab elements
for tabs. Test coverage is in browser_ext_tabGroups_move_onMoved.js,
as not changing that caused the test to fail with:

> FAIL Tab did indeed move to the new window - {"oldWindowId":3,"oldPosition":"undefined"} deepEqual {"oldWindowId":3,"oldPosition":1} -

Differential Revision: https://phabricator.services.mozilla.com/D248537
2025-05-15 13:35:45 +00:00
Rob Wu
94716102d0 Bug 1963830 - Reverse TabMove / tabs.onMoved when moving tab groups forwards r=tabbrowser-reviewers,dao
To allow extensions to correctly mirror the positions of tabs that were
bulk-moved by moving a tab group, emit the TabMove event in the reverse
order if the tab group moves forwards. This ensures that the previously
recorded index of a tab before the bulk-move remains valid.

Differential Revision: https://phabricator.services.mozilla.com/D248995
2025-05-14 16:04:08 +00:00
Dão Gottwald
61c2a7bdfc Bug 1966140 - Sort tab groups in recently-used order in address bar results. r=sthompson,daleharvey,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D249088
2025-05-14 04:13:54 +00:00
kpatenio
0815db75f2 Bug 1961951 - clean up RC actors and classes r=shopping-reviewers,fchasen,tabbrowser-reviewers,sthompson
Differential Revision: https://phabricator.services.mozilla.com/D246981
2025-05-09 18:16:21 +00:00
DJ
37e0d71a14 Bug 1956458 - Always place group after pinned tabs when creating a group from the context menu. r=sthompson,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D248533
2025-05-09 14:56:17 +00:00
Rob Wu
e7af560fb9 Bug 1965057 - Set isAdoptingGroup in replaceGroupWithWindow r=tabbrowser-reviewers,sthompson
The tabGroups.onRemoved / onCreated / onMoved event depends on the
isAdoptingGroup / removedByAdoption flags to identify tab groups that are
adopted by another window. Although this flag is set for the
`gBrowser.adoptTabGroup` method, it is not in the
`gBrowser.replaceGroupWithWindow` method, which results in incorrect
events.

This patch fixes the issue by setting the isAdoptingGroup flag in
`gBrowser.replaceGroupWithWindow`.

Differential Revision: https://phabricator.services.mozilla.com/D248327
2025-05-08 23:36:16 +00:00
DJ
4e0c51a78e Bug 1956458 - Unpin tabs when they are added to a group. r=dao,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D247597
2025-05-07 13:30:59 +00:00
Stephen Thompson
37cc744292 Bug 1962434 - raise TabGroupCreate when tab group element mounts r=dao,tabbrowser-reviewers
Session restore code doesn't use the standard Tabbrowser.addTabGroup API, so tab groups that enter the DOM via session restore don't raise any TabGroupCreate events. To be consistent, and in order to support addons that need to have an up-to-date view of the tab strip, this patch fires TabGroupCreate on each tab group that enters the DOM.

This patch renames the existing `TabGroupCreate` fired from Tabbrowser.addTabGroup to `TabGroupCreateByUser`. This new event will fire after the tab group enters the DOM (therefore after `TabGroupCreate`) in scenarios where code calls Tabbrowser.addTabGroup with `isUserTriggered = true` to indicate that a user took an explicit action to create this tab group as a new tab group.

Differential Revision: https://phabricator.services.mozilla.com/D246630
2025-04-29 20:08:49 +00:00
Greg Stoll
45a91ceccb Bug 1962641 - only style explicitly unloaded tabs with grayscale favicon, etc. r=tabbrowser-reviewers,dao
Tabs can also be unloaded for low memory conditions, so only add the
"discarded" attribute if the tab was unloaded explicitly.

Differential Revision: https://phabricator.services.mozilla.com/D246766
2025-04-25 15:43:31 +00:00
Rob Wu
6521fc35e2 Bug 1962592 - Reduce tab moves in adoptTabGroup r=tabbrowser-reviewers,dao
Differential Revision: https://phabricator.services.mozilla.com/D246702
2025-04-25 13:44:46 +00:00
Rob Wu
cbf77f8d55 Bug 1962475 - Do not fire tabGroups.onRemoved and onCreated when moving across windows r=zombie,tabbrowser-reviewers,dao
Differential Revision: https://phabricator.services.mozilla.com/D246688
2025-04-25 13:44:45 +00:00
zombie
7063143eaf Bug 1961660 - Implement tabGroups.move and onMoved r=robwu,tabbrowser-reviewers,dwalker,sthompson
Differential Revision: https://phabricator.services.mozilla.com/D246378
2025-04-25 13:44:44 +00:00
Vasish Baungally
11f63f2b75 Bug 1961641 - Add Telemetry when Smart Tab Model has no suggestion. r=ngrato,tabbrowser-reviewers
We were initializing two SmartTabGroupingManager instances in tabbrowser and tabgroup-menu. This was
causing issues with telemetry. This is now cleaned up.

Also, adding the model reason for no suggestion per DS request.

Differential Revision: https://phabricator.services.mozilla.com/D246113
2025-04-24 15:43:23 +00:00
Stephen Thompson
f8fe0335c0 Bug 1938401 - tab group interaction metrics r=dwalker,sessionstore-reviewers,tabbrowser-reviewers
Records counts of user interactions with tab groups:

- expand a collapsed tab group
- collapse an expanded tab group
- rename a tab group
- change a tab group's color
- save and close a tab group
- delete a tab group
- reopen a deleted tab group
- ungroup a tab group
- move a tab group to a new window
- reopen a saved and closed tab group from the list all tabs menu
- reopen a saved and closed tab group from a URL bar suggestion
- reopen a recently closed tab group from the recently closed tabs menu

Differential Revision: https://phabricator.services.mozilla.com/D246123
2025-04-24 02:20:14 +00:00
Stephen Thompson
36e1885b72 Bug 1951859 Part 3 - add tab group name to tab tooltips/a11y description r=dwalker,tabbrowser-reviewers,fluent-reviewers,bolsson
For the first and last tab in a tab group, include the tab group's name in the accessibility description read by screen readers when the tab is in focus. As keyboard users go through the tab strip, the users will receive clues that they are passing into/out of a tab group.

This also reformats the tab tooltips in general.

Before:
```
$title $pid $active - $containerName
$audioPlaying
```
After:
```
$title
$pid $active
$tabGroupName - $containerName
$audioPlaying
```
For each portion of the tab tooltip string, parts of the string might not appear due to configuration (PIDs and active only shown with pref) or user state (container name only shown for a container tab, etc.) or UX choices (don't include the title in the accessibility description because screen readers already read out a tab's title by default)

Differential Revision: https://phabricator.services.mozilla.com/D245186
2025-04-23 17:49:15 +00:00
Nika Layzell
0e460c11ec Bug 1958350 - Part 1: Fall back to the triggeringRemoteType when available for initial browser remoteType, r=Gijs,tabbrowser-reviewers,mconley
Differential Revision: https://phabricator.services.mozilla.com/D244444
2025-04-17 17:28:29 +00:00
Jeremy Swinarton
39096a611c Bug 1960360: Tab interaction metrics for dragging tabs out of groups r=sthompson,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D245749
2025-04-17 16:29:29 +00:00
Jeremy Swinarton
4a0e2c38cc Bug 1938405: Tab interaction metrics for tab groups r=dao,sthompson,tabbrowser-reviewers
This patch adds the most basic tab interaction metrics for tab groups.
As discussed in standup, we agreed to move the `remove_` class of
metrics into its own bug due to extra complexity involved in correctly
capturing these events.

One other thing we discussed was what the scope of events should be for
the `close_` class of events, i.e. should we *only* capture an event
when someone clicks the "X" button or closes from the TOM menu, or
should we also account for things like context menus, keyboard
shortcuts, etc.? Originally we agreed to capture _all_ tab close events
and mark any source that was not one of the above mentioned two as
unknown. However, after thinking about this more, I don't believe this
is the right approach. There are many places in the codebase where a tab
is closed but not because a user deliberately did it (e.g. when moving a
tab to a new window — this is actually done by creating a new tab in a
new window and closing the old). We currently don't distinguish between
user-initiated close actions, so it would take some time to find all
these places and exclude them.

I favour an explicit inclusion approach (which is what we are doing
elsewhere). In this patch I added events for:
  - closing a tab from the "X" close button (`close_tabstrip`)
  - closing a tab from the tab context menu (`close_tabstrip`)
  - closing a tab from the TOM (`close_tabmenu`)

There are other places that could potentially be
addressed, so I suggest moving these to a follow-up bug and addressing
them for 139.

Differential Revision: https://phabricator.services.mozilla.com/D244915
2025-04-16 15:01:28 +00:00
DJ
a148a1cdd9 Bug 1948702 - when grouping a tab via the context menu, select it. r=dao,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D245323
2025-04-14 14:54:09 +00:00
Rob Wu
2004e55a76 Bug 1959713 - Expose tabs.Tab.groupId r=zombie,dao,tabbrowser-reviewers,frontend-codestyle-reviewers
This patch exposes a groupId field on tabs.Tab objects in extensions.

On mobile (Android), the value is always -1.

On desktop, the value is the numeric representation composed from the
internal ID, which happens to fit in a safe integer. As long as the
browser is not running past year 2255, this works. As a fallback,
when an ID in a different format is encountered, the logic falls back
to returning a new unique ID based on a counter. This ID is then
stored in an internal in-memory map to maintain stable consistency.
Since it is unclear when exactly it is safe to discard this value, this
map is never cleared. This minor memory leak is acceptable because it
does not happen in practice, and even if it does, the number of tab
groups over the lifetime of a Firefox session is not going to reach
excessive values.

Differential Revision: https://phabricator.services.mozilla.com/D245159
2025-04-11 23:07:15 +00:00
Dão Gottwald
d07c1829fd Bug 1959730 - Dispatch TabMove events when moving a group within the tab strip. r=sthompson,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D245218
2025-04-11 15:18:48 +00:00
Dão Gottwald
13ed8c114d Bug 1955333 - Add tab to group context menu favicon should always be solid for opened groups regardlesss if it's collapsed. r=dwalker,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D245222
2025-04-11 15:01:45 +00:00
Stephen Thompson
f2e07044ae Bug 1938424 - metrics event when tabs added to tab group r=dao,jswinarton,tabbrowser-reviewers,extension-reviewers,robwu
When using the tab context menu or drag-dropping tabs to put them into a group, record a metric for the number of tabs added to the group.

Data Science asked us to launch with this metric disabled so that they could control it using server knobs. They expect a high volume of events, so they expect to only enable this metric for some proportion of users.

I converted the existing `TabMove` event derived from `UIEvent` being fired when tabs change their tab index in the tab strip. `UIEvent` doesn't allow for attaching additional context/detail to the event. `TabMove` is now a `CustomEvent` that provides more context about the moved tab and it fires in more cases -- it's possible for the tab index not to change despite the tab having "moved" into/out of a tab group.

This approach would not capture tab movements that occur across multiple frames/event loop iterations.

Differential Revision: https://phabricator.services.mozilla.com/D244616
2025-04-11 13:52:22 +00:00
Jeremy Swinarton
72de1640b1 Bug 1959438: Prevent tab from entering tab group label DOM element on tab insert r=sthompson,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D244931
2025-04-10 02:51:29 +00:00
Jeremy Swinarton
6483fac085 Bug 1957723: tabs.create() extensions API correctly adds tabs to groups r=sthompson,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D244613
2025-04-08 15:08:12 +00:00
Stephen Thompson
895511dc6f Bug 1938430 - add delete tab group event r=jswinarton,tabbrowser-reviewers,sessionstore-reviewers
Record when users delete an open group from the tab group context menu or delete an open group from a context menu in the all-tabs menu.

This will not record when users close a window or close all of the individual tabs in a tab group, even though those cases have the logical side effect of deleting a tab group.

Differential Revision: https://phabricator.services.mozilla.com/D241884
2025-04-03 14:12:43 +00:00
Kelly Cochrane
43f88580f8 Bug 1956909 - Prevent expand on hover jumping animation after browser restart r=tabbrowser-reviewers,sidebar-reviewers,jsudiaman,nsharpley
Differential Revision: https://phabricator.services.mozilla.com/D244203
2025-04-03 10:09:14 +00:00
Jeremy Swinarton
b5d0e3b6a6 Bug 1953801: Update SessionStore cache immediately after creating a tab group. r=sthompson,sessionstore-reviewers,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D241634
2025-03-28 15:16:23 +00:00
Fred Chasen
f43d5bc2ba Bug 1953534 - Clean up Review Checker location change handlers. r=shopping-reviewers,kpatenio,tabbrowser-reviewers
Now that the ReviewChecker sidebar can auto-open and close, the logic for finding distinct navigations needs to be updated.
This allow us to detect the first time new products URLs are requested to shown in the sidebar and to check if a tab should auto-open the sidebar after it was closed.

- `isDistinctProductPageVisit` now works the same as it did in the ShoppingSidebar, indicating that there was a product navigation while a tab was in the background.
- `reviewCheckerWasClosed` now prevents the sidebar from re-opening on tab changes for a location it was closed on.
- `isSimulated` is set to false in the location change handlers on tab changes where there was an unhandled background product navigation.
- Moves the `isSameProduct` check to `ShoppingUtils` and use that to test previous URIs passed to `hasLocationChanged`.
- Manager will only handle product page specific parts of location changes when the sidebar is not open to handle them.

Differential Revision: https://phabricator.services.mozilla.com/D241446
2025-03-28 00:07:40 +00:00
Jeremy Swinarton
34d9e59418 Bug 1938426: Record telemetry event when saving a tab group r=dwalker,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D242984
2025-03-27 15:29:19 +00:00
Kelly Cochrane
6685a37131 Bug 1950419 - Prevent sidebar from collapsing when opening context menu if expand on hover is enabled r=tabbrowser-reviewers,sidebar-reviewers,jsudiaman
Differential Revision: https://phabricator.services.mozilla.com/D242740
2025-03-26 19:14:46 +00:00
Cosmin Sabou
ced1f3c105 Backed out changeset 68d101b370d8 (bug 1938430) for permafailures on browser_tab_manager_groups.js (Bug 1938697). 2025-03-27 00:21:30 +02:00
Chris Shiohama
79000c00ff Bug 1945404 - Added focusUrlBar property to new tabs created with right click context menu. r=tabbrowser-reviewers,dwalker
Differential Revision: https://phabricator.services.mozilla.com/D242855
2025-03-26 16:33:41 +00:00
Stephen Thompson
78282be03c Bug 1938430 - add delete tab group event r=jswinarton,tabbrowser-reviewers,sessionstore-reviewers
Record when users delete an open group from the tab group context menu or delete an open group from a context menu in the all-tabs menu.

This will not record when users close a window or close all of the individual tabs in a tab group, even though those cases have the logical side effect of deleting a tab group.

Differential Revision: https://phabricator.services.mozilla.com/D241884
2025-03-25 21:16:37 +00:00
Dão Gottwald
8b40ef8567 Bug 1956252 - Don't let #moveTabNextTo move unpinned tabs between pinned ones. r=dwalker,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D242935
2025-03-25 15:45:37 +00:00
Cosmin Sabou
782522ac2f Backed out changeset bfb6d89e6bb9 (bug 1953801) for causing bc failures on browser_restore_container_tabs_oa. CLOSED TREE 2025-03-25 19:36:35 +02:00
Dão Gottwald
270b9d5781 Bug 1955276 - Consolidate moveTabTo checks. r=dwalker,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D242338
2025-03-25 14:16:54 +00:00
Dão Gottwald
f9a2272451 Bug 1955361 - Make dropping a link insert the new tab at the correct drop index. r=jswinarton,dwalker,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D242632
2025-03-25 14:05:34 +00:00
Jeremy Swinarton
39b35f9816 Bug 1953801: Update SessionStore cache immediately after creating a tab group. r=sthompson,sessionstore-reviewers,tabbrowser-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D241634
2025-03-25 13:39:45 +00:00