NEW 246620
Messages send from iFrame not received by extension popup
https://bugs.webkit.org/show_bug.cgi?id=246620
Summary Messages send from iFrame not received by extension popup
Carlos J.
Reported 2022-10-17 05:00:33 PDT
Try to send a message from an iframe running a contentscript to the extension page containing the iFrame. Sample extension: https://github.com/carlosjeurissen/webext-tech-demo-extensions/tree/main/issues/safari-9637664-messaging-api-from-content-script-frame If it works (like in Google Chrome), the text of the extension page should change to "success".
Attachments
Alexey Proskuryakov
Comment 2 2022-10-17 10:26:46 PDT
Carlos J.
Comment 3 2024-04-23 06:52:38 PDT
Just tested in Safari Technology Preview 192, and the issue persists.
Carlos J.
Comment 4 2024-12-11 07:29:49 PST
In Safari 18.1.1, calls to chrome.runtime.sendMessage from within a contentScript of an iframe in an extension popup throws the "Error: Invalid call to runtime.sendMessage(). Tab not found." Same behaviour can be found in Safari Tech Preview 209.
Carlos J.
Comment 5 2025-04-06 11:20:25 PDT
This can be reproduced in Safari 18.4. The top extension frame does not get the messages. However the background page can listen to the messages. See: https://github.com/carlosjeurissen/webext-tech-demo-extensions/tree/main/demos/messaging-sub-frame-cs-to-extension-top-frame In general it seems Safari completely skips same-tab messaging, as can be demonstrated with: https://github.com/carlosjeurissen/webext-tech-demo-extensions/tree/main/demos/messaging-extension-cross-frame-messaging-with-responses
Carlos J.
Comment 6 2025-04-07 12:08:15 PDT
However, calling runtime.sendMessage from within a contentScript of an iframe in an extension popup throws the "Error: Invalid call to runtime.sendMessage(). Tab not found." and no message is sent at all, not even to the background page. This seems like a separate issue from the same-tab messaging issue. This has been tested in Safari 18.4 with this demo extension: https://github.com/carlosjeurissen/webext-tech-demo-extensions/tree/main/demos/messaging-broadcast-from-sub-frame-cs-in-extension-popup
Note You need to log in before you can comment on or make changes to this bug.