Bug 1139817 - TypeError: imgs is undefined in TypeError: imgs is undefined, r=squib, a=rkent
authorR Kent James <rkent@caspia.com>
Thu, 05 Mar 2015 16:48:15 -0800
changeset 25784 52eeb2c1202f82499532cedc5f2147e7de1d6a17
parent 25783 cd8b6a293cabe72941a65c6f7329a094e73f6c89
child 25785 fcf4eb0a177d87c3e246d0d29902527d49ae25f0
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssquib, rkent
bugs1139817
Bug 1139817 - TypeError: imgs is undefined in TypeError: imgs is undefined, r=squib, a=rkent
mail/base/content/contentAreaClick.js
--- a/mail/base/content/contentAreaClick.js
+++ b/mail/base/content/contentAreaClick.js
@@ -49,31 +49,32 @@
 
       if (linkNode)
         href = linkNode.href;
     }
 
     return href;
   }
 
-  function messagePaneOnResize(aEvent)
+function messagePaneOnResize(aEvent)
+{
+  // Scale any overflowing images, exclude http content.
+  let doc = getBrowser().contentDocument;
+  if (!doc || doc.URL.startsWith("http") || !doc.images)
+    return;
+
+  for (let img of doc.images)
   {
-    // Scale any overflowing images, exclude http content.
-    let browser = getBrowser();
-    let doc = browser && browser.contentDocument ? browser.contentDocument : null;
-    let imgs = doc && !doc.URL.startsWith("http") ? doc.images : [];
-    for (let img of imgs)
-    {
-      if (img.clientWidth - doc.body.offsetWidth >= 0 &&
-          (img.clientWidth <= img.naturalWidth || !img.naturalWidth))
-        img.setAttribute("overflowing", true);
-      else
-        img.removeAttribute("overflowing");
-    }
+    if (img.clientWidth - doc.body.offsetWidth >= 0 &&
+        (img.clientWidth <= img.naturalWidth || !img.naturalWidth))
+      img.setAttribute("overflowing", true);
+    else
+      img.removeAttribute("overflowing");
   }
+}
 
 // Called whenever the user clicks in the content area,
 // should always return true for click to go through.
 function contentAreaClick(aEvent)
 {
   let href = hRefForClickEvent(aEvent);
 
   if (!href && !aEvent.button) {