2009-01-16 19:44:20 -08:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=473914
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 473914</title>
|
2009-05-06 13:46:04 -07:00
|
|
|
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
2009-01-16 19:44:20 -08:00
|
|
|
<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");
|
|
|
|
|
2009-03-05 20:05:01 -08:00
|
|
|
// This test relies on normalization (insertion of quote marks) that
|
|
|
|
// we're not really guaranteed to continue doing in the future.
|
2009-01-16 19:44:20 -08:00
|
|
|
div.style.listStyleImage = 'url(http://example.org/**/)';
|
2009-03-05 20:05:01 -08:00
|
|
|
is(div.style.listStyleImage, 'url("http://example.org/**/")',
|
2009-01-16 19:44:20 -08:00
|
|
|
"not treated as comment");
|
|
|
|
div.style.listStyleImage = 'url("http://example.org/**/")';
|
2009-03-05 20:05:01 -08:00
|
|
|
is(div.style.listStyleImage, 'url("http://example.org/**/")',
|
2009-01-16 19:44:20 -08:00
|
|
|
"not treated as comment");
|
|
|
|
div.style.listStyleImage = 'url(/**/foo)';
|
2009-03-05 20:05:01 -08:00
|
|
|
is(div.style.listStyleImage, 'url("/**/foo")',
|
2009-01-16 19:44:20 -08:00
|
|
|
"not treated as comment");
|
|
|
|
div.style.listStyleImage = 'url("/**/foo")';
|
2009-03-05 20:05:01 -08:00
|
|
|
is(div.style.listStyleImage, 'url("/**/foo")',
|
2009-01-16 19:44:20 -08:00
|
|
|
"not treated as comment");
|
|
|
|
div.style.listStyleImage = 'url(/**/)';
|
2009-03-05 20:05:01 -08:00
|
|
|
is(div.style.listStyleImage, 'url("/**/")',
|
2009-01-16 19:44:20 -08:00
|
|
|
"not treated as comment");
|
|
|
|
div.style.listStyleImage = 'url("/**/")';
|
2009-03-05 20:05:01 -08:00
|
|
|
is(div.style.listStyleImage, 'url("/**/")',
|
2009-01-16 19:44:20 -08:00
|
|
|
"not treated as comment");
|
|
|
|
|
2009-08-05 17:45:49 -07:00
|
|
|
// Tests from Alfred Keyser's patch in bug 337287 (modified by dbaron)
|
|
|
|
div.style.listStyleImage = 'url("bad")';
|
|
|
|
div.style.listStyleImage = 'url(good /*bad comment*/)';
|
|
|
|
is(div.style.listStyleImage, 'url("bad")',
|
|
|
|
"comment not allowed inside token");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url(good /*bad comments*/ /*Hello*/)';
|
|
|
|
is(div.style.listStyleImage, 'url("bad")',
|
|
|
|
"comment not allowed inside token");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url(good/*commentaspartofurl*/)';
|
|
|
|
is(div.style.listStyleImage, 'url("good/*commentaspartofurl*/")',
|
|
|
|
"comment-like syntax not comment inside of url");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url("bad")';
|
|
|
|
div.style.listStyleImage = 'url(good/**/ /*secondcommentcanbeskipped*/ )';
|
|
|
|
is(div.style.listStyleImage, 'url("bad")',
|
|
|
|
"comment not allowed inside token");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url(/*partofurl*/good)';
|
|
|
|
is(div.style.listStyleImage, 'url("/*partofurl*/good")',
|
|
|
|
"comment not parsed as part of url");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url(good';
|
|
|
|
is(div.style.listStyleImage, 'url("good")',
|
|
|
|
"URL ending with eof not correctly handled");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url("bad")';
|
|
|
|
div.style.listStyleImage = 'url(good /*)*/';
|
|
|
|
is(div.style.listStyleImage, 'url("bad")',
|
|
|
|
"comment not allowed inside token");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url("bad")';
|
|
|
|
div.style.listStyleImage = 'url(good /*)*/ tokenaftercommentevenwithclosebracketisinvalid';
|
|
|
|
is(div.style.listStyleImage, 'url("bad")',
|
|
|
|
"comment not allowed inside token");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url(bad)';
|
|
|
|
div.style.listStyleImage = 'url("good"';
|
|
|
|
is(div.style.listStyleImage, 'url("good")',
|
|
|
|
"URL as string without close bracket");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url(bad)';
|
|
|
|
div.style.listStyleImage = 'url("good';
|
|
|
|
is(div.style.listStyleImage, 'url("good")',
|
|
|
|
"URL as string without closing quote");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url("bad")';
|
|
|
|
div.style.listStyleImage = 'url(good notgood';
|
|
|
|
is(div.style.listStyleImage, 'url("bad")',
|
|
|
|
"second token should make url invalid");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url("bad")';
|
|
|
|
div.style.listStyleImage = 'url(good(notgood';
|
|
|
|
is(div.style.listStyleImage, 'url("bad")',
|
|
|
|
"open bracket in url not recognized as invalid");
|
|
|
|
|
|
|
|
var longurl = '';
|
|
|
|
for (i=0;i<1000;i++) {
|
|
|
|
longurl = longurl + 'verylongurlindeed_thequickbrownfoxjumpsoverthelazydoq';
|
|
|
|
}
|
|
|
|
div.style.listStyleImage = 'url(' + longurl;
|
|
|
|
is(div.style.listStyleImage, 'url("' + longurl + '")',
|
|
|
|
"very long url not correctly parsed");
|
|
|
|
|
|
|
|
|
|
|
|
// Additional tests from
|
|
|
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=337287#c21
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url(good/*)';
|
|
|
|
is(div.style.listStyleImage, 'url("good/*")',
|
|
|
|
"URL containing comment start is valid");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url("bad")';
|
|
|
|
div.style.listStyleImage = 'url(good bad)';
|
|
|
|
is(div.style.listStyleImage, 'url("bad")',
|
|
|
|
"unquoted URL with spaces not allowed");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url(\\g b)';
|
|
|
|
is(div.style.listStyleImage, 'url("bad")',
|
|
|
|
"unquoted URL with spaces not allowed");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url( \\g b)';
|
|
|
|
is(div.style.listStyleImage, 'url("bad")',
|
|
|
|
"unquoted URL with spaces not allowed");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url(c\\g b)';
|
|
|
|
is(div.style.listStyleImage, 'url("bad")',
|
|
|
|
"unquoted URL with spaces not allowed");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url(cc\\g b)';
|
|
|
|
is(div.style.listStyleImage, 'url("bad")',
|
|
|
|
"unquoted URL with spaces not allowed");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url(\\f b)';
|
|
|
|
is(div.style.listStyleImage, 'url("bad")',
|
|
|
|
"unquoted URL with spaces not allowed");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url( \\f b)';
|
|
|
|
is(div.style.listStyleImage, 'url("bad")',
|
|
|
|
"unquoted URL with spaces not allowed");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url(c\\f b)';
|
|
|
|
is(div.style.listStyleImage, 'url("bad")',
|
|
|
|
"unquoted URL with spaces not allowed");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url(cc\\f b)';
|
|
|
|
is(div.style.listStyleImage, 'url("bad")',
|
|
|
|
"unquoted URL with spaces not allowed");
|
|
|
|
|
|
|
|
div.style.listStyleImage = 'url(\\f good)';
|
|
|
|
is(div.style.listStyleImage, 'url("\\F good")', "URL allowed");
|
|
|
|
div.style.listStyleImage = 'url( \\f good)';
|
|
|
|
is(div.style.listStyleImage, 'url("\\F good")', "URL allowed");
|
|
|
|
div.style.listStyleImage = 'url(f\\f good)';
|
|
|
|
is(div.style.listStyleImage, 'url("f\\F good")', "URL allowed");
|
|
|
|
div.style.listStyleImage = 'url(go\\od)';
|
|
|
|
is(div.style.listStyleImage, 'url("good")', "URL allowed");
|
|
|
|
div.style.listStyleImage = 'url(goo\\d)';
|
|
|
|
is(div.style.listStyleImage, 'url("goo\\D ")', "URL allowed");
|
|
|
|
div.style.listStyleImage = 'url(go\\o)';
|
|
|
|
is(div.style.listStyleImage, 'url("goo")', "URL allowed");
|
|
|
|
|
2009-01-16 19:44:20 -08:00
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|