aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/source.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-05-02 12:59:59 -0400
committerGitHub <noreply@github.com>2020-05-02 12:59:59 -0400
commit51032d1eca04820a80f34dfd511a927c55975c1f (patch)
treebf5598f5746509bb959f2de0e1808660ef799d95 /ext/fg/js/source.js
parentefa7a5ecc3bf6def28c12478fbbcd5fb56f1f63c (diff)
Catch WrongDocumentError thrown by compareBoundaryPoints (#491)
* Catch WrongDocumentError thrown by compareBoundaryPoints * Filter error based on name
Diffstat (limited to 'ext/fg/js/source.js')
-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;
+ }
}
}