Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Calling connection.stop() with the serverSentEvent transport on Opera raises a TypeError. #1519

Closed
halter73 opened this Issue · 1 comment

2 participants

@halter73
Collaborator

REPRO

  • Start SignalR connection with the serverSentEvents transport on Opera.
  • Call connection.stop() after the the connection has reached the connected state.
  • An Uncaught exception: TypeError: Cannot convert 'connection.eventSource' to object will be thrown

Alternatively, you can run the "Connection State Facts: serverSentEvents Manually restarted client maintains consistent state" functional test in the JS test project on Opera.

CAUSE

Opera raises error after EventSource.Close is called which is handled by our function wired via connection.eventSource.addEventListener("error", ....

Since signalR.transports.serverSentEvents.stop(connection) is called before the error handler is called: connection.eventSource is null by the time the error handler is fired. Therefore, trying to access connection.eventSource.readyState in the error event handler fails.

FIX

While using this instead of connection.eventSource inside the error handler would fix the AV, there is no reason for the error handler to do anything if the transport that created it was stopped.

I think it is better to set connection.eventSource.ID to null in signalR.transports.serverSentEvents.stop so the error handler will ignore the event since it won't match the currentEventSourceID.

@halter73 halter73 was assigned
@Xiaohongt
Collaborator

verified

@Xiaohongt Xiaohongt closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.