Is a Popover with an embedded iframe of "MyApp" allowed?

I am working on an extension that lets me collect highlights and bookmarks from websites. The data is sent to the popover where my “MyApp” is embedded in an iframe. Via postmessage I transfer the data from the popover to “MyApp” where it is saved (similar to raindrop.io).

As I found out that this works quite well for me, my question is if this would be allowed in the review process. If not, I would be thankful for other approaches how to transfer the collected data to “MyApp”.

Thanks for your time and answers!

The postMessage has some security issues:

What you should do, is send message from your content script using browser.runtime.sendMessage API:

Then have a listener browser.runtime.onMessage.addListener in your background script, which will then send it to your server, or save it locally.

Thanks for your reply. Yes, you’re right and I already use sendMessage for communication between the content and background script.

I only use postmessage to send the data from the background script to the embedded iframe with “MyApp”, where it is stored locally. So the first question is, if there is an alternative for this postmessage to the iframe.

And the second question (actually my original one) is if this embedded iframe in the popover for data transfer would be a rejection reason in the Mozilla review process.

You can do that? That cannot be right, or maybe I’m missing something.

In any case, to send message from background script to content script, you can use the:

Regarding your original question - I can’t say as I’m not a reviewer, but I’ve been warned by a reviewer when I used postMessage with * as targetOrigin.

EDIT @juraj.masiar

It seems I was wrong.

I can set a specific targetOrigin in the iframe that can be checked by the popup-script. But in the popup it only works by keeping ‘*’ as targetOrigin, otherwise postmessage is not send. I also tried to use ‘window.origin’, but it did not work. Perhaps this might work if it is not a temporary add-on, as that is how I debug it right now. Mhhh.

Thanks a lot for answer, that helped to get closer to the problem.

I found an answer, perhaps it might be useful for others. In this thread in Chromium group, someone posted his extension “Page Sidebar” that uses an iframe (embedded in a sidebar).

Oliver Dunk from Chrome Extensions commented on the use of the iframe: “There is no specific policy that prohibits hosting UI outside of your extension bundle but we do still need to be able to determine the functionality of your extension, which is something that is assessed during review.

As the extension is available for Chrome and Firefox it seems to be ok using an iframe (when its purpose is clear).

TECHICAL ALTERNATIVE FOR IFRAME :slightly_smiling_face:

I also found a way that works without an iframe and a popup: “MyApp” will run in a tab and when the extension is clicked it receives a special tailored content-script.

When a user has collected everything on tab and hits a “save” button, the content-script with the injected GUI sends the data to the background-script.

The background-script queries the tabs and when it finds “MyApp” it sends the data to the tailored content-script that will handle the saving.

content-script ----------> background-script ----------------> tailored content-script “MyApp
SAVE BUTTON queries tabs for “MyApp” receives data and saves it