Closed Bug 1784294 Opened 2 years ago Closed 2 years ago

The last active tabs from mobile are synced only if the user clicks the Firefox account button/ Sync now button

Categories

(Firefox :: Firefox View, defect, P1)

Firefox 105
Desktop
All
defect

Tracking

()

VERIFIED FIXED
106 Branch
Tracking Status
firefox105 --- disabled
firefox106 --- verified

People

(Reporter: boltean, Assigned: niklas)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fidefe-2022-mr1-firefox-view])

Attachments

(2 files)

Affected versions:
Nightly 105.0a1 (2022-08-10)

Affected platforms:
Windows 10 64-bit
macOS 10.14
Ubuntu 20.04

Preconditions:
The user is already logged in to the browser with a Fx account.
The user has a mobile device connected.

Steps to reproduce:

  1. Click the Firefox view tab on desktop.
  2. On the mobile device open more than 3 pages in new tabs.
  3. Go back to desktop, open a new tab or window/ load a new page in an existing tab/ switch tabs.
  4. Go back to Firefox view and observe the Tab pickup section.

Actual result:
The Tab pickup section is not updated with the last active tabs from mobile.

Expected result:
The Tab pickup section is updated with the last active tabs from mobile.

Note: The Tab pickup content is updated only when the user clicks the Firefox account button in the toolbar or Sync now button from the Firefox account drop-down menu.

Whiteboard: [fidefe-2022-mr1-firefox-view]
Blocks: firefox-view
OS: Unspecified → All
Hardware: Unspecified → Desktop

Given forcing a "sync now" from Desktop makes things work, I assume that the mobile device has synced and the issue is that Desktop hasn't since synced to get the new tabs from the mobile device.

I'm not very familiar with the Firefox View code. I see that it has a function handleTabSync, which calls SyncedTabs.getRecentTabs(), but I don't see anywhere that file actually requests a new sync of tabs - which it should do by calling SyncedTab.syncTabs() - note that function has a force param - if false, it will only actually sync if the last sync was done more than 30 seconds ago - so some care will need to be taken if passing true to ensure we don't continually ask for syncs.

