Bug 263297

Summary: on iOS 16.6 using Safari Tech Preview 17 w/AddToHomePagePWA Inspection Not Supported {similar to 214337}
Product: WebKit Reporter: David Simmons <smallscript1>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Critical CC: inspector-bugzilla-changes, pangle, rcaliman, smallscript1, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: iPhone / iPad   
OS: iOS 16   
Attachments:
Description Flags
Screenshot of working Web Inspector for Web App added to Home Screen in Safari 16.6 + iOS 17.1 none

Description David Simmons 2023-10-17 18:37:02 PDT
## Referencing:

 - https://webkit.org/web-inspector/enabling-web-inspector/
   「websites added to the home screen」
 - https://webkit.org/blog/13936/enabling-the-inspection-of-web-content-in-apps/
 - 「old bug」 https://bugs.webkit.org/show_bug.cgi?id=214337

It appears as of iOS 16.4 and the addition of `inspectable` that a "website added to the home screen‹PWA›" is no longer inspectable no matter what settings you have in:
 - iPhone DEVELOPER mode
 - iPhone Notification
 - iPhone Safari
 - OSX Safari Technology Preview

Which makes it quite hard to debug unique PWA issues, such as "Push service initialization failed".

I had to inject my own page-loading code-module into my PWA page to open a WSS pipe to my server and dual-local-tab-session-UX-log and fork to server to even understand the error that was happening exclusively in the iOS iPhone PWA context (because it works just fine everywhere else including in Safari on that iPhone).
 - the "Service Worker" is totally fine and can be reliably detected and inspected from "Safari Technology Preview".
 - the "Tab Session" "home screen‹PWA› is invisible and can neither be detected or attached to from XCode or "Safari Technology Preview".
   - does not matter if iPhone is connected by USB or SAME-WiFi-Network

Is there a solution, workaround, discussion as-to the rationale for making PWAs no longer debuggable during development?
A manifest flag or anything would be fine, or some developer-mode setting on the iPhone would be fine.

As it is, it simply appears to be a BREAKING CHANGE that is critically challenging to App development and quite difficult to understand (taking me 2-3 days to uncover the problems in just debugging).
Comment 1 Radar WebKit Bug Importer 2023-10-24 18:37:12 PDT
<rdar://problem/117447070>
Comment 2 Razvan Caliman 2023-11-27 11:35:46 PST
Created attachment 468772 [details]
Screenshot of working Web Inspector for Web App added to Home Screen in Safari 16.6 + iOS 17.1

It's unfortunate that you had to go through all this effort to debug the web app.

The workflow to inspect a web app added to Home Screen _should work_ even after Safari 16.4.

I did a quick test using Safari 16.6 on macOS 13.6 inspecting the https://squoosh.app web app added to the Home Screen on an iPhone with iOS 17.1 tethered via cable. It does show up in Safari's Develop menu and it does open a Web Inspector window for the web app on the device (see attached screenshot).

- Can you share a link to the web app that's not inspectable?
- Are you able to inspect Squoosh after adding it to the Home Screen?
- Does the issue still occur for you on iOS 17?