| Index: LayoutTests/fast/innerHTML/javascript-url.html
|
| diff --git a/LayoutTests/fast/innerHTML/javascript-url.html b/LayoutTests/fast/innerHTML/javascript-url.html
|
| index 897d2c6dbbe47b2c15917870cd36d5b1f2e3eb75..ed1e30a1783076879adc6073c7fc12554dc8d3d3 100644
|
| --- a/LayoutTests/fast/innerHTML/javascript-url.html
|
| +++ b/LayoutTests/fast/innerHTML/javascript-url.html
|
| @@ -1,62 +1,31 @@
|
| -<head>
|
| -<script>
|
| -if (window.testRunner)
|
| - testRunner.dumpAsText();
|
| -
|
| -function print(message, color)
|
| -{
|
| - var paragraph = document.createElement("div");
|
| - paragraph.appendChild(document.createTextNode(message));
|
| - paragraph.style.fontFamily = "monospace";
|
| - if (color)
|
| - paragraph.style.color = color;
|
| - document.getElementById("console").appendChild(paragraph);
|
| -}
|
| -
|
| -function run(a)
|
| -{
|
| - print(a);
|
| - try {
|
| - eval(a);
|
| - } catch(e) {
|
| - print(e);
|
| - }
|
| -}
|
| -
|
| -function shouldBe(a, b)
|
| -{
|
| - var evalA;
|
| - try {
|
| - evalA = eval(a);
|
| - } catch(e) {
|
| - evalA = e;
|
| - }
|
| -
|
| - if (evalA == b)
|
| - print("PASS: " + a + " should be " + b + " and is.", "green");
|
| - else
|
| - print("FAIL: " + a + " should be " + b + " but instead is " + evalA + ".", "red");
|
| -}
|
| -</script>
|
| -</head>
|
| +<!DOCTYPE html>
|
| +<script src="../../resources/js-test.js"></script>
|
| <body>
|
| -Test that innerHTML does not mangle javascript: urls.
|
| +Test that innerHTML/outerHTML does not mangle javascript: urls.
|
| <div id=console></div>
|
| -<div id=jsurltest><a href='
|
| - javascript:test(&37;3C!--D--&37;3E)'>link</a></div>
|
| +<div id=jsurltest><a href='javascript:test(&37;3C!--D--&37;3E)'>link</a></div>
|
| <script>
|
| var r = document.getElementById('jsurltest');
|
| -run("r.innerHTML = r.innerHTML.replace(/&37;3C!--D--&37;3E/g, 123)");
|
| -shouldBe("r.innerHTML.indexOf('javascript:test(123)') > -1", true);
|
| -run("r.firstChild.setAttribute('href', 'javascript:test(\"text<\")')");
|
| -shouldBe("r.innerHTML.indexOf('javascript:test(\"text<\")') > -1", true);
|
| -run('r.firstChild.setAttribute("href", "javascript:test(\'text>\')")');
|
| -shouldBe('r.innerHTML.indexOf("javascript:test(\'text>\')") > -1', true);
|
| +
|
| +r.innerHTML = r.innerHTML.replace('&37;3C!--D--&37;3E', 123);
|
| +shouldBeEqualToString('r.innerHTML', '<a href="javascript:test(123)">link</a>');
|
| +
|
| +r.firstChild.setAttribute('href', 'javascript:test(\"text<\")');
|
| +shouldBeEqualToString('r.innerHTML', '<a href=\'javascript:test("text<")\'>link</a>');
|
| +
|
| +r.firstChild.setAttribute('href', 'javascript:test(\'text>\')');
|
| +shouldBeEqualToString("r.innerHTML", '<a href="javascript:test(\'text>\')">link</a>');
|
| +
|
| testString = 'javascript:test(\'text&\',"test2&")';
|
| -print("testString = " + testString);
|
| -run('r.firstChild.setAttribute("href", testString)');
|
| -shouldBe('r.innerHTML.indexOf("javascript:test(\'text&\',"test2&")") > 1', true);
|
| +r.firstChild.setAttribute('href', testString);
|
| +shouldBeEqualToString('r.innerHTML', '<a href="javascript:test(\'text&\',"test2&")">link</a>');
|
| +
|
| +r.firstChild.href = 'javascript:window.location=\'?x&y\'';
|
| +shouldBeEqualToString("r.firstChild.outerHTML", '<a href="javascript:window.location=\'?x&y\'">link</a>');
|
|
|
| -run("r.firstChild.setAttribute('href', 'http://www.google.fi/search?q=scarlett johansson&meta=&btnG=Google-haku')");
|
| -print(r.innerHTML);
|
| +// Behavior is same as FF
|
| +r.firstChild.href = 'javascript:window.location=\'?x&y\'';
|
| +shouldBeEqualToString('r.firstChild.outerHTML', '<a href="javascript:window.location=\'?x&amp;y\'">link</a>');
|
| +r.innerHTML = '<a href="javascript:window.location=\'?x&y\'">link</a>';
|
| +shouldBeEqualToString('r.firstChild.outerHTML', '<a href="javascript:window.location=\'?x&y\'">link</a>');
|
| </script>
|
|
|