(As above, I'm not that familiar with Firefox View, so I might be missing some important context here)

(In reply to Mark Hammond [:markh] [:mhammond] from comment #1)

Given forcing a "sync now" from Desktop makes things work, I assume that the mobile device has synced and the issue is that Desktop hasn't since synced to get the new tabs from the mobile device.

I'm not very familiar with the Firefox View code. I see that it has a function handleTabSync, which calls SyncedTabs.getRecentTabs(), but I don't see anywhere that file actually requests a new sync of tabs - which it should do by calling SyncedTab.syncTabs() - note that function has a force param - if false, it will only actually sync if the last sync was done more than 30 seconds ago - so some care will need to be taken if passing true to ensure we don't continually ask for syncs.

(As above, I'm not that familiar with Firefox View, so I might be missing some important context here)

Wouldn't switching to the Firefox View tab cause a tab sync to happen within the next 5s due to the increase in tab sync frequency? (by code outside of FxView itself)

Flags: needinfo?(markh)

(In reply to :Gijs (back August 24; he/him) from comment #2)

Wouldn't switching to the Firefox View tab cause a tab sync to happen within the next 5s due to the increase in tab sync frequency? (by code outside of FxView itself)

The sync done on tab switching is only a write of this device's tabs - it does not do a read of other device's tabs.

Flags: needinfo?(markh)

This appears to be working as expected. Opening and closing tabs on this same device should only populate urls in the Recently Closed section of the FxView UI....not the Tab Pickup section.

Am I missing context? The attached gif doesn't seem to be referencing a mobile tab?

Flags: needinfo?(sfoster)

(In reply to Ray Fambro from comment #5)

Am I missing context? The attached gif doesn't seem to be referencing a mobile tab?

Yeah the gif seems to conflate recently closed tabs with synced tabs. But the STR themselves describe an issue a few people have mentioned.
:niklas, can you see if :mhammond's suggestion to ensure SyncedTab.syncTabs() gets called make sense and fixes this? We may need to think about where/when we call that, as there could be more than one window with about:firefoxview open, but as a first pass, asking FirefoxViewNotificationManager to make that call when TabPickupContainer instantiates seems reasonable.

Flags: needinfo?(sfoster)
Priority: -- → P1
Assignee: nobody → nbaumgardner
Status: NEW → ASSIGNED
Attachment #9290170 - Attachment description: Bug 1784294 - Force sync when Firefox View tab is selected. r=sfoster → Bug 1784294 - Sync tabs when Firefox View tab is selected. r=sfoster
Pushed by nbaumgardner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ebba7740ac81
Sync tabs when Firefox View tab is selected. r=sfoster

Backed out for causing bc failures on browser_setup_state.js

Backout link

Push with failures

Failure log is unavailable as the log parsing was skipped. Here is the full log. (Caution, might freeze the browser as it is too big)

Failure line: TEST-UNEXPECTED-FAIL | browser/components/firefoxview/tests/browser/browser_setup_state.js | Uncaught exception in test - undefined - timed out after 50 tries.

[task 2022-08-24T04:50:59.353Z] 04:50:59     INFO - TEST-PASS | browser/components/firefoxview/tests/browser/browser_setup_state.js | Correct message should show when there's a sync service error - 
[task 2022-08-24T04:50:59.353Z] 04:50:59     INFO - Console message: 1661316652345	FirefoxView.TabsSetup	DEBUG	maybeUpdateUI, _uiUpdateNeeded:: true
[task 2022-08-24T04:50:59.354Z] 04:50:59     INFO - Console message: [JavaScript Error: "TypeError: can't access property "status", state is null" {file: "resource://services-sync/UIState.jsm" line: 199}]
[task 2022-08-24T04:50:59.355Z] 04:50:59     INFO - _setLastSyncTime@resource://services-sync/UIState.jsm:199:9
[task 2022-08-24T04:50:59.355Z] 04:50:59     INFO - toggleSyncActivity@resource://services-sync/UIState.jsm:134:10
[task 2022-08-24T04:50:59.355Z] 04:50:59     INFO - observe@resource://services-sync/UIState.jsm:102:14
[task 2022-08-24T04:50:59.355Z] 04:50:59     INFO - test_sync_error_try_again/<@chrome://mochitests/content/browser/browser/components/firefoxview/tests/browser/browser_setup_state.js:876:18
[task 2022-08-24T04:50:59.355Z] 04:50:59     INFO - withFirefoxView@chrome://mochitests/content/browser/browser/components/firefoxview/tests/browser/head.js:165:22
[task 2022-08-24T04:50:59.356Z] 04:50:59     INFO - 
[task 2022-08-24T04:50:59.357Z] 04:50:59     INFO - Console message: [JavaScript Error: "Sync encountered an error - see about:sync-log for the log file." {file: "resource://services-sync/policies.js" line: 975}]
[task 2022-08-24T04:50:59.357Z] 04:50:59     INFO - resetFileLog@resource://services-sync/policies.js:975:10
[task 2022-08-24T04:50:59.357Z] 04:50:59     INFO - 
[task 2022-08-24T04:50:59.359Z] 04:50:59     INFO - Console message: [JavaScript Error: "Sync encountered an error - see about:sync-log for the log file." {file: "resource://services-sync/policies.js" line: 975}]
[task 2022-08-24T04:50:59.359Z] 04:50:59     INFO - resetFileLog@resource://services-sync/policies.js:975:10
[task 2022-08-24T04:50:59.359Z] 04:50:59     INFO - 
[task 2022-08-24T04:50:59.360Z] 04:50:59     INFO - Buffered messages finished
[task 2022-08-24T04:50:59.361Z] 04:50:59     INFO - TEST-UNEXPECTED-FAIL | browser/components/firefoxview/tests/browser/browser_setup_state.js | Uncaught exception in test - undefined - timed out after 50 tries.
[task 2022-08-24T04:50:59.361Z] 04:50:59     INFO - Leaving test bound test_sync_error_try_again
[task 2022-08-24T04:50:59.362Z] 04:50:59     INFO - Entering test bound test_sync_disconnected_error
[task 2022-08-24T04:50:59.363Z] 04:50:59     INFO - Not taking screenshot here: see the one that was previously logged
[task 2022-08-24T04:50:59.364Z] 04:50:59     INFO - TEST-UNEXPECTED-FAIL | browser/components/firefoxview/tests/browser/browser_setup_state.js | Uncaught exception in test - at resource://testing-common/sinon-7.2.7.js:3605 - TypeError: Attempted to wrap get which is already wrapped
[task 2022-08-24T04:50:59.365Z] 04:50:59     INFO - Stack trace:
[task 2022-08-24T04:50:59.365Z] 04:50:59     INFO - checkWrappedMethod@resource://testing-common/sinon-7.2.7.js:3605:21
[task 2022-08-24T04:50:59.365Z] 04:50:59     INFO - wrapMethod@resource://testing-common/sinon-7.2.7.js:3653:31
[task 2022-08-24T04:50:59.366Z] 04:50:59     INFO - stub@resource://testing-common/sinon-7.2.7.js:3002:44
[task 2022-08-24T04:50:59.366Z] 04:50:59     INFO - stub@resource://testing-common/sinon-7.2.7.js:2099:33
[task 2022-08-24T04:50:59.366Z] 04:50:59     INFO - setupMocks@chrome://mochitests/content/browser/browser/components/firefoxview/tests/browser/browser_setup_state.js:49:11
[task 2022-08-24T04:50:59.366Z] 04:50:59     INFO - test_sync_disconnected_error@chrome://mochitests/content/browser/browser/components/firefoxview/tests/browser/browser_setup_state.js:916:29
[task 2022-08-24T04:50:59.367Z] 04:50:59     INFO - handleTask@chrome://mochikit/content/browser-test.js:1028:26
[task 2022-08-24T04:50:59.367Z] 04:50:59     INFO - _runTaskBasedTest@chrome://mochikit/content/browser-test.js:1100:18
[task 2022-08-24T04:50:59.367Z] 04:50:59     INFO - 
[task 2022-08-24T04:50:59.367Z] 04:50:59     INFO - --------------
[task 2022-08-24T04:50:59.368Z] 04:50:59     INFO - wrapMethod@resource://testing-common/sinon-7.2.7.js:3679:26
[task 2022-08-24T04:50:59.368Z] 04:50:59     INFO - stub@resource://testing-common/sinon-7.2.7.js:3002:44
[task 2022-08-24T04:50:59.368Z] 04:50:59     INFO - stub@resource://testing-common/sinon-7.2.7.js:2099:33
[task 2022-08-24T04:50:59.368Z] 04:50:59     INFO - setupMocks@chrome://mochitests/content/browser/browser/components/firefoxview/tests/browser/browser_setup_state.js:49:11
[task 2022-08-24T04:50:59.369Z] 04:50:59     INFO - setupWithDesktopDevices@chrome://mochitests/content/browser/browser/components/firefoxview/tests/browser/browser_setup_state.js:66:29
[task 2022-08-24T04:50:59.369Z] 04:50:59     INFO - test_sync_error_try_again@chrome://mochitests/content/browser/browser/components/firefoxview/tests/browser/browser_setup_state.js:871:25
[task 2022-08-24T04:50:59.369Z] 04:50:59     INFO - handleTask@chrome://mochikit/content/browser-test.js:1028:26
[task 2022-08-24T04:50:59.370Z] 04:50:59     INFO - _runTaskBasedTest@chrome://mochikit/content/browser-test.js:1100:18
[task 2022-08-24T04:50:59.377Z] 04:50:59     INFO - Leaving test bound test_sync_disconnected_error
[task 2022-08-24T04:50:59.386Z] 04:50:59     INFO - GECKO(5038) | MEMORY STAT | vsize 11483MB | residentFast 536MB | heapAllocated 224MB
[task 2022-08-24T04:50:59.389Z] 04:50:59     INFO - TEST-OK | browser/components/firefoxview/tests/browser/browser_setup_state.js | took 17099ms
[task 2022-08-24T04:50:59.390Z] 04:50:59     INFO - Not taking screenshot here: see the one that was previously logged
[task 2022-08-24T04:50:59.391Z] 04:50:59     INFO - TEST-UNEXPECTED-FAIL | browser/components/firefoxview/tests/browser/browser_setup_state.js | Found an unexpected tab at the end of test run: about:blank - 
[task 2022-08-24T04:50:59.407Z] 04:50:59     INFO - Not taking screenshot here: see the one that was previously logged
[task 2022-08-24T04:50:59.411Z] 04:50:59     INFO - TEST-UNEXPECTED-FAIL | browser/components/firefoxview/tests/browser/browser_setup_state.js | Found an unexpected tab at the end of test run: about:blank - 
[task 2022-08-24T04:50:59.413Z] 04:50:59     INFO - Not taking screenshot here: see the one that was previously logged
[task 2022-08-24T04:50:59.415Z] 04:50:59     INFO - TEST-UNEXPECTED-FAIL | browser/components/firefoxview/tests/browser/browser_setup_state.js | Found an unexpected tab at the end of test run: about:blank - 
[task 2022-08-24T04:50:59.416Z] 04:50:59     INFO - Not taking screenshot here: see the one that was previously logged
[task 2022-08-24T04:50:59.417Z] 04:50:59     INFO - TEST-UNEXPECTED-FAIL | browser/components/firefoxview/tests/browser/browser_setup_state.js | Found an unexpected tab at the end of test run: about:blank - 
[task 2022-08-24T04:50:59.418Z] 04:50:59     INFO - Not taking screenshot here: see the one that was previously logged
[task 2022-08-24T04:50:59.419Z] 04:50:59     INFO - TEST-UNEXPECTED-FAIL | browser/components/firefoxview/tests/browser/browser_setup_state.js | Found an unexpected tab at the end of test run: about:blank - 
[task 2022-08-24T04:50:59.420Z] 04:50:59     INFO - Not taking screenshot here: see the one that was previously logged

Flags: needinfo?(nbaumgardner)
See Also: → 1782700
Blocks: 1787975
Pushed by nbaumgardner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7c7894b7318c
Sync tabs when Firefox View tab is selected. r=sfoster
Flags: needinfo?(nbaumgardner)
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 106 Branch

Hello, this is verified as fixed in Firefox 106.0.4 on desktop Windows 10 and Firefox 106.1 on ios. Newly opened tabs on ios mobile device are displayed in the Tab pickup section without performing a manual Sync.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: