MessageChannel.js icon indicating copy to clipboard operation
MessageChannel.js copied to clipboard

Test multiple event handlers

Open hjdivad opened this issue 12 years ago • 2 comments

@Cyril-sf I have megadoubts about https://github.com/Cyril-sf/MessageChannel.js/blob/master/lib/message_channel.js#L354-L388

We talked about this earlier: I think the following case will fail

  1. add event handler A
  2. add event handler B
  3. remove event handler A
  4. fire message event; handler A should not fire.

Let's at least test the multihandler case, although I think we'll need a little bit of work to support it as well.

hjdivad avatar May 16 '13 18:05 hjdivad

@Cyril-sf n/m I see how that's supposed to work now. Still, removing event handlers in multihandler cases is not tested and it should be.

We may want to make the wrapper less intrusive: at least if defineProperty exists, we can make it non-enumerable.

hjdivad avatar May 16 '13 18:05 hjdivad

As discussed, I'll add an explicit test. This is "tested" when tearing down the tests.

Also, the current implementation won't support the fact that we could theoretically add several times the same handler.

cyril-sf avatar May 16 '13 20:05 cyril-sf