verify doctype is present, pass in window's document

Fixes #309
This commit is contained in:
Ilya Grigorik
2018-02-08 13:16:27 +00:00
parent 7606224ec9
commit e50c29c5dd

View File

@@ -188,8 +188,10 @@ chrome.runtime.sendMessage({}, function(response) {
if (blacklisted)
return;
window.onload = () => initializeNow(document);
if (document && document.doctype.name == "html") {
window.onload = () => {
initializeNow(window.document)
};
if (document && document.doctype && document.doctype.name == "html") {
if (document.readyState === "complete") {
initializeNow(document);
} else {