rem: return theList.concat(aDocument.links); } 
add: if ("links" in aDocument) return theList.concat(aDocument.links); else return theList.concat(aDocument.getElementsByTagNameNS(XHTMLNS, "a"); }  function openURL(target) { var url = target.parentNode.childNodes[2].value; window.open(url, "_blank", "chrome"); }   function makeMediaTab() { var theBundle = document.getElementById("pageinfobundle"); var imageOutliner = document.getElementById("imageoutliner");  var imageView = new pageInfoOutlinerView(["image-number","image-address","image-type"]); imageOutliner.outlinerBoxObject.view = imageView;  imageList = grabAllMedia(theWindow, theDocument);  var mediaImg = theBundle.getString("mediaImg"); var mediaApplet = theBundle.getString("mediaApplet"); var mediaObject = theBundle.getString("mediaObject"); var mediaEmbed = theBundle.getString("mediaEmbed"); var mediaLink = theBundle.getString("mediaLink"); var mediaInput = theBundle.getString("mediaInput");  var row = null; var length = imageList.length; imageIndex = 0;  for (var i = 0; i < length; i++) { var elem = imageList[i]; switch (elem.nodeName.toLowerCase()) { case "img": imageView.addRow([++imageIndex, elem.src, mediaImg]); break; case "input": imageView.addRow([++imageIndex, elem.src, mediaInput]); break; case "applet": imageView.addRow([++imageIndex, elem.code || elem.object, mediaApplet]); break; case "object": imageView.addRow([++imageIndex, elem.data, mediaObject]); break; case "embed": imageView.addRow([++imageIndex, elem.src, mediaEmbed]); break; case "link": imageView.addRow([++imageIndex, elem.href, mediaLink]); break; default: dump("Page Info - makeMediaTab(): hey, that's an odd one! ("+elem+")");; break; } } imageView.rowCountChanged(0, length);  imageView.selection.select(0); }  function grabAllMedia(aWindow, aDocument) { var theList = [];  if (aWindow && aWindow.frames.length > 0) { var num = aWindow.frames.length; for (var i = 0; i < num; i++) { var frame = aWindow.frames[i]; theList = theList.concat(grabAllMedia(frame, frame.document)); } }  theList = theList.concat(aDocument.getElementsByTagName("embed"), aDocument.applets, aDocument.getElementsByTagName("object"));  var inputList = aDocument.getElementsByTagName("input"); var length = inputList.length for (i = 0; i < length; i++) if(inputList[i].type.toLowerCase() == "image") theList = theList.concat(inputList[i]);  var linkList = aDocument.getElementsByTagName("link"); length = linkList.length; for (i = 0; i < length; i++) if(linkList[i].rel.match(/\bicon\b/i)) theList = theList.concat(linkList[i]);  if ("images" in aDocument) return theList.concat(aDocument.images); else return theList.concat(aDocument.getElementsByTagNameNS(XHTMLNS, "img")); }  function onImageSelect() { var outliner = document.getElementById("imageoutliner"); var preview = document.getElementById("imagepreview");  if (outliner.outlinerBoxObject.selection.count == 1) { var view = outliner.outlinerBoxObject.view; if (!view.rowCount) return; var clickedRow = outliner.outlinerBoxObject.selection.currentIndex; var lineNum = view.getCellText(clickedRow, "image-number");  makePreview(imageList[lineNum-1]); } }  function makePreview(item) { var theBundle = document.getElementById("pageinfobundle"); var unknown = theBundle.getString("unknown"); var notSet = theBundle.getString("notset");  var url = ("src" in item && item.src) || ("code" in item && item.code) || ("data" in item && item.data) || ("href" in item && item.href) || unknown; document.getElementById("imageurltext").value = url; document.getElementById("imagetitletext").value = item.title || notSet; document.getElementById("imagealttext").value = ("alt" in item && item.alt) || getValueText(item) || notSet; document.getElementById("imagelongdesctext").value = ("longDesc" in item && item.longDesc) || notSet;   var mimeType = unknown; if (item.nodeName.toLowerCase() != "input") mimeType = ("type" in item && item.type) || ("codeType" in item && item.codeType) || ("contentType" in item && item.contentType) || unknown; document.getElementById("imagetypetext").value = mimeType;   var sourceText = theBundle.getString("generalNotCached"); var expirationText = theBundle.getString("unknown"); var sizeText = theBundle.getString("unknown");  var expirationTime = 0; var expirationDate = null;  try { var cacheEntryDescriptor = httpCacheSession.openCacheEntry(url, Components.interfaces.nsICache.ACCESS_READ, true); if (cacheEntryDescriptor) { switch(cacheEntryDescriptor.deviceID) { case "disk": sourceText = theBundle.getString("generalDiskCache"); break; case "memory": sourceText = theBundle.getString("generalMemoryCache"); break; default: sourceText = cacheEntryDescriptor.deviceID; break; }  sizeText = cacheEntryDescriptor.dataSize;  expirationText = formatDate(cacheEntryDescriptor.expirationTime*1000, notSet); } } catch(ex) { try { cacheEntryDescriptor = ftpCacheSession.openCacheEntry(url, Components.interfaces.nsICache.ACCESS_READ, true); if (cacheEntryDescriptor) { switch(cacheEntryDescriptor.deviceID) { case "disk": sourceText = theBundle.getString("generalDiskCache"); break; case "memory": sourceText = theBundle.getString("generalMemoryCache"); break; default: sourceText = cacheEntryDescriptor.deviceID; break; }  sizeText = cacheEntryDescriptor.dataSize;  expirationText = formatDate(cacheEntryDescriptor.expirationTime*1000, notSet); } } catch(ex2) { sourceText = theBundle.getString("generalNotCached"); } } document.getElementById("imagesourcetext").value = sourceText; document.getElementById("imageexpirestext").value = expirationText; document.getElementById("imagesizetext").value = sizeText;      var width = ("width" in item && item.width) || ""; var height = ("height" in item && item.height) || "";  document.getElementById("imagewidth").value = theBundle.getFormattedString("mediaWidth", [width]); document.getElementById("imageheight").value = theBundle.getFormattedString("mediaHeight", [height]);     var imageContainer = document.getElementById("theimagecontainer"); var oldImage = document.getElementById("thepreviewimage");  var newImage = null; var nn = item.nodeName.toLowerCase(); if (nn == "link" || nn == "input") { newImage = new Image(); newImage.src = getAbsoluteURL(item.href || item.src, item); } else { newImage = item.cloneNode(true); newImage.src = ("src" in item && item.src) || ("href" in item && item.href); }  newImage.setAttribute("id", "thepreviewimage"); if ("width" in item && item.width) newImage.width = item.width; if ("height" in item && item.height) newImage.height = item.height; newImage.removeAttribute("align");  imageContainer.removeChild(oldImage); imageContainer.appendChild(newImage); }       function getValueText(linkNode) { var valueText = "";  var length = linkNode.childNodes.length; for (var i = 0; i < length; i++) { var childNode = linkNode.childNodes[i]; var nodeType = childNode.nodeType; if (nodeType == Node.TEXT_NODE) valueText += " " + childNode.nodeValue; else if (nodeType == Node.ELEMENT_NODE) { if (childNode.nodeName.toLowerCase() == "img") valueText += " " + getAltText(childNode); else valueText += " " + getValueText(childNode); } }  return stripWS(valueText); }    function getAltText(node) { var altText = "";  if (node.alt) return node.alt; var length = node.childNodes.length; for (var i = 0; i < length; i++) if ((altText = getAltText(node.childNodes[i]) != undefined)) return altText; return ""; }    function stripWS(text) { var middleRE = /\s+/g; var endRE = /(^\s+)|(\s+$)/g;  text = text.replace(middleRE, " "); return text.replace(endRE, ""); }  function formatDate(datestr, unknown) { var date = new Date(datestr); return (date.valueOf()) ? dateService.FormatDateTime("", dateService.dateFormatLong, dateService.timeFormatSeconds, date.getFullYear(), date.getMonth()+1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()) : unknown; }  /* * Takes care of XMLBase and <base> * url is the possibly relative url. * node is the node where the url was given (needed for XMLBase) * * This function is called in many places as a workaround for bug 72524 * Once bug 72522 is fixed this code should use the Node.baseURI attribute * * for node==null or url=="", empty string is returned * * This is basically just copied from http: */  function getAbsoluteURL(url, node) { if (!url || !node) return ""; var urlArr = new Array(url);  var doc = node.ownerDocument; if (node.nodeType == Node.ATTRIBUTE_NODE) node = node.ownerElement;  while (node && node.nodeType == Node.ELEMENT_NODE) { var att = node.getAttributeNS(XMLNS, "base"); if (att != "") urlArr.unshift(att);  node = node.parentNode; }   var baseTags = doc.getElementsByTagNameNS(XHTMLNS, "base");  if (baseTags && baseTags.length) { urlArr.unshift(baseTags[baseTags.length - 1].getAttribute("href")); }   var ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService); var URL = ioService.newURI(doc.location.href, null, null);  for (var i=0; i<urlArr.length; i++) { URL.spec = URL.resolve(urlArr[i]); }  return URL.spec; }   function pageInfoOutlinerView(columnids) {  this.columnids = columnids; this.colcount = columnids.length this.rows = 0; this.outliner = null; this.data = new Array; this.selection = null; }  pageInfoOutlinerView.prototype = { set rowCount(c) { throw "rowCount is a readonly property"; }, get rowCount() { return this.rows; },  setOutliner: function(outliner) { this.outliner = outliner; },  getCellText: function(row, column) { var colidx = 0;  while(colidx < this.colcount && column != this.columnids[colidx]) colidx++; return this.data[row][colidx] || ""; },  setCellText: function(row, column, value) { var colidx = 0;  while(colidx < this.colcount && column != this.columnids[colidx]) colidx++; this.data[row][colidx] = value; },  addRow: function(row) { var oldrowcount = this.rows; this.rows = this.data.push(row); },  addRows: function(rows) { var oldrowcount = this.rowCount;  var length = rows.length; for(var i = 0; i < length; i++) this.rows = this.data.push(rows[i]); },  rowCountChanged: function(index, count) { this.outliner.rowCountChanged(index, count); },  invalidate: function() { this.outliner.invalidate(); },  clear: function() { this.data = null; },  getRowProperties: function(row, column, prop) { }, getCellProperties: function(row, prop) { }, getColumnProperties: function(column, elem, prop) { }, isContainer: function(index) { return false; }, isContainerOpen: function(index) { return false; }, isSeparator: function(index) { return false; }, isSorted: function() { return false; }, canDropOn: function(index) { return false; }, canDropBeforeAfter: function(index, before) { return false; }, drop: function(row, orientation) { return false; }, getParentIndex: function(index) { return 0; }, hasNextSibling: function(index, after) { return false; }, getLevel: function(index) { return 0; }, toggleOpenState: function(index) { }, cycleHeader: function(col, elem) { }, selectionChanged: function() { }, cycleCell: function(row, column) { }, isEditable: function(row, column) { return false; }, performAction: function(action) { }, performActionOnRow: function(action, row) { }, performActionOnCell: function(action, row, column) { } }; 
context: function grabAllLinks(aWindow,aDocument){  var theList = [];  if (aWindow && aWindow.frames.length > 0)  {    var num = aWindow.frames.length;    for (var i = 0; i < num; i++)    {      var frame = aWindow.frames[i];      theList = theList.concat(grabAllLinks(frame, frame.document));    }  }  theList = theList.concat(aDocument.getElementsByTagName("link"));  var inputList = aDocument.getElementsByTagName("input");  var length = inputList.length;  for (i = 0; i < length; i++)    if (inputList[i].type.toLowerCase() == "submit")      theList = theList.concat(inputList[i]);  return theList.concat(aDocument.links);}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/22ea93f9638fa1621f2aa1cff7640d41c8ec7d08/pageInfo.js/clean/xpfe/browser/resources/content/pageInfo.js