cozy / cozy-emails

Email Client for Cozy
GNU Affero General Public License v3.0
66 stars 41 forks source link

Fix invisible message issue on Firefox. #914

Closed gregorylegarec closed 7 years ago

gregorylegarec commented 7 years ago

Thanks @aenario to review this PR :)

The issue was due to a difference in readyState propert between Firefox and Chrome, as in Chrome readyState seems to be always complete, there was a little delay in Firefox. So this should be handled by an event listener on readySate change, but it was by a sort of "retry 10 times" called with a setTimeOut. As in Firefox the readyState was still not 'complete' after 10 retries, the message was never displayed correctly.

In general case, setTimeOut should never be used to deal with DOM changes.

NB: Rendering also when readyState is equal to interactive seems to fasten the rendering in Firefox, I don't know if there is any reason to only rely on complete.