rem:  var mimeType = gStrings.unknown, httpType; 
context: function makePreview(row){  var item = getSelectedImage(document.getElementById("imagetree"));  var url = imageView.getCellText(row, "image-address");  var isBG = imageView.getCellText(row, "image-bg");  document.getElementById("imageurltext").value = url;  document.getElementById("imagetitletext").value = item.title || gStrings.notSet;  var altText = null;  if (item.hasAttribute("alt") && ("alt" in item))    altText = item.alt;  else if (!isBG)    altText = getValueText(item);  if (altText == null)    altText = gStrings.notSet;  var textbox=document.getElementById("imagealttext");    // IMO all text that is not really the value text should go in italics  // What if somebody has <img alt="Not specified">? =)  // We can't use textbox.style because of bug 7639  if (!altText) {      textbox.value = gStrings.emptyString;      textbox.setAttribute("style","font-style:italic");  } else {      textbox.value = altText;      textbox.setAttribute("style","font-style:inherit");  }  document.getElementById("imagelongdesctext").value = ("longDesc" in item && item.longDesc) || gStrings.notSet;  // get cache info  var sourceText = theBundle.getString("generalNotCached");  var expirationText = gStrings.unknown;  var sizeText = gStrings.unknown;  var pageSize = 0;   var kbSize = 0;  var expirationTime = 0;  var expirationDate = null;  try  {    var cacheEntryDescriptor = httpCacheSession.openCacheEntry(url, Components.interfaces.nsICache.ACCESS_READ, false);   // open for READ, in non-blocking mode    if (cacheEntryDescriptor)    {      switch(cacheEntryDescriptor.deviceID)      {        case "disk":          sourceText = theBundle.getString("generalDiskCache");          break;        case "memory":          sourceText = theBundle.getString("generalMemoryCache");          break;        default:          sourceText = cacheEntryDescriptor.deviceID;          break;      }    }  }  catch(ex)  {    try    {      cacheEntryDescriptor = ftpCacheSession.openCacheEntry(url, Components.interfaces.nsICache.ACCESS_READ, false);   // open for READ, in non-blocking mode      if (cacheEntryDescriptor)      {        switch(cacheEntryDescriptor.deviceID)        {          case "disk":            sourceText = theBundle.getString("generalDiskCache");            break;          case "memory":            sourceText = theBundle.getString("generalMemoryCache");            break;          default:            sourceText = cacheEntryDescriptor.deviceID;            break;        }      }    }    catch(ex2)    {      sourceText = theBundle.getString("generalNotCached");    }  }  // find out the mime type, file size and expiration date  var mimeType = gStrings.unknown, httpType;  if (cacheEntryDescriptor)  {    var headers, match;    pageSize = cacheEntryDescriptor.dataSize;    kbSize = pageSize / 1024;    sizeText = theBundle.getFormattedString("generalSize", [Math.round(kbSize*100)/100, pageSize]);    expirationText = formatDate(cacheEntryDescriptor.expirationTime*1000, gStrings.notSet);    headers = cacheEntryDescriptor.getMetaDataElement("response-head");    match = /^Content-Type:\s*(.*?)\s*(?:\;|$)/mi.exec(headers);    if (match)      httpType = match[1];  }  if (!(item instanceof nsIInputElement))    mimeType = ("type" in item && item.type) ||               ("codeType" in item && item.codeType) ||               ("contentType" in item && item.contentType) ||               httpType || gStrings.unknown;  document.getElementById("imagetypetext").value = mimeType;  document.getElementById("imagesourcetext").value = sourceText;  document.getElementById("imageexpirestext").value = expirationText;  document.getElementById("imagesizetext").value = sizeText;  var imageContainer = document.getElementById("theimagecontainer");  var oldImage = document.getElementById("thepreviewimage");  var regex = new RegExp("^(https?|ftp|file|gopher)://");  var absoluteURL = getAbsoluteURL(url, item);  var isProtocolAllowed = regex.test(absoluteURL);   var newImage = new Image();  newImage.setAttribute("id", "thepreviewimage");  var physWidth = 0, physHeight = 0;  if ((item instanceof nsILinkElement || item instanceof nsIInputElement ||        item instanceof nsIImageElement || isBG) && isProtocolAllowed)    {    newImage.src = absoluteURL;    physWidth = newImage.width;    physHeight = newImage.height;    if ("width" in item && item.width)      newImage.width = item.width;    if ("height" in item && item.height)      newImage.height = item.height;  }   else   {    // fallback image for protocols not allowed (e.g., data: or javascript:)     // or elements not [yet] handled (e.g., object, embed). XXX blank??    newImage.src = "resource://gre/res/loading-image.gif";    newImage.width = 40;    newImage.height = 40;  }  var width = ("width" in item && item.width) || ("width" in newImage && newImage.width) || "0";  var height = ("height" in item && item.height) || ("height" in newImage && newImage.height) || "0";  document.getElementById("imageSize").value = theBundle.getFormattedString("mediaSize", [width, height]);  if (width != physWidth || height != physHeight)  {    document.getElementById("physSize").removeAttribute("hidden");    document.getElementById("physSize").value = theBundle.getFormattedString("mediaPhysSize", [physWidth, physHeight]);  }  else    document.getElementById("physSize").setAttribute("hidden", "true");  imageContainer.removeChild(oldImage);  imageContainer.appendChild(newImage);}
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8395/9c0f6d358f061ae6653ec72d834b418c31573f6e/pageInfo.js/buggy/browser/base/content/pageInfo.js