mozilla-mobile / firefox-ios

Firefox for iOS
Mozilla Public License 2.0
12.2k stars 2.92k forks source link

Clicking links that open a new tab instead open about:blank #19262

Closed Spitfire1900 closed 6 months ago

Spitfire1900 commented 7 months ago

Steps to reproduce

  1. Go to https://www.w3schools.com/jsref/met_win_open.asp
  2. Click "Try it Yourself"

Expected behavior

A new tab is opened for https://www.w3schools.com

Actual behavior

A new tab is opened for about:blank

Device & build information

Firefox 123.4 (39582)

┆Issue is synchronized with this Jira Task

Spitfire1900 commented 7 months ago

This is resolved as of Firefox 124.0 (39709)

Spitfire1900 commented 7 months ago

This started reoccurring today, still on Firefox 124.0 (39709), though force closing and relaunching Firefox fixed the issue.

data-sync-user commented 7 months ago

➤ Alina Moldovan commented:

Managed to reproduce it using FF v125 (40009) using iPhone 15+ (17.4) and iPad Air 3th gen (17.3)

Issue seems to be intermittent 2/10

!Skype_Video7.mp4|width=886,height=1920!

data-sync-user commented 7 months ago

➤ Alexandru Farcasanu commented:

Norberto Andres Furlan

After first investigations…

There in a code is a method which is looking like this:

func addPopupForParentTab(profile: Profile, parentTab: Tab, configuration: WKWebViewConfiguration) -> Tab {
    let popup = Tab(profile: profile, configuration: configuration, isPrivate: parentTab.isPrivate)
    configureTab(popup, request: nil, afterTab: parentTab, flushToDisk: true, zombie: false, isPopup: true)

    // Wait momentarily before selecting the new tab, otherwise the parent tab
    // may be unable to set `window.location` on the popup immediately after
    // calling `window.open("")`.
    DispatchQueue.main.asyncAfter(deadline: .now() + delaySelectingNewPopupTab) {
        self.selectTab(popup)
    }

    return popup
}If we are taking a look on line 8, there is an intentional delay “delaySelectingNewPopupTab" which is equal with 0.1 (seconds).

I did some testing based on this delay and I found something…

First I changed that delay from 0.1 to 1 second and it was impossible to reproduce the issue. (see video)

After that, I removed completely that delay and the issue appeared again.

"Wait momentarily before selecting the new tab" sounds for me more like a quick fix for something but not a real fix or a strong implementation.

Video with 1 second delay:

!delay.mov|width=946,height=2054!

Video after I removed that delay completely:

!no delay.mov|width=924,height=2054!

data-sync-user commented 6 months ago

➤ Andrei Bodea commented:

Verified as fixed on v124.2 (38968) with iPhone 15 Pro (17.3).

Please note that we were not able to reproduce this issue anymore, but we will keep looking into the deep links / external links issues.