From a2055f9d3e6bdf0f4943d11247d9ba8707855adc Mon Sep 17 00:00:00 2001 From: Ilya Grigorik Date: Thu, 9 Jun 2016 18:22:53 -0400 Subject: [PATCH] check typeof node in MutationObserver --- inject.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inject.js b/inject.js index 81ce855..b6f2486 100644 --- a/inject.js +++ b/inject.js @@ -180,7 +180,10 @@ chrome.extension.sendMessage({}, function(response) { } var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { - forEach.call(mutation.addedNodes, function(node) { + mutation.addedNodes.forEach(node => { + if (typeof node === "function") + return; + checkForVideo(node, node.parentNode || mutation.target); }) });