Don't break gmail chat iframe by iframeObserver
Apparently some same-domain (!) iframes fail to load when their "contentDocument" is accessed (!)
This commit is contained in:
parent
ad12fb1091
commit
92c2e743d6
9
apply.js
9
apply.js
|
@ -216,6 +216,13 @@ function initObserver() {
|
||||||
getDynamicIFrames(document).forEach(addDocumentStylesToIFrame);
|
getDynamicIFrames(document).forEach(addDocumentStylesToIFrame);
|
||||||
return;
|
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++) {
|
for (var m = 0, ml = mutations.length; m < ml; m++) {
|
||||||
var mutation = mutations[m];
|
var mutation = mutations[m];
|
||||||
if (mutation.type === "childList") {
|
if (mutation.type === "childList") {
|
||||||
|
@ -227,7 +234,7 @@ function initObserver() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
iframeObserver.start = function() {
|
iframeObserver.start = function() {
|
||||||
// will be ignored by browser if already observing
|
// will be ignored by browser if already observing
|
||||||
|
|
Loading…
Reference in New Issue
Block a user