eckhchri / pcars-ds-liveview

Provides a html page for project cars dedicated server and display a map of the current race.
14 stars 1 forks source link

Tracklist/-table not working in Firefox if DS is not reachable #141

Open viper4gh opened 4 years ago

viper4gh commented 4 years ago

If you open liveview in Firefox the track table is not working if the DS is not reachable. It throws the following error: 2020-03-26 11_22_22-FF_console 2020-03-26 11_22_45-FF_code

viper4gh commented 4 years ago

In Chrome it looks: 2020-03-26 11_41_16-Chrome_console

viper4gh commented 4 years ago

With the workaround the table is working, but it does not solve the root cause where the bad data come from. Further the tracklist worker stops, what it not should do. It should run till it gets data from DS.

viper4gh commented 4 years ago

After some investigation: Firefox is not entering the catch statement after the xmlhttp.send() if it is not getting a reply: https://github.com/eckhchri/pcars-ds-liveview/blob/master/receive_ds_data.js#L244 Chrome enters the catch.

viper4gh commented 4 years ago

Possible solution: move or copy the complete switch statement (https://github.com/eckhchri/pcars-ds-liveview/blob/master/receive_ds_data.js#L247) into an else statement of "if (xmlhttp.readyState==4 && xmlhttp.status==200)" (https://github.com/eckhchri/pcars-ds-liveview/blob/master/receive_ds_data.js#L266)