Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove rAF from highlight drawing and make synchronous
Bug #2502 arises from an issue with the asynchronous code in guest that relies on `requestAnimationFrame` before drawing highlights for a particular anchor range. When the DOM is being mutated in multiple ways, the range present in the synchronous `highlight` code can be different from the range once the `requestAnimationFrame` — i.e. it could have changed again since the range was sniffed in the `highlight` method. The call to `range.normalize` in the rAF callback in these cases might be operating on a range that is effectively invalid per the `normalize` method's (unwritten) expectations. That in turn throws and then causes a failure of highlight drawing until the document is reloaded. Some brittleness in `range` methods and other dependencies makes this challenging to fix easily in an asynchronous manner. It's unclear exactly why rAF asynchronicity was added (see ca87c1c ). As such, we've elected for now to remove `rAF` and make `highlight` code synchronous here. Fixes #2502
- Loading branch information