From 579b77806266069440e56532868dfb9482c2b880 Mon Sep 17 00:00:00 2001 From: kkapsner Date: Wed, 29 May 2019 20:48:56 +0200 Subject: [PATCH] MutationObserver failed in some instances Fixes #354 --- lib/iframeProtection.js | 7 +++++-- releaseNotes.txt | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/iframeProtection.js b/lib/iframeProtection.js index 996acea..ae90465 100644 --- a/lib/iframeProtection.js +++ b/lib/iframeProtection.js @@ -123,8 +123,11 @@ var observer = new MutationObserver(allCallback); var observing = false; function observe(){ - if (!observing){ - observer.observe(window.document.documentElement, {subtree: true, childList: true}); + if ( + !observing && + window.document + ){ + observer.observe(window.document, {subtree: true, childList: true}); observing = true; } } diff --git a/releaseNotes.txt b/releaseNotes.txt index 7adb27f..5eaf255 100644 --- a/releaseNotes.txt +++ b/releaseNotes.txt @@ -12,6 +12,7 @@ Version 0.5.10: - not connected iFrame threw error with persistent rng - detection over document.write and document.writeln was possible - google docs were broken in Waterfox + - MutationObserver failed in some instances known issues: - if a data URL is blocked the page action button does not appear