summaryrefslogtreecommitdiff
path: root/ext/fg/js/document.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg/js/document.js')
-rw-r--r--ext/fg/js/document.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/fg/js/document.js b/ext/fg/js/document.js
index e068e3ba..db9f0cdc 100644
--- a/ext/fg/js/document.js
+++ b/ext/fg/js/document.js
@@ -269,8 +269,14 @@ const caretRangeFromPoint = (() => {
const range = document.createRange();
const offset = (node.nodeType === Node.TEXT_NODE ? position.offset : 0);
- range.setStart(node, offset);
- range.setEnd(node, offset);
+ try {
+ range.setStart(node, offset);
+ range.setEnd(node, offset);
+ } catch (e) {
+ // Firefox throws new DOMException("The operation is insecure.")
+ // when trying to select a node from within a ShadowRoot.
+ return null;
+ }
return range;
};
}