mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-19 01:10:22 +00:00
Bug 548263 - Copied the HTML Content sink code for handling rel value to the XML Content sink; r=hsivonen
This commit is contained in:
parent
6dca5e5eaf
commit
fb306dc4e6
@ -647,14 +647,28 @@ nsXMLContentSink::CloseElement(nsIContent* aContent)
|
||||
}
|
||||
}
|
||||
// Look for <link rel="dns-prefetch" href="hostname">
|
||||
// and look for <link rel="next" href="hostname"> like in HTML sink
|
||||
if (nodeInfo->Equals(nsGkAtoms::link, kNameSpaceID_XHTML)) {
|
||||
nsAutoString relVal;
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::rel, relVal);
|
||||
if (relVal.EqualsLiteral("dns-prefetch")) {
|
||||
nsAutoString hrefVal;
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::href, hrefVal);
|
||||
if (!hrefVal.IsEmpty()) {
|
||||
PrefetchDNS(hrefVal);
|
||||
if (!relVal.IsEmpty()) {
|
||||
// XXX seems overkill to generate this string array
|
||||
nsAutoTArray<nsString, 4> linkTypes;
|
||||
nsStyleLinkElement::ParseLinkTypes(relVal, linkTypes);
|
||||
PRBool hasPrefetch = linkTypes.Contains(NS_LITERAL_STRING("prefetch"));
|
||||
if (hasPrefetch || linkTypes.Contains(NS_LITERAL_STRING("next"))) {
|
||||
nsAutoString hrefVal;
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::href, hrefVal);
|
||||
if (!hrefVal.IsEmpty()) {
|
||||
PrefetchHref(hrefVal, aContent, hasPrefetch);
|
||||
}
|
||||
}
|
||||
if (linkTypes.Contains(NS_LITERAL_STRING("dns-prefetch"))) {
|
||||
nsAutoString hrefVal;
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::href, hrefVal);
|
||||
if (!hrefVal.IsEmpty()) {
|
||||
PrefetchDNS(hrefVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user