From 92c2e743d60124c7636a62a658c258695cafd6ae Mon Sep 17 00:00:00 2001 From: tophf Date: Tue, 4 Aug 2015 21:54:56 +0300 Subject: [PATCH] Don't break gmail chat iframe by iframeObserver Apparently some same-domain (!) iframes fail to load when their "contentDocument" is accessed (!) --- apply.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apply.js b/apply.js index 79b9981f..b647428b 100644 --- a/apply.js +++ b/apply.js @@ -216,6 +216,13 @@ function initObserver() { getDynamicIFrames(document).forEach(addDocumentStylesToIFrame); return; } + // move the check out of current execution context + // because some same-domain (!) iframes fail to load when their "contentDocument" is accessed (!) + // namely gmail's old chat iframe talkgadget.google.com + setTimeout(process.bind(null, mutations), 0); + }); + + function process(mutations) { for (var m = 0, ml = mutations.length; m < ml; m++) { var mutation = mutations[m]; if (mutation.type === "childList") { @@ -227,7 +234,7 @@ function initObserver() { } } } - }); + } iframeObserver.start = function() { // will be ignored by browser if already observing