Bug 409310 - Make SVG image viewing in page info more robust. r=mano,sr=bzbarsky,a1.9=mconnor

git-svn-id: svn://10.0.0.236/trunk@242216 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
longsonr%gmail.com 2007-12-31 15:40:49 +00:00
parent 24acb468e4
commit 73a306db0b
2 changed files with 8 additions and 3 deletions

View File

@ -611,8 +611,12 @@ function grabAll(elem)
(elem.hasAttribute("alt")) ? elem.alt : gStrings.notSet, elem, false);
#ifdef MOZ_SVG
else if (elem instanceof SVGImageElement) {
var href = makeURLAbsolute(elem.baseURI, elem.href.baseVal);
addImage(href, gStrings.mediaImg, "", elem, false);
try {
// Note: makeURLAbsolute will throw if either the baseURI is not a valid URI
// or the URI formed from the baseURI and the URL is not a valid URI
var href = makeURLAbsolute(elem.baseURI, elem.href.baseVal);
addImage(href, gStrings.mediaImg, "", elem, false);
} catch (e) { }
}
#endif
else if (elem instanceof HTMLLinkElement) {

View File

@ -497,7 +497,8 @@ function isElementVisible(aElement)
function makeURLAbsolute(aBase, aUrl)
{
return IO.newURI(IO.newURI(aBase).resolve(aUrl)).spec;
// Note: IO.newURI(aUri) will throw if aUri is not a valid URI
return IO.newURI(aUrl, null, IO.newURI(aBase)).spec;
}
function getBrowserFromContentWindow(aContentWindow)