Bug 271134 - Web Inspector: iOS 17.4 shows only the first Safari window
Summary: Web Inspector: iOS 17.4 shows only the first Safari window
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: Safari 17
Hardware: iPhone / iPad iOS 17
: P2 Normal
Assignee: Razvan Caliman
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-03-17 19:02 PDT by Jeff Johnson
Modified: 2024-05-01 06:34 PDT (History)
4 users (show)

See Also:


Attachments
Safari Develop menu with Extension Background Content and example.org (94.41 KB, image/png)
2024-03-17 19:02 PDT, Jeff Johnson
no flags Details
Safari Develop menu with just Extension Background Content (86.66 KB, image/png)
2024-03-17 19:02 PDT, Jeff Johnson
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Johnson 2024-03-17 19:02:20 PDT
Created attachment 470407 [details]
Safari Develop menu with Extension Background Content and example.org

I believe this issue started with iOS 17.4 and iPadOS 17.4. It worked as expected before.

I can reproduce on both my iPhone and iPad. Steps to reproduce:
1) Connect iOS device to Mac
2) In mobile Safari, open https://webkit.org
3) In desktop Safari, select the iOS device in the Develop menu
4) Select webkit.org to open the web inspector
5) Close the web inspector
6) In mobile Safari, close the window
7) Open a new window, and open example.org
8) In desktop Safari, select the iOS device in the Develop menu

Expected results: example.org appears in the menu

Actual results: example org does not appear in the menu

See the attached screenshots.

You have to force quit mobile Safari in order to see a new window in the web inspector.

There are other variations of the issue. For example, in step 2, open two windows, one with webkit.org and the other example.org. But the Develop menu will only show the first website, not the second.

I believe the issue depends on the iOS version and not the macOS or desktop Safari version. I was able to reproduce with two Macs, including both Sonoma and Ventura, as well as both desktop Safari 17.4 and 17.2.
Comment 1 Jeff Johnson 2024-03-17 19:02:56 PDT
Created attachment 470408 [details]
Safari Develop menu with just Extension Background Content
Comment 2 Radar WebKit Bug Importer 2024-03-17 20:36:46 PDT
<rdar://problem/124876362>
Comment 3 Razvan Caliman 2024-03-19 10:36:45 PDT
I can reproduce this.

Opening Web Inspector on macOS doesn't seem to be related. 

Additional inspectable pages from tabs in Safari on iOS don't show up for the device in the Develop menu after the first one (unless they're picked from the list of previously open tabs after force-quitting mobile Safari).

Inconsistently, pages that were previously opened (available in cache?) did show up in the list.

Updated steps steps to reproduce:
1) Connect iOS device to Mac
2) In mobile Safari, open https://webkit.org
3) In desktop Safari, select the iOS device in the Develop menu and observe the list of available inspectable pages
4) In mobile Safari, open a few tabs with various other websites 

Expected result:
All open tabs in mobile Safari show up in the Develop menu.

Thank you for filing! Investigating.
Comment 4 Razvan Caliman 2024-04-25 03:42:05 PDT
The issue turned out to be in Safari on the mobile device side. 
It is indeed a regression since iOS 17.4

A fix was made in a repository that's not public. I'll update and close this Bugzilla issue when a version of iOS / iPadOS with the fixed Safari is publicly available. (A Safari Technology Preview update on Mac can't fix it)

The underlying issue is with tabs in Safari on iOS being incorrectly marked as not inspectable depending on the URL loading strategy. That's why the issue seems flaky.

To reproduce consistently, attempt to open a URL that was never opened before in Safari on the device (something that doesn't autocomplete as you type in the address bar). It's easiest to reproduce if you "Clear History and Website Data" in Safari Settings on iOS.

A workaround is to open the same URL in another tab after the first one. This second tab will show up for inspection in Safari's Develop menu on the Mac.

Thank you for filing this and for your patience.