From 8b37743fa6f924995bb5fce581c4c73ad886257d Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Sun, 16 Apr 2017 16:00:25 +0100 Subject: Catch errors thrown by window.find when it wraps/fails on FF This does NOT fix wrapping, only catches errors --- content_scripts/mode_find.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'content_scripts') 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( -- cgit v1.2.3