summaryrefslogtreecommitdiff
path: root/ext/fg
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg')
-rw-r--r--ext/fg/js/document.js3
-rw-r--r--ext/fg/js/frontend.js7
2 files changed, 9 insertions, 1 deletions
diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js
index 9afc44f0..94a68e6c 100644
--- a/ext/fg/js/document.js
+++ b/ext/fg/js/document.js
@@ -267,6 +267,9 @@ const caretRangeFromPoint = (() => {
// Firefox
return (x, y) => {
const position = document.caretPositionFromPoint(x, y);
+ if (position === null) {
+ return null;
+ }
const node = position.offsetNode;
if (node === null) {
return null;
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index cef7fffd..167e82c0 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -270,7 +270,12 @@ class Frontend {
}
popupTimerSet(callback) {
- this.popupTimer = window.setTimeout(callback, this.options.scanning.delay);
+ const delay = this.options.scanning.delay;
+ if (delay > 0) {
+ this.popupTimer = window.setTimeout(callback, delay);
+ } else {
+ Promise.resolve().then(callback);
+ }
}
popupTimerClear() {