Illegal Invocation staring with 1.0.12


#1

In my package I’m creating synthetic events that I dispatch to my packages internal event handling system. I’m creating them like this:

syntheticEvent = Object.create originalEvent,
  currentTarget: get: -> currentTarget
  preventDefault: value: ->
    originalEvent.preventDefault()
  stopPropagation: value: ->
    originalEvent.stopPropagation()
    propagationStopped = true
  stopImmediatePropagation: value: ->
    originalEvent.stopImmediatePropagation()
    propagationStopped = true
    immediatePropagationStopped = true

This was working well as of 1.0.11, but broke in 1.0.12, I expect as a result of updating Chrome or io.js. The problem is that now when I make a call on the synthetic event, such as syntheticEvent.target I get an “Illegal Invocation” exception.

Does anyone know why this is or what I might do to work around the issue?

Thanks,
Jesse


#2

Think I’m on my way to a solution on this. Apparently Chrome 43 no longer allows for using Object.create with event objects. Looks like command-registery (I think where I got my original pattern) had to change there implementation too https://github.com/atom/atom/commit/e3f9074f4a98f15a4436a79a2209e2fdece85dd4. I’ll try the same thing.

Jesse