From a0c72d1b9a584ed25f418717fa7966490aa2c3a6 Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Fri, 23 Jan 2015 16:53:09 +0100 Subject: [PATCH] Fix #447: Regression: Hints generation crashes Commit e1497ee accidentally removed the null check for `.getComputedStyle()` in isElementVisible. This commit adds it back. --- extension/packages/utils.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extension/packages/utils.coffee b/extension/packages/utils.coffee index 5a98e96..0d4be4b 100644 --- a/extension/packages/utils.coffee +++ b/extension/packages/utils.coffee @@ -91,7 +91,9 @@ isElementGoogleEditable = (element) -> isElementVisible = (element) -> document = element.ownerDocument window = document.defaultView - computedStyle = window.getComputedStyle(element, null) + # `.getComputedStyle()` may return `null` if the computed style isn’t + # availble yet. If so, consider the element not visible. + return false unless computedStyle = window.getComputedStyle(element, null) return computedStyle.getPropertyValue('visibility') == 'visible' and computedStyle.getPropertyValue('display') != 'none' and computedStyle.getPropertyValue('opacity') != '0' -- 2.39.3