Created
May 12, 2016 00:13
-
-
Save cvializ/cb5e9a8158877c8b34ae4733ad587b81 to your computer and use it in GitHub Desktop.
Check the DOM for images that need to be loaded from the background page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onCspCheckLoaded(isCspBlocking) { | |
extension_module.csp = isCspBlocking; // cache the check value | |
if (isCspBlocking) { | |
// Capture error events triggered by img tags | |
document.addEventListener('error', onExtensionImgError, true); | |
// Check for background images | |
var observer = new MutationObserver(withMutations); | |
var whatToObserve = { childList: true, subtree: true }; | |
observer.observe(document, whatToObserve); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment