summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/fg/js/source.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/fg/js/source.js b/ext/fg/js/source.js
index 3d9afe0f..0b21b5cc 100644
--- a/ext/fg/js/source.js
+++ b/ext/fg/js/source.js
@@ -94,7 +94,15 @@ class TextSourceRange {
this.rangeStartOffset === other.rangeStartOffset
);
} else {
- return this.range.compareBoundaryPoints(Range.START_TO_START, other.range) === 0;
+ try {
+ return this.range.compareBoundaryPoints(Range.START_TO_START, other.range) === 0;
+ } catch (e) {
+ if (e.name === 'WrongDocumentError') {
+ // This can happen with shadow DOMs if the ranges are in different documents.
+ return false;
+ }
+ throw e;
+ }
}
}