Re: postMessage feedback

On Sat, 26 Apr 2008, Jeff Walden wrote:
>
> Ian Hickson wrote:
> > I haven't changed the target of the event, it's still the Document 
> > object. This is a little odd, though, would people rather I made it 
> > the <body> element with an auto-forward to the Window object, like the 
> > 'load' event and so forth? That would allow onmessage="" handles to be 
> > written.
> 
> I've mentioned this on IRC but should probably mention it here so it's 
> in the record, so to speak.  I don't see a strong use case for an 
> onmessage attribute.  Event handler attributes are useful for quick 
> little things, but accepting messages from other sites seems neither 
> quick (aside from free-for-all walls I can't think of things you'd want 
> to do that wouldn't be fairly involved) nor little (you need the origin 
> check at a minimum, then you have to do whatever you're going to do, and 
> it's a lot to stuff in an attribute -- and if you're just delegating to 
> another method, why not just set the method as handler 
> programmatically?).  I don't think having to do it via script is 
> particularly burdensome.

On Sat, 26 Apr 2008, Maciej Stachowiak wrote:
> 
> If anything this event should dispatch to the window, not the document, 
> since that is what gets the postMessage call. But posting to the 
> document and bubbling to the window seems ok too.

On Sat, 26 Apr 2008, Jeff Walden wrote:
> 
> The event currently doesn't bubble to accommodate <event-source>:
> 
> http://lists.whatwg.org/htdig.cgi/commit-watchers-whatwg.org/2008/000436.html
> 
> So right now, either you use a bubbling listener (capturing works too, 
> although the web may end up dictating that that's a bug that won't be 
> fixt) on the document or a capturing listener (ugh) on window or you 
> don't get it.  I'm not entirely sure why the event doesn't bubble for 
> postMessage; it seems like a postMessage event doesn't necessarily have 
> to do the same thing as an <event-source> event, but maybe there's 
> precedent here that I don't know.
> 
> As far as I can tell the event is dispatched at the document only 
> because Opera's original implementation had postMessage on document.  I 
> sort of prefer dispatching to the window as well, but that change would 
> have to be made ASAP to make Firefox 3.  It's a one-line change (+30ish 
> for addEventListener calls in tests, also easy to do), as is the 
> bubbling change, but it's extraordinarily late for us to make these 
> changes (async cuts it very, very fine as-is), and nobody would be happy 
> if the spec converged on something that Firefox 3 didn't actually 
> implement.

On Sat, 26 Apr 2008, Maciej Stachowiak wrote:
> 
> I hope this can be addressed soon, and I feel your pain. But in Safari 
> 3.1 we actually dropped postMessage at the last minute because of too 
> many spec changes, and the spec changed in major ways after Opera 
> actually shipped their implementation, so it's not like changes here are 
> unprecedented and certainly Firefox is not being singled out.
> 
> (On the substance, I think dispatching to the window would be better 
> based on your comments.)

Changed to dispatch to the window.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Sunday, 27 April 2008 09:00:28 UTC