[whatwg] WebSocket: garbage collection
Simon Pieters
simonp at opera.com
Thu May 20 01:05:25 PDT 2010
On Thu, 06 May 2010 17:20:41 +0200, Simon Pieters <simonp at opera.com> wrote:
> On Tue, 20 Apr 2010 16:00:36 +0200, Simon Pieters <simonp at opera.com>
> wrote:
>
>> [[
>> WebSocket object with an open connection must not be garbage collected
>> if there are any event listeners registered for message events.
>> ]]
>>
>> Shouldn't it also not be garbage collected if there are listeners for
>> open, error and close? What about when the connection is not yet
>> established?
>
> I think the policy should be:
>
> if readyState is CONNECTING:
> has 'open' event listener: don't collect
> has 'message' event listener: don't collect
> has 'error' event listener: don't collect
> has 'close' event listener: don't collect
>
> if readyState is OPEN:
> has 'open' event listener: OK to collect
> has 'message' event listener: don't collect
> has 'error' event listener: don't collect
> has 'close' event listener: don't collect
>
> if readyState is CLOSING:
> has 'open' event listener: OK to collect
> has 'message' event listener: OK to collect
> has 'error' event listener: OK to collect
> has 'close' event listener: don't collect
>
> if readyState is CLOSED:
> has 'open' event listener: OK to collect
> has 'message' event listener: OK to collect
> has 'error' event listener: OK to collect
> has 'close' event listener: OK to collect
Make that:
if readyState is CONNECTING:
has 'open' event listener: don't collect
has 'message' event listener: don't collect
has 'error' event listener: don't collect
has 'close' event listener: don't collect
if readyState is OPEN or CLOSING:
has 'open' event listener: OK to collect
has 'message' event listener: don't collect
has 'error' event listener: don't collect
has 'close' event listener: don't collect
if readyState is CLOSED:
has 'open' event listener: OK to collect
has 'message' event listener: OK to collect
has 'error' event listener: OK to collect
has 'close' event listener: OK to collect
(I didn't realize that you could get message and error events in CLOSING
state.)
--
Simon Pieters
Opera Software
More information about the whatwg
mailing list