Bug 42616: form actions with anchor specified (#) do not work; r=kmcclusk

This commit is contained in:
pollmann%netscape.com 2000-08-03 23:03:58 +00:00
Родитель d2b093a3d7
Коммит ff2bfd69c2
1 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -819,8 +819,17 @@ nsFormFrame::OnSubmit(nsIPresContext* aPresContext, nsIFrame* aFrame)
}
nsAutoString theScheme; theScheme.AssignWithConversion( NS_STATIC_CAST(const char*, scheme) );
// Append the URI encoded variable/value pairs for GET's
if (!theScheme.EqualsIgnoreCase("javascript")) { // Not for JS URIs, see bug 26917
if (!isPost) {
if (!isPost) {
if (!theScheme.EqualsIgnoreCase("javascript")) { // Not for JS URIs, see bug 26917
// Bug 42616: Trim off named anchor before query string
PRInt32 namedAnchorPos = href.FindChar('#', PR_FALSE, 0);
nsAutoString namedAnchor;
if (kNotFound != namedAnchorPos) {
href.Right(namedAnchor, namedAnchorPos);
href.Truncate(namedAnchorPos);
}
if (href.FindChar('?', PR_FALSE, 0) == kNotFound) { // Add a ? if needed
href.AppendWithConversion('?');
} else { // Adding to existing query string
@ -829,6 +838,11 @@ nsFormFrame::OnSubmit(nsIPresContext* aPresContext, nsIFrame* aFrame)
}
}
href.Append(data);
// Bug 42616: Add named anchor to end after query string
if (namedAnchor.Length()) {
href.Append(namedAnchor);
}
}
}
nsAutoString absURLSpec;