OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <body> | 3 <body> |
4 <script> /* This script will be executed in a subframe. */ | 4 <script> |
| 5 /* This script will be executed in a subframe. Do not use double slash comments |
| 6 or double quotes in this script tag, they break the test because of innerText |
| 7 call below. */ |
5 function runTest() | 8 function runTest() |
6 { | 9 { |
7 eventSender.beginDragWithFiles(['resources/UTF8.txt']); | 10 eventSender.beginDragWithFiles(['resources/UTF8.txt']); |
8 eventSender.mouseMoveTo(20, 20); | 11 eventSender.mouseMoveTo(20, 20); |
9 eventSender.mouseUp(); | 12 eventSender.mouseUp(); |
10 } | 13 } |
11 | 14 |
12 function onInputFileChange() | 15 function onInputFileChange() |
13 { | 16 { |
14 var file = document.getElementById('file').files[0]; | 17 var file = document.getElementById('file').files[0]; |
15 var reader = new FileReader(); | 18 var reader = new FileReader(); |
16 reader.readAsText(file); | 19 reader.readAsText(file); |
17 console.log('Started reading...'); | 20 console.log('Started reading...'); |
18 | 21 top.postMessage('navigateToSuccess', '*'); |
19 top.location = 'data:text/html,<p>PASS if no crash.</p><script>testRunner.no
tifyDone()</scr' + 'ipt>'; | |
20 } | 22 } |
21 </script> | 23 </script> |
22 | 24 |
23 <script> | 25 <script> |
24 if (window.eventSender) { | 26 if (window.eventSender) { |
25 testRunner.dumpAsText(); | 27 testRunner.dumpAsText(); |
26 testRunner.waitUntilDone(); | 28 testRunner.waitUntilDone(); |
27 } | 29 } |
28 document.write('<iframe src="data:text/html,<input type=file id=file onchange=\'
onInputFileChange()\'><script>' + document.getElementsByTagName("script")[0].inn
erText + 'runTest()</scr' + 'ipt>" style="left:0px;top:0px"></iframe>'); | 30 document.write( |
| 31 '<script>' + |
| 32 'window.onmessage = function(evt){' + |
| 33 ' if (evt.data == "navigateToSuccess") {' + |
| 34 ' window.location = "resources/notify-no-crash.html";' + |
| 35 ' }' + |
| 36 '}' + |
| 37 '</scr' + 'ipt>' + |
| 38 '<iframe src="data:text/html,<input type=file id=file onchange=\'onInputFile
Change()\'><script>' + |
| 39 document.getElementsByTagName("script")[0].innerText + 'runTest()</scr' + 'i
pt>" style="left:0px;top:0px"></iframe>'); |
29 </script> | 40 </script> |
30 | 41 |
31 <p>Test that using FileReader from a document with unique origin doesn't cause a
crash.</p> | 42 <p>Test that using FileReader from a document with unique origin doesn't cause a
crash.</p> |
32 <p>If testing manually, please drop a file on an input above.</p> | 43 <p>If testing manually, please drop a file on an input above.</p> |
33 </body> | 44 </body> |
34 </html> | 45 </html> |
OLD | NEW |