diff options
| author | mrmr1993 | 2017-11-02 13:52:03 +0000 |
|---|---|---|
| committer | mrmr1993 | 2017-11-02 13:52:03 +0000 |
| commit | 604ae4c33a8236c582ebe7ecd09c09f64d6a0a3b (patch) | |
| tree | 15cea560f25a75322fbbb5342bb810c1b8b8ed73 | |
| parent | fd3ea96dfe365b7b049504073de6c0da4c08b050 (diff) | |
| download | vimium-604ae4c33a8236c582ebe7ecd09c09f64d6a0a3b.tar.bz2 | |
FF: Don't use Selection.getRangeAt(0) when there are no ranges
This fixes #2757.
| -rw-r--r-- | content_scripts/mode_find.coffee | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/content_scripts/mode_find.coffee b/content_scripts/mode_find.coffee index 0fc147a3..950b08e9 100644 --- a/content_scripts/mode_find.coffee +++ b/content_scripts/mode_find.coffee @@ -82,6 +82,7 @@ class FindMode extends Mode FindMode.handleEscape() if event restoreSelection: -> + return unless @initialRange range = @initialRange selection = getSelection() selection.removeAllRanges() @@ -241,7 +242,10 @@ getCurrentRange = -> range else selection.collapseToStart() if selection.type == "Range" - selection.getRangeAt 0 + if selection.rangeCount > 0 + selection.getRangeAt 0 + else # Firefox returns a selection with no ranges and null anchor/focusNode in some situations. + null getLinkFromSelection = -> node = window.getSelection().anchorNode |
