Bug 806144 JavaScript error previewing broken image r=IanN a=IanN SEAMONKEY_2_14b3_BUILD1 SEAMONKEY_2_14b3_RELEASE
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Wed, 31 Oct 2012 20:16:54 +0000
changeset 13531 4666574fa5962aed89e5463f409f64f0d37aa5a4
parent 13530 896eaa8b2eac564205f6668b96e5fa55ba1ec476
child 13532 11e0a62a947f59e5da9ec3f5998afdf4b7e99f5a
child 13534 41b08f9271cebada4a4af8f34d92da80c4ee38f8
push idunknown
push userunknown
push dateunknown
reviewersIanN, IanN
bugs806144
Bug 806144 JavaScript error previewing broken image r=IanN a=IanN
suite/browser/pageinfo/pageInfo.js
--- a/suite/browser/pageinfo/pageInfo.js
+++ b/suite/browser/pageinfo/pageInfo.js
@@ -1033,22 +1033,28 @@ function makePreview(row)
     sizeText = gBundle.getFormattedString("generalSize",
                                           [formatNumber(kbSize),
                                            formatNumber(pageSize)]);
   }
   setItemValue("imagesizetext", sizeText);
 
   var mimeType;
   var numFrames = 0;
-  if (item instanceof HTMLObjectElement ||
-      item instanceof HTMLEmbedElement ||
-      item instanceof HTMLLinkElement)
-    mimeType = item.type;
-  if (!mimeType && item instanceof nsIImageLoadingContent)
-    [mimeType, numFrames] = getContentTypeFromImgRequest(item);
+  if (!isBG) {
+    if (item instanceof nsIImageLoadingContent) {
+      var imageRequest = item.getRequest(nsIImageLoadingContent.CURRENT_REQUEST);
+      if (imageRequest)
+        mimeType = imageRequest.mimeType;
+    }
+    if (!mimeType &&
+        (item instanceof HTMLObjectElement ||
+         item instanceof HTMLEmbedElement ||
+         item instanceof HTMLLinkElement))
+      mimeType = item.type;
+  }
   if (!mimeType)
     mimeType = cachedType;
 
   // if we have a data url, get the MIME type from the url
   if (!mimeType) {
     var dataMimeType = /^data:(image\/.*?)[;,]/i.exec(url);
     if (dataMimeType)
       mimeType = dataMimeType[1].toLowerCase();
@@ -1221,31 +1227,16 @@ function getContentTypeFromHeaders(cache
 {
   if (!cacheEntryDescriptor)
     return null;
 
   return (/^Content-Type:\s*(.*?)\s*(?:\;|$)/mi
           .exec(cacheEntryDescriptor.getMetaDataElement("response-head")))[1];
 }
 
-function getContentTypeFromImgRequest(item)
-{
-  var httpRequest;
-  var numFrames = 0;
-
-  var imageRequest = item.getRequest(nsIImageLoadingContent.CURRENT_REQUEST);
-  if (imageRequest) {
-    httpRequest = imageRequest.mimeType;
-    let image = imageRequest.image;
-    if (image)
-      numFrames = image.numFrames;
-  }
-  return [httpRequest, numFrames];
-}
-
 //******** Other Misc Stuff
 // Modified from the Links Panel v2.3, http://segment7.net/mozilla/links/links.html
 // parse a node to extract the contents of the node
 function getValueText(node)
 {
   var valueText = "";
 
   // form input elements don't generally contain information that is useful to our callers, so return nothing