aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
authormrmr19932017-04-16 16:00:25 +0100
committermrmr19932017-04-16 16:00:25 +0100
commit8b37743fa6f924995bb5fce581c4c73ad886257d (patch)
treecd7a5cb792ccc91cea45a1d9e0e92404d573daa6 /content_scripts
parent0ba625a210f707a66c7f87d350948ab61716409a (diff)
downloadvimium-8b37743fa6f924995bb5fce581c4c73ad886257d.tar.bz2
Catch errors thrown by window.find when it wraps/fails on FF
This does NOT fix wrapping, only catches errors
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/mode_find.coffee7
1 files changed, 6 insertions, 1 deletions
diff --git a/content_scripts/mode_find.coffee b/content_scripts/mode_find.coffee
index 0178527b..73b3a77a 100644
--- a/content_scripts/mode_find.coffee
+++ b/content_scripts/mode_find.coffee
@@ -178,7 +178,12 @@ class FindMode extends Mode
# ignore the selectionchange event generated by find()
document.removeEventListener("selectionchange", @restoreDefaultSelectionHighlight, true)
- result = window.find(query, options.caseSensitive, options.backwards, true, false, true, false)
+ try
+ result = window.find(query, options.caseSensitive, options.backwards, true, false, true, false)
+ catch # Failed searches throw on Firefox.
+ # NOTE(mrmr1993): On Firefox, window.find moves the window focus away from the HUD. We put it back, so
+ # the user can continue typing.
+ try HUD.hudUI.iframeElement.contentWindow.focus()
if options.colorSelection
setTimeout(