Remove handling of comments inside CSS url() tokens. (Bug 473914) r+sr=bzbarsky

This commit is contained in:
L. David Baron 2009-01-16 19:44:20 -08:00
parent 558eb1c7dd
commit a7223a0c21
3 changed files with 51 additions and 17 deletions

View File

@ -853,23 +853,6 @@ nsCSSScanner::NextURL(nsCSSToken& aToken)
(void) EatWhiteSpace();
return PR_TRUE;
}
if (ch == '/') {
PRInt32 nextChar = Peek();
if (nextChar == '*') {
(void) Read();
#if 0
// If we change our storage data structures such that comments are
// stored (for Editor), we should reenable this code, condition it
// on being in editor mode, and apply glazou's patch from bug
// 60290.
aToken.mIdent.SetCapacity(2);
aToken.mIdent.Assign(PRUnichar(ch));
aToken.mIdent.Append(PRUnichar(nextChar));
return ParseCComment(aToken);
#endif
return SkipCComment() && Next(aToken);
}
}
// Process a url lexical token. A CSS1 url token can contain
// characters beyond identifier characters (e.g. '/', ':', etc.)

View File

@ -115,6 +115,7 @@ _TEST_FILES = test_acid3_test46.html \
test_namespace_rule.html \
test_of_type_selectors.xhtml \
test_parse_rule.html \
test_parse_url.html \
test_property_database.html \
test_property_syntax_errors.html \
test_selectors.html \

View File

@ -0,0 +1,50 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=473914
-->
<head>
<title>Test for Bug 473914</title>
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=473914">Mozilla Bug 473914</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 473914 **/
var div = document.getElementById("content");
// This test relies on normalization (removal of quote marks) that we're not
// really guaranteed to continue doing in the future (and we should probably
// actually change to add the quote marks).
div.style.listStyleImage = 'url(http://example.org/**/)';
is(div.style.listStyleImage, 'url(http://example.org/**/)',
"not treated as comment");
div.style.listStyleImage = 'url("http://example.org/**/")';
is(div.style.listStyleImage, 'url(http://example.org/**/)',
"not treated as comment");
div.style.listStyleImage = 'url(/**/foo)';
is(div.style.listStyleImage, 'url(/**/foo)',
"not treated as comment");
div.style.listStyleImage = 'url("/**/foo")';
is(div.style.listStyleImage, 'url(/**/foo)',
"not treated as comment");
div.style.listStyleImage = 'url(/**/)';
is(div.style.listStyleImage, 'url(/**/)',
"not treated as comment");
div.style.listStyleImage = 'url("/**/")';
is(div.style.listStyleImage, 'url(/**/)',
"not treated as comment");
</script>
</pre>
</body>
</html>