1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../resources/js-test.js"></script>
7 <p>Tests for value sanitization algorithm.
</p>
8 <div id=
"console"></div>
13 debug('Email with multiple:');
14 input
= document
.createElement('input');
15 input
.multiple
= true;
17 input
.setAttribute('value', ' tkent@chromium.org, tkent@example.!!! ');
18 shouldBe('input.value', '"tkent@chromium.org,tkent@example.!!!"');
19 debug('Email without multiple:');
20 input
= document
.createElement('input');
21 input
.multiple
= false;
23 input
.setAttribute('value', ' tkent@chromium.org, tkent@example.*** \r\n');
24 shouldBe('input.value', '"tkent@chromium.org, tkent@example.***"');
28 input
= document
.createElement('input');
29 input
.setAttribute('value', '65536');
30 input
.type
= 'number';
31 shouldBe('input.value', '"65536"');
32 shouldBe('input.value = "256"; input.value', '"256"');
33 shouldBe('input.value = ""; input.value', '""');
38 input
= document
.createElement('input');
42 shouldBe('input.value', '"50"');
46 var container
= document
.createElement('div');
47 document
.body
.appendChild(container
);
48 container
.innerHTML
= '<input type="text" id="text" value="\n\r foo bar \n\r\n">';
49 input
= document
.getElementById('text');
50 shouldBe('input.value', '" foo bar "');
52 document
.execCommand('SelectAll');
53 shouldBe('document.getSelection().toString()', '" foo bar "');
55 input
.value
= String
.fromCharCode(0xD800);
56 shouldBe('input.value', 'String.fromCharCode(0xD800)');
58 input
.value
= 'foo\0bar';
59 shouldBeEqualToString('input.value', 'foo\0bar');
61 input
.value
= 'foo\bbar';
62 shouldBeEqualToString('input.value', "foo\bbar");
64 input
.value
= 'foo\tbar';
65 shouldBeEqualToString('input.value', "foo\tbar");
67 input
.value
= "foo\vbar";
68 shouldBeEqualToString('input.value', "foo\vbar");
70 input
.value
= "foo\fbar";
71 shouldBeEqualToString('input.value', "foo\fbar");
73 // FIXME: Add more sanitization tests.
74 // https://bugs.webkit.org/show_bug.cgi?id=37024
76 container
.innerHTML
= '';