Bug 1094449. Treat @rel on anchors as a set of space-separated tokens, not a single token. r=smaug

This commit is contained in:
Boris Zbarsky 2014-11-21 14:58:54 -05:00
parent 7711f28da3
commit d0a90742ba
2 changed files with 9 additions and 6 deletions

View File

@ -13189,12 +13189,15 @@ nsDocShell::OnLinkClickSync(nsIContent *aContent,
uint32_t flags = INTERNAL_LOAD_FLAGS_NONE;
if (IsElementAnchor(aContent)) {
MOZ_ASSERT(aContent->IsHTML());
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::rel,
NS_LITERAL_STRING("noreferrer"),
aContent->IsInHTMLDocument() ?
eIgnoreCase : eCaseMatters)) {
nsAutoString referrer;
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::rel, referrer);
nsWhitespaceTokenizerTemplate<nsContentUtils::IsHTMLWhitespace> tok(referrer);
while (tok.hasMoreTokens()) {
if (tok.nextToken().LowerCaseEqualsLiteral("noreferrer")) {
flags |= INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER |
INTERNAL_LOAD_FLAGS_NO_OPENER;
break;
}
}
}

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<body onload="window.parent.onloadCount++">
<a href="bug530396-noref.sjs" rel="noreferrer" id="target1">bug530396-noref.sjs</a>
<a href="bug530396-noref.sjs?newwindow" rel="noreferrer" id="target2" target="newwindow">bug530396-noref.sjs with new window</a>
<a href="bug530396-noref.sjs" rel="noreferrer foo" id="target1">bug530396-noref.sjs</a>
<a href="bug530396-noref.sjs?newwindow" rel="nofollow noreferrer" id="target2" target="newwindow">bug530396-noref.sjs with new window</a>
</body>
</html>