[webkit-reviews] review requested: [Bug 73359] Move postMessage origin check to SecurityOrigin : [Attachment 117489] Updated patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Dec 1 14:23:07 PST 2011

Karl Koscher <supersat at chromium.org> has asked	for review:
Bug 73359: Move postMessage origin check to SecurityOrigin

Attachment 117489: Updated patch

------- Additional Comments from Karl Koscher <supersat at chromium.org>
(In reply to comment #5)
> (From update of attachment 117065 [details])
> View in context:
> > Source/WebCore/page/SecurityOrigin.h:103
> > +	 bool canReceivePostMessage(const SecurityOrigin* intendedOrigin);
> Maybe canReceivePostMessage => canReceiveMessagesFor ?  You want to be clear
that it's "for" the intendedOrigin rather than "from" a source origin, even at
the call sites.

Yeah. I was confused a bit myself, but cleaned that all up.

> > Source/WebCore/page/SecurityOrigin.h:113
> > +	 // Explicitly grant the ability to receive postMessages from any
> > +	 void grantReceivePostMessagesFromAnyOrigin();
> Can you explain when we'd want to grant this privilege?

I'm working on getting cross-process postMessages to work. The way we're doing
it is by installing a native event listener from the chromium side on a blank,
swapped-out document. However, since this document doesn't have an origin, it
needs to be able to receive messages intended for any origin. We then call
canReceiveMessagesFor from the chromium side right before we dispatch the
message. This prevents a race where the origin could change between the time it
was checked and the time it was dispatched (which is why we can't simply set
the proxy document's origin).

More information about the webkit-reviews mailing list