Post not yet marked as solved
Post marked as unsolved with 5 replies, 752 views
I'm trying to convert a Safari App Extension to the newer Safari Web Extension API, and having an issue with an injected iFrame we use to protect user data. Inside our provided iFrame which which we source from:
safari-web-extension://<ID_HERE>/<HTML_FILE_HERE>
and is externally_connectable via the manifest.json.
Any scripts that run inside the iFrame are able to initiate communication with background scripts with no problem. However, any message initiated from background never registers on any onMessage listener. For example:
// iframe.js
// WORKS FINE
browser.runtime.sendMessage({ greeting: "hello" })
.then((response) => {
		console.log("Received response: ", response);
});
// NEVER FIRES
browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
		console.log("Received request: ", request);
});
I'm convinced this is an Apple bug because this same scenario for the App Extensions receives the request from the background scripts no problem. Can anyone prove me otherwise?