lapcat / SafariExtensions

Resources for the development of Safari extensions
43 stars 3 forks source link

Safari app extension message listener not called in cross-origin iframe when top frame is denied permissions #52

Open lapcat opened 4 months ago

lapcat commented 4 months ago

Steps to reproduce:

  1. Run the attached sample Xcode project MessageBug
  2. In Safari, allow the MessageBug extension on all websites
  3. Open https://lapcatsoftware.com/articles/2023/2/1.html
  4. In Safari Website Settings, deny the MessageBug extension on lapcatsoftware.com
  5. Reload https://lapcatsoftware.com/articles/2023/2/1.html

Here's the console log after step 3: Screenshot 2024-07-17 at 6 30 13 PM

And here's the console log after step 5: Screenshot 2024-07-17 at 6 30 35 PM

The YouTube iframe should receive a message from the native SafariExtensionHandler, but it doesn't, even though the content script runs in the iframe, and the SFSafariExtensionHandler delegate method is called, as verified by the Console log.

MessageBug.zip