From fc1474cd4f6dd140448d9d77e19c15fbb86a9de0 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 8 Dec 2016 16:26:51 -0500 Subject: [PATCH] LP#1646166 Hatch extension load-time sanity check Avoid unnecessary JS errors by preventing any attempts to link the extension to the page via document.body when (in rare cases) document.body is null. Signed-off-by: Bill Erickson --- extension/app/content.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extension/app/content.js b/extension/app/content.js index 07ce8b7..d9c70b4 100644 --- a/extension/app/content.js +++ b/extension/app/content.js @@ -21,8 +21,12 @@ console.debug('Loading Hatch relay content script'); -// Tell the page DOM we're here. -document.body.setAttribute('hatch-is-open', '4-8-15-16-23-42'); +// document.body can be null in rare cases, e.g. quick page reload. +if (document.body) { + + // Tell the page DOM we're here. + document.body.setAttribute('hatch-is-open', '4-8-15-16-23-42'); +} /** * Open a port to our extension. -- 2.11.0