Open Bug 1796433 Opened 3 years ago Updated 1 year ago

Opening links with target _blank opens the page in two tabs if done from a custom tab

Categories

(Firefox for Android :: PWA, defect)

All
Android
defect

Tracking

()

Tracking Status
firefox122 --- affected
firefox123 --- affected

People

(Reporter: cpeterson, Unassigned)

References

Details

From github: https://github.com/mozilla-mobile/android-components/issues/11759.

  • Install a PWA (e.g. twitter.com)
  • Open a custom tab within the PWA, e.g. click on an external link in Twitter
  • Notice how two identical sessions get created, e.g. using DevTools

reproduced on the latest Fenix Nightly

┆Issue is synchronized with this Jira Task

Change performed by the Move to Bugzilla add-on.

The severity field is not set for this bug.
:cpeterson, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(cpeterson)
Severity: -- → S3
Flags: needinfo?(cpeterson)

facing the same issue
asked question on support

It doesn't have to be a PWA.

If you open links with target="_blank", 2 windows open. I have an app that needs the window.parent reference to send postmessages about activity in the opened window. But the window with parent reference is not shown to the user and the duplicate window shown to user doesn't have parent reference.

(In reply to amaljossy1 from comment #2)

Made a mistake in the last comment, I meant to say window.opener instead of window.opener

Can we change the priority to S2, this breaks functionality.

  • Cannot communicate to parent as window.opener is null in the second window
  • Cannot perform childWindowReference.close() as the opener window doesn't have a reference to the second child window
Flags: needinfo?(cpeterson)

Hi Amal, thanks for clarifying that this bug can happen with custom tabs that are not in a PWA. Thanks for the steps to reproduce

Steps to reproduce from https://support.mozilla.org/en-US/questions/1418327:

  1. Open a page in custom tab powered by Firefox Android
  2. Click on a link in the page that should've opened in new tab, such as a link with target="_blank".
  3. Firefox will open two tabs, in total 3 tabs will be there, parent tab, child tab, clone of child tab. Child tab will have window.opener reference. Clone tab won't. User will be seeing the clone tab but not child tab

The opened tabs will be visible on developer tools

The child tab becomes an orphan, not visible in the custom tab or browser, disappears only when firefox app is force closed

Flags: needinfo?(cpeterson)
Priority: -- → P2
Summary: Two identical sessions open when opening a custom tab within a PWA → Opening links with target _blank opens the page in two tabs if done from a custom tab

In my observation. Once a link with target="_blank" clicked , In developer tools , there are two "about:blank" tabs opened, then one "about:blank" auto closed ,the other become real page (in Custom Tab). Only two Tabs remain, the parent and one child.

The new opened page in Custom Tab is opened via Intent https://github.com/mozilla-mobile/firefox-android/blob/main/android-components/components/feature/customtabs/src/main/java/mozilla/components/feature/customtabs/CustomTabWindowFeature.kt#L94

The call stack after receiving intent

mozilla.components.feature.tabs.CustomTabsUseCases$AddCustomTabUseCase.invoke(CustomTabsUseCases.kt:52)
mozilla.components.feature.customtabs.CustomTabIntentProcessor.process(CustomTabIntentProcessor.kt:60)
org.mozilla.fenix.IntentReceiverActivity.processIntent(IntentReceiverActivity.kt:77)
org.mozilla.fenix.IntentReceiverActivity.onCreate(IntentReceiverActivity.kt:50)

In Fenix view it is just another Custom Tab created by foreign Intent. so i think the child will never have parent reference?

See Also: → 1844034
See Also: → 1809889
See Also: → 1868600
See Also: → 1869491
Duplicate of this bug: 1844034
Duplicate of this bug: 1809889
Duplicate of this bug: 1868600

I was able to reproduce this issue on both Fenix Beta 122.0b7, and Nightly 123.0a1 from 1/10 using a Google Pixel 6 (Android 14).
I had twitter, and instagram installed as PWA's, and when I opened custom tabs --> two custom tabs were displayed in about:debugging.

See Also: → 1842558

Clearing Priority so we can reprioritize these bugs relative to our ux-fun-2024 bugs.

Priority: P2 → --
You need to log in before you can comment on or make changes to this bug.