From 58838ce4c52a01740319e4e7cd3141932924da11 Mon Sep 17 00:00:00 2001 From: gorhill Date: Sat, 23 Jan 2016 16:57:20 -0500 Subject: [PATCH] blocked-image-by-size: getComputedStyle() on Pale Moon can return null --- src/js/scriptlets/load-large-media-interactive.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/js/scriptlets/load-large-media-interactive.js b/src/js/scriptlets/load-large-media-interactive.js index 0f53e982d..fd9469000 100644 --- a/src/js/scriptlets/load-large-media-interactive.js +++ b/src/js/scriptlets/load-large-media-interactive.js @@ -52,11 +52,14 @@ var mediaNotLoaded = function(elem) { case 'video': return elem.error !== null; case 'img': - if ( elem.naturalWidth === 0 && elem.naturalHeight === 0 ) { - return window.getComputedStyle(elem) - .getPropertyValue('display') !== 'none'; + if ( elem.naturalWidth !== 0 || elem.naturalHeight !== 0 ) { + break; } - break; + var style = window.getComputedStyle(elem); + // For some reason, style can be null with Pale Moon. + return style !== null ? + style.getPropertyValue('display') !== 'none' : + elem.offsetHeight !== 0 && elem.offsetWidth !== 0; default: break; }