Extension fails on MessageChannel

80 views
Skip to first unread message

johnjbarton

unread,
Sep 5, 2011, 2:17:00 PM9/5/11
to Chromium-extensions
I have an iframe in an extension popup window. The iframe src points
to a web site.

When I single step over this line in my code:
this.port.postMessage(message);

I get this message:

Unsafe JavaScript attempt to access frame with URL chrome-extension://
almkanjceicbdnobboiimcoehaodenjf/ppa.html#2 from frame with URL
http://orionhub.org/file/Fu/purple.html. Domains, protocols and ports
must match.

|this.port| is a MessagePort delivered by a postMessage() call from
the extension to the iframe. So obviously I can send in that
direction. I trigger the delivery of the MessagePort using
portMessage() from the iframe up to the extension window. So obviously
I can send in the other direction.

Since postMessage works in both directions and only
MessagePort.postMessage() from iframe to extension fails, I conclude
there must be a bug in MessagePort. Anyone have other information on
this?

jjb

Scott Fujan

unread,
Sep 5, 2011, 2:22:59 PM9/5/11
to johnjbarton, Chromium-extensions
https://developer.mozilla.org/en/DOM/window.postMessage

use target origin "*"


--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.


John J Barton

unread,
Sep 5, 2011, 10:51:31 PM9/5/11
to Scott Fujan, Chromium-extensions
On Mon, Sep 5, 2011 at 11:22 AM, Scott Fujan <sc...@fujan.name> wrote:
https://developer.mozilla.org/en/DOM/window.postMessage

use target origin "*"

Thanks, but of course that page is not about MessageChannel:

http://dev.w3.org/html5/postmsg/#channel-messaging

MessageChannel is easier to work with and likely to be more secure and have better performance.  The only problem is that it doesn't work ;-).

jjb
Reply all
Reply to author
Forward
0 new messages