From 342a24ae0e0205ee9705ee37a5217373573c3e5e Mon Sep 17 00:00:00 2001 From: adminglomo <33480288+adminglomo@users.noreply.github.com> Date: Wed, 22 Apr 2020 23:00:28 +0200 Subject: [PATCH] BUGFIX: Cannot read property 'childNodes' of null BUGFIX: Uncaught TypeError: Cannot read property 'childNodes' of null at XMLDocument.ready (content.js:218) SVG document doesn't have a document.body --- extension/js/content.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/extension/js/content.js b/extension/js/content.js index b930379..5277ea5 100644 --- a/extension/js/content.js +++ b/extension/js/content.js @@ -43,7 +43,7 @@ slowAnalysisTimeout, port, startTime = +(new Date()), - domReadyTime, + //domReadyTime, isJsonTime, exitedNotJsonTime, displayedFormattedJsonTime @@ -211,10 +211,14 @@ function ready () { - - domReadyTime = Date.now() ; - - // First, check if it's a PRE and exit if not + if (! document.body) { // SVG document doesn't have a body + port.disconnect() ; + return; + } + + //domReadyTime = Date.now() ; + + // First, check if it's a PRE and exit if not var bodyChildren = document.body.childNodes ; pre = bodyChildren[0] ; var jsonLength = (pre && pre.innerText || "").length ;