diff options
author | siikamiika <siikamiika@users.noreply.github.com> | 2020-04-18 17:54:49 +0300 |
---|---|---|
committer | siikamiika <siikamiika@users.noreply.github.com> | 2020-04-18 23:28:00 +0300 |
commit | 691b7398490bbf247070cd38603e51c7a6b66121 (patch) | |
tree | c9aee1a8d655b10f35eaf7b54ceb4dc96572de34 /ext | |
parent | 66354f1f9e866fd31f6bb0365024a39697a54079 (diff) |
cache closed shadow dom content windows
Diffstat (limited to 'ext')
-rw-r--r-- | ext/fg/js/frame-offset-forwarder.js | 7 |
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; } |