From fdb5ed5105d97570dafa5cea72b3ae3a9fa05350 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Sat, 24 Jun 2006 02:20:13 +0000 Subject: [PATCH] Fix XLink handling in page info. Bug 286949, patch by Christian Schmidt , r=db48x, sr=neil --- xpfe/browser/resources/content/pageInfo.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/xpfe/browser/resources/content/pageInfo.js b/xpfe/browser/resources/content/pageInfo.js index 177560c2b955..1ba731ceb0a5 100644 --- a/xpfe/browser/resources/content/pageInfo.js +++ b/xpfe/browser/resources/content/pageInfo.js @@ -584,13 +584,16 @@ function grabAll(elem) addImage(elem.data, gStrings.mediaObject, getValueText(elem), elem, false); else if (elem instanceof nsIEmbedElement) addImage(elem.src, gStrings.mediaEmbed, "", elem, false); - else - if (elem.hasAttributeNS(XLinkNS, "href")) - linkView.addRow([getValueText(elem), - ioService.newURI(elem.getAttributeNS(XLinkNS, "href"), null, elem.baseURI).spec, - gStrings.linkX, - ""]); - + else if (elem.hasAttributeNS(XLinkNS, "href")) { + var ioService = Components.classes["@mozilla.org/network/io-service;1"] + .getService(Components.interfaces.nsIIOService); + url = elem.getAttributeNS(XLinkNS, "href"); + try { + var baseURI = ioService.newURI(elem.baseURI, elem.ownerDocument.characterSet, null); + url = ioService.newURI(href, elem.ownerDocument.characterSet, baseURI).spec; + } catch (e) {} + linkView.addRow([getValueText(elem), url, gStrings.linkX, ""]); + } return NodeFilter.FILTER_ACCEPT; }