W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2013

Re: [whatwg] onclose events for MessagePort

From: Ian Hickson <ian@hixie.ch>
Date: Wed, 30 Oct 2013 20:33:58 +0000 (UTC)
To: Ehsan Akhgari <ehsan@mozilla.com>
Message-ID: <alpine.DEB.2.00.1310302002310.838@ps20323.dreamhostps.com>
Cc: WHAT Working Group <whatwg@lists.whatwg.org>, Boris Zbarsky <bzbarsky@mit.edu>, Jonas Sicking <jonas@sicking.cc>, Simon Pieters <simonp@opera.com>, Gene Lian <clian@mozilla.com>
On Tue, 29 Oct 2013, Ian Hickson wrote:
> 
> Consider these three scenarios:
> 
> A. Page Alpha opens a shared worker, and they communicate using a pair of 
> MessagePorts. Alpha is navigated away, going to Beta in a different 
> origin. Later, the user hits back, and since Alpha is still in the 
> bfcache, the shared worker can still communicate, and the messages that 
> were sent while Alpha was away get delivered.
> 
> B. Page Gamma is has an iframe. In that iframe, there's page Alpha, which 
> opens a shared worker, and they communicate using a pair of MessagePorts. 
> Alpha is navigated away, leading the iframe to Beta in a different origin. 
> Later, the user hits back, and since Alpha is still in the bfcache, the 
> shared worker can still communicate, and the messages that were sent while 
> Alpha was away get delivered.
> 
> C. Page Gamma is has an iframe. In that iframe, there's page Alpha, which 
> opens a shared worker, and they communicate using a pair of MessagePorts. 
> Alpha then passes a reference to the port to Gamma. Then, Alpha is 
> navigated away, leading the iframe to Beta in a different origin. Gamma 
> and the shared worker can communicate.
> 
> A and C are mutually exclusive. Either the port's messages get delivered 
> while Alpha is away, or they don't.

Looks like Safari, Chrome, and (according to Anne, thanks!) IE10, all act 
in a manner that makes C impossible:

   http://www.hixie.ch/tests/adhoc/dom/web-apps/postMessage/ports/001.html

Basically, when a frame receives a port, it gets assigned to that frame, 
and when the frame is navigated, the port stops firing events on itself.

Unless someone objects, that's what I'm going to spec.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Wednesday, 30 October 2013 20:34:24 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:12 UTC