Bug 353364 - Same-document references in xml-stylesheet PI processed incorrectly. r+sr=peterv, a191=beltzner

This commit is contained in:
Martin 2008-11-28 21:21:55 +00:00
parent 8fe34ebf2e
commit 6895526488
3 changed files with 8 additions and 10 deletions

View File

@ -171,8 +171,7 @@ nsXMLStylesheetPI::GetStyleSheetURL(PRBool* aIsInline,
*aURI = nsnull;
nsAutoString href;
GetAttrValue(nsGkAtoms::href, href);
if (href.IsEmpty()) {
if (!GetAttrValue(nsGkAtoms::href, href)) {
return;
}

View File

@ -1374,10 +1374,9 @@ nsXMLContentSink::HandleProcessingInstruction(const PRUnichar *aTarget,
nsAutoString href, title, media;
PRBool isAlternate = PR_FALSE;
ParsePIData(data, href, title, media, isAlternate);
// If there was no href, we can't do anything with this PI
if (href.IsEmpty()) {
if (!ParsePIData(data, href, title, media, isAlternate)) {
return DidProcessATokenImpl();
}
@ -1386,16 +1385,14 @@ nsXMLContentSink::HandleProcessingInstruction(const PRUnichar *aTarget,
}
/* static */
void
PRBool
nsXMLContentSink::ParsePIData(const nsString &aData, nsString &aHref,
nsString &aTitle, nsString &aMedia,
PRBool &aIsAlternate)
{
nsParserUtils::GetQuotedAttributeValue(aData, nsGkAtoms::href, aHref);
// If there was no href, we can't do anything with this PI
if (aHref.IsEmpty()) {
return;
if (!nsParserUtils::GetQuotedAttributeValue(aData, nsGkAtoms::href, aHref)) {
return PR_FALSE;
}
nsParserUtils::GetQuotedAttributeValue(aData, nsGkAtoms::title, aTitle);
@ -1406,6 +1403,8 @@ nsXMLContentSink::ParsePIData(const nsString &aData, nsString &aHref,
nsParserUtils::GetQuotedAttributeValue(aData, nsGkAtoms::alternate, alternate);
aIsAlternate = alternate.EqualsLiteral("yes");
return PR_TRUE;
}
/*

View File

@ -107,7 +107,7 @@ public:
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(nsICSSStyleSheet* aSheet, PRBool aWasAlternate,
nsresult aStatus);
static void ParsePIData(const nsString &aData, nsString &aHref,
static PRBool ParsePIData(const nsString &aData, nsString &aHref,
nsString &aTitle, nsString &aMedia,
PRBool &aIsAlternate);