From 45a65b38db55e358d58e9c608a8088d7cc157939 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 17 Jun 2018 11:35:18 +0900 Subject: Fix no previous search keywords --- src/content/actions/find.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/content/actions/find.js') diff --git a/src/content/actions/find.js b/src/content/actions/find.js index c7345cc..249a8a9 100644 --- a/src/content/actions/find.js +++ b/src/content/actions/find.js @@ -22,6 +22,12 @@ const postPatternFound = (pattern) => { ); }; +const postNoPrevious = () => { + return consoleFrames.postError( + window.document, + 'No previous search keywords'); +}; + const find = (string, backwards) => { let caseSensitive = false; let wrapScan = true; @@ -50,6 +56,9 @@ const findNext = (currentKeyword, reset, backwards) => { } return promise.then((keyword) => { + if (!keyword) { + return postNoPrevious(); + } let found = find(keyword, backwards); if (!found) { window.getSelection().removeAllRanges(); -- cgit v1.2.3