Bug 582940 - Make the HTML5 parser URL unescape <a name> until HTML5-compliant fragment navigation is supported. r=bzbarsky, a=blocking2.0-betaN.

This commit is contained in:
Henri Sivonen
2010-07-30 13:08:36 +03:00
parent b963d700f7
commit 65f2ada335
6 changed files with 149 additions and 2 deletions

View File

@@ -60,6 +60,7 @@
#include "nsIMutationObserver.h"
#include "nsIFormProcessor.h"
#include "nsIServiceManager.h"
#include "nsEscape.h"
#ifdef MOZ_SVG
#include "nsHtml5SVGLoadDispatcher.h"
@@ -458,8 +459,19 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
// prefix doesn't need regetting. it is always null or a static atom
// local name is never null
nsCOMPtr<nsIAtom> localName = Reget(attributes->getLocalName(i));
newContent->SetAttr(attributes->getURI(i), localName, attributes->getPrefix(i), *(attributes->getValue(i)), PR_FALSE);
// XXX what to do with nsresult?
if (ns == kNameSpaceID_XHTML &&
nsHtml5Atoms::a == name &&
nsHtml5Atoms::name == localName) {
// This is an HTML5-incompliant Geckoism.
// Remove when fixing bug 582361
NS_ConvertUTF16toUTF8 cname(*(attributes->getValue(i)));
NS_ConvertUTF8toUTF16 uv(nsUnescape(cname.BeginWriting()));
newContent->SetAttr(attributes->getURI(i), localName,
attributes->getPrefix(i), uv, PR_FALSE);
} else {
newContent->SetAttr(attributes->getURI(i), localName,
attributes->getPrefix(i), *(attributes->getValue(i)), PR_FALSE);
}
}
return rv;