From 55070d585227360ea185b3f98eeb7f2c135cf076 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 12 May 2020 21:17:52 -0400 Subject: Fixed mutation listener stack overflow on Firefox. --- src/js-components/previewBar.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/js-components/previewBar.ts b/src/js-components/previewBar.ts index 2f6ceea3..a7e5c8ec 100644 --- a/src/js-components/previewBar.ts +++ b/src/js-components/previewBar.ts @@ -103,9 +103,14 @@ class PreviewBar { categoryTooltip.classList.add("sbHidden"); }); - const observer = new MutationObserver(() => { + const observer = new MutationObserver((mutations, observer) => { if (!mouseOnSeekBar) return; + // See if mutation observed is only this ID (if so, ignore) + if (mutations.length == 1 && (mutations[0].target as HTMLElement).id === "sponsor-block-category-tooltip") { + return; + } + let tooltips = document.querySelectorAll(".ytp-tooltip-text"); for (const tooltip of tooltips) { let splitData = tooltip.textContent.split(":"); -- cgit v1.2.3