Re: [whatwg] Define MessagePort.isConnected or MessagePort.ondisconnect

2012-11-02 Thread Ian Hickson
On Mon, 15 Mar 2010, ATSUSHI TAKAYAMA wrote: > > I think, as Hixie suggested, an array like object to track references of > all connected ports would be nice *for SharedWorkers*. For ports created > dynamically by new MessageChannel, it doesn't seem to work well. Why wouldn't it work well for M

Re: [whatwg] Define MessagePort.isConnected or MessagePort.ondisconnect

2010-03-15 Thread Ian Hickson
On Mon, 15 Mar 2010, ATSUSHI TAKAYAMA wrote: > > > > If you don't need to ever broadcast something to all the ports, you can > > avoid keeping track of the ports altogether, and then you won't have a > > problem. If you do need to broadcast, it's hard not to slowly leak at the > > moment. > > Even

Re: [whatwg] Define MessagePort.isConnected or MessagePort.ondisconnect

2010-03-15 Thread ATSUSHI TAKAYAMA
> If you don't need to ever broadcast something to all the ports, you can > avoid keeping track of the ports altogether, and then you won't have a > problem. If you do need to broadcast, it's hard not to slowly leak at the > moment. Even with the example below, "port" and "port.onmessage" will be

Re: [whatwg] Define MessagePort.isConnected or MessagePort.ondisconnect

2010-03-15 Thread ATSUSHI TAKAYAMA
Thanks for replies, I understood what's the problem here. > The only option that comes to mind that doesn't expose compatibility issues > would be to only issue onclose events if close() is explicitly called on the > entangled port, but if you're doing that you might as well just have the > code

Re: [whatwg] Define MessagePort.isConnected or MessagePort.ondisconnect

2010-03-15 Thread Drew Wilson
Agreed, there's not a good way to determine that a port is disentangled. Currently the main solution I know of is to have your document post a message to your shared worker in their onunload handler. I think some kind of MessagePort.onclose event or "entangled" attribute could be useful - this was

Re: [whatwg] Define MessagePort.isConnected or MessagePort.ondisconnect

2010-03-15 Thread Ian Hickson
On Mon, 15 Mar 2010, ATSUSHI TAKAYAMA wrote: > > Consider a case where I have a SharedWorker script like below, and I > open two tabs that use this SharedWorker. Now myPorts.length is 2. If I > reload one of the two tabs, then myPorts.length is 3, isn't it? But one > of the three ports is alrea

[whatwg] Define MessagePort.isConnected or MessagePort.ondisconnect

2010-03-15 Thread ATSUSHI TAKAYAMA
Hi all, Consider a case where I have a SharedWorker script like below, and I open two tabs that use this SharedWorker. Now myPorts.length is 2. If I reload one of the two tabs, then myPorts.length is 3, isn't it? But one of the three ports is already disconnected from the counterpart, so postMessa