[Webkit-unassigned] [Bug 175802] New: RTCPeerConnection addEventListener handler context changed (a new this?)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 21 17:48:46 PDT 2017


            Bug ID: 175802
           Summary: RTCPeerConnection addEventListener handler context
                    changed (a new this?)
           Product: WebKit
           Version: Safari Technology Preview
          Hardware: Macintosh
                OS: macOS 10.12.4
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Event Handling
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: jiali.passion at gmail.com

The reproduce code is below.

      window.onload = function () {
          console.log('Create RTCPeerConnection')
          const pc = new RTCPeerConnection()

          console.log('Add "track" event listener')
          pc.addEventListener('track', function(_event) {
            console.log('this === pc', this === pc);
            console.log('track event', _event);

          console.log('Dispatch "track" event')
          pc.dispatchEvent(new Event('track'))

the output will be 

this === pc, false

in the eventhandler of `track`, the context `this` is different with `pc`. 
In Firefox and Chrome, this is the same with pc.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170822/23e24308/attachment.html>

More information about the webkit-unassigned mailing list