Bug 246620
Summary: | Messages send from iFrame not received by extension popup | ||
---|---|---|---|
Product: | WebKit | Reporter: | Carlos J. <carlosj-webkit-bugzilla> |
Component: | WebKit Extensions | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | timothy, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Carlos J.
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Carlos J.
See also:
https://feedbackassistant.apple.com/feedback/9637664
https://developer.apple.com/forums/thread/690249
Alexey Proskuryakov
rdar://83280648
Carlos J.
Just tested in Safari Technology Preview 192, and the issue persists.
Carlos J.
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.
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.
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