Bug 271868

Summary: REGRESSION (iOS 17.4): Safari extension content scripts not loaded in link previews
Product: WebKit Reporter: Jeff Johnson <opendarwin>
Component: WebKit ExtensionsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 17   
Hardware: iPhone / iPad   
OS: iOS 17   
Attachments:
Description Flags
Sample Xcode project
none
Working none

Jeff Johnson
Reported 2024-03-28 18:00:59 PDT
Created attachment 470653 [details] Sample Xcode project Steps to reproduce: 1. Run the attached sample Safari extension Xcode project PreviewBug 2. Enable PreviewBug in Safari 3. Open https://example.org 4. Press down the More Information link and show the preview Expected results: You see a window alert saying "content script" Actual results: No window alert This bug occurs on device with iOS 17.4.1 and in the iOS 17.4 Xcode simulator. It does not occur on device in earlier version of iOS or in the iOS 17.2 simulator. For some reason, there's no iOS 17.3 simulator available for download, so I couldn't test when exactly the bug was introduced. In the sample project, the extension content script calls setTimeout(() => { alert("content script"); }, 2000); As you can see, unlike the content script, the extension style sheet does get injected: * { background-color: red !important; } This bug breaks my Safari extension in the App Store. For example, it breaks the feature that stops videos from autoplaying. I was alerted to the issue by a customer who previews links before opening them in a new tab. Incidentally, it was difficult to debug this issue, because the link preview web context doesn't appear in the Safari Developer menu, which is why I had to use the primitive window alert method of debugging.
Attachments
Sample Xcode project (325.32 KB, application/zip)
2024-03-28 18:00 PDT, Jeff Johnson
no flags
Working (531.08 KB, image/png)
2024-03-29 11:51 PDT, Timothy Hatcher
no flags
Radar WebKit Bug Importer
Comment 1 2024-03-28 18:01:09 PDT
Timothy Hatcher
Comment 2 2024-03-29 11:51:20 PDT
Timothy Hatcher
Comment 3 2024-03-29 11:51:32 PDT
I am seeing the content script alert on 17.4.1 (21E237).
Timothy Hatcher
Comment 4 2024-03-29 12:03:25 PDT
I was able to reproduce on 21E237 after all.
Timothy Hatcher
Comment 5 2024-03-29 12:59:37 PDT
This has been resolved in Safari.
Note You need to log in before you can comment on or make changes to this bug.