Closed Bug 1831803 Opened 2 years ago Closed 1 years ago

The current URL is copied incorrectly when opening Firefox in another application and clicking on other links

Categories

(Firefox for Android :: General, defect, P2)

Firefox 114
All
Android
defect

Tracking

()

RESOLVED FIXED
123 Branch
Tracking Status
firefox123 --- fixed

People

(Reporter: roman.deev06, Assigned: jackyzy823)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Steps to reproduce:

  1. Set Firefox as your default browser.
  2. Open any link (e.g. https://example.com) in another application (e.g. Telegram).
  3. Firefox embedded in Telegram should open
  4. Navigate to any link on the page.
  5. Open the menu and click Copy link

Actual results:

The first link you opened in another application(Telegram) is copied.

Expected results:

Must copy the current URL

The reason is that tab parameter is the reference of store.tab from the start function (and never point to the newest reference)
https://github.com/mozilla-mobile/firefox-android/blob/66544029a906ceb696ede2e58f176c7afa46e5e0/android-components/components/feature/customtabs/src/main/java/mozilla/components/feature/customtabs/CustomTabsToolbarFeature.kt#L238-L246

The suggested modification

    @VisibleForTesting
    internal fun addMenuItems(
        // tab: CustomTabSessionState, // Remove this parameter
        menuItems: List<CustomTabMenuItem>,
        index: Int,
    ) {
        menuItems.map { item ->
            SimpleBrowserMenuItem(item.name) {
                sessionId ?. let {
                    store.state.findCustomTab(it) ?. let {
                        item.pendingIntent.sendWithUrl(context, it.content.url)
                    }
                }
            }
        }.also { items ->

There're same issue with functions in this class like addShareButton , addActionButton .

addCloseButton just use tab.id (and it wouldn't change)

Status: UNCONFIRMED → NEW
Ever confirmed: true
Severity: -- → S3
Priority: -- → P1
Assignee: nobody → jackyzy823
Priority: P1 → P2
Status: NEW → RESOLVED
Closed: 1 years ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: