content script may run before documentElement is present

This commit is contained in:
tophf 2017-12-09 21:29:49 +03:00
parent e41dda1b68
commit a6fdb49503

View File

@ -202,6 +202,17 @@
requestStyles(); requestStyles();
return; return;
} }
if (!document.documentElement) {
new MutationObserver((mutations, observer) => {
if (document.documentElement) {
observer.disconnect();
applyStyles(styles);
}
}).observe(document, {childList: true});
return;
}
if ('disableAll' in styles) { if ('disableAll' in styles) {
doDisableAll(styles.disableAll); doDisableAll(styles.disableAll);
delete styles.disableAll; delete styles.disableAll;