From 5efa8c88c124f57765c9da658d02bdf5b7af8b02 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Sun, 7 Feb 2021 12:54:20 +0100 Subject: [PATCH] Additional anti-recursing measures, pt 2 --- src/ext/lib/video-data/PlayerData.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ext/lib/video-data/PlayerData.js b/src/ext/lib/video-data/PlayerData.js index eced137..06cac7f 100644 --- a/src/ext/lib/video-data/PlayerData.js +++ b/src/ext/lib/video-data/PlayerData.js @@ -88,10 +88,18 @@ class PlayerData { // player size observer may not be strictly necessary here + // note that this function is called manually as well — whenever aspect ratio changes. + // this can result in recursive calls. We don't want recusrive calls. + onPlayerDimensionsChanged_recursing = false; onPlayerDimensionsChanged(mutationList, observer, context) { + if (this.onPlayerDimensionsChanged_recursing) { + return; + } + this.onPlayerDimensionsChanged_recursing = true; if (this?.checkPlayerSizeChange()) { this.videoData.resizer.restore(); } + this.onPlayerDimensionsChanged_recursing = false; }