summaryrefslogtreecommitdiff
path: root/ext/fg/js/frame-offset-forwarder.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-04-18 17:54:49 +0300
committersiikamiika <siikamiika@users.noreply.github.com>2020-04-18 23:28:00 +0300
commit691b7398490bbf247070cd38603e51c7a6b66121 (patch)
treec9aee1a8d655b10f35eaf7b54ceb4dc96572de34 /ext/fg/js/frame-offset-forwarder.js
parent66354f1f9e866fd31f6bb0365024a39697a54079 (diff)
cache closed shadow dom content windows
Diffstat (limited to 'ext/fg/js/frame-offset-forwarder.js')
-rw-r--r--ext/fg/js/frame-offset-forwarder.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/fg/js/frame-offset-forwarder.js b/ext/fg/js/frame-offset-forwarder.js
index 4b77d5ed..72731605 100644
--- a/ext/fg/js/frame-offset-forwarder.js
+++ b/ext/fg/js/frame-offset-forwarder.js
@@ -23,6 +23,7 @@ class FrameOffsetForwarder {
constructor() {
this._started = false;
this._frameCache = new Set();
+ this._unreachableContentWindowCache = new Set();
this._forwardFrameOffset = (
window !== window.parent ?
@@ -74,9 +75,13 @@ class FrameOffsetForwarder {
}
_onGetFrameOffset(offset, uniqueId, e) {
- const sourceFrame = this._findFrameWithContentWindow(e.source);
+ let sourceFrame = null;
+ if (!this._unreachableContentWindowCache.has(e.source)) {
+ sourceFrame = this._findFrameWithContentWindow(e.source);
+ }
if (sourceFrame === null) {
// closed shadow root etc.
+ this._unreachableContentWindowCache.add(e.source);
this._forwardFrameOffsetOrigin(null, uniqueId);
return;
}