fix bug 113032 [jar: anchors within pages drop the HTML file name] fix resolving relative jar urls, fix anchor handling in jar urls, r=darin, sr=bzbarsky

git-svn-id: svn://10.0.0.236/trunk@139530 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
andreas.otte%debitel.net
2003-03-15 20:00:20 +00:00
parent b76d8fbb79
commit 7a2900ad0c
3 changed files with 46 additions and 14 deletions

View File

@@ -335,12 +335,27 @@ nsJARURI::Resolve(const nsACString &relativePath, nsACString &result)
}
nsCAutoString path(mJAREntry);
PRInt32 pos = path.RFind("/");
if (pos >= 0)
path.Truncate(pos + 1);
else
path = "";
PRInt32 pos = 0;
char first = relativePath.Length() > 0 ? relativePath.First() : '#';
switch (first) {
case '/':
path = "";
break;
case '?':
case '#':
pos = path.RFindChar(first);
if (pos >= 0)
path.Truncate(pos);
break;
default:
pos = path.RFindChar('/');
if (pos >= 0)
path.Truncate(pos + 1);
else
path = "";
}
nsCAutoString resolvedEntry;
rv = net_ResolveRelativePath(relativePath, path,
resolvedEntry);