Bug 649134 - Ignore an empty or whitespace only <link> href. r=bzbarsky

This commit is contained in:
Mats Palmgren 2011-05-11 11:46:59 +02:00
parent ef8b8a4670
commit d9580d4443
5 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1,31 @@
<!DOCTYPE HTML>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Testcase for bug </title>
<link rel="stylesheet" type="text/css" href="" />
<!--
#foo {
/* This doesn't get evaluated */
color: red;
}
#ie {
border: 5px solid red;
}
#ie {
display: block;
}
#moz {
color: blue;
/* display: none; */
}
-->
</head>
<body>
<p id="foo">foo</p>
<p id="ie">ie</p>
<p id="moz">moz</p>
</body>
</html>

View File

@ -0,0 +1,31 @@
<!DOCTYPE HTML>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Testcase for bug </title>
<link rel="stylesheet" type="text/css" href=" " />
<!--
#foo {
/* This doesn't get evaluated */
color: red;
}
#ie {
border: 5px solid red;
}
#ie {
display: block;
}
#moz {
color: blue;
/* display: none; */
}
-->
</head>
<body>
<p id="foo">foo</p>
<p id="ie">ie</p>
<p id="moz">moz</p>
</body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE HTML>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Testcase for bug </title>
</head>
<body>
<p id="foo">foo</p>
<p id="ie">ie</p>
<p id="moz">moz</p>
</body>
</html>

View File

@ -21,6 +21,9 @@ include autofocus/reftest.list
== 596455-2a.html 596455-ref-2.html
== 596455-2b.html 596455-ref-2.html
== 610935.html 610935-ref.html
== 649134-1.html 649134-ref.html
== 649134-2.html 649134-ref.html
== hidden-1a.html hidden-1-ref.html
== hidden-1b.html hidden-1-ref.html
== hidden-1c.html hidden-1-ref.html

View File

@ -389,6 +389,12 @@ already_AddRefed<nsIURI>
nsHTMLLinkElement::GetStyleSheetURL(PRBool* aIsInline)
{
*aIsInline = PR_FALSE;
nsAutoString href;
GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
href.Trim(" \t\n\r\f"); // trim HTML5 whitespace
if (href.IsEmpty()) {
return nsnull;
}
return Link::GetURI();
}