OK, I reproduced the issue on Firefox 57 and fixed per:
https://github.com/discourse/discourse/commit/ff1ce175fc2307323f934da48288eba7d9a667f8
What was happening is that sometimes our code was triggering a HARD infinite loop around text selection, where we were constantly re-selecting the same text.
This caused general unreliability on multiple platforms over the years and is part of the reason we debounce calls to the selection changed method.
cc @zogstrip