<!DOCTYPE html>
<html>
<body>
<script> /* This script will be executed in a subframe. */
function runTest()
{
    eventSender.beginDragWithFiles(['resources/UTF8.txt']);
    eventSender.mouseMoveTo(20, 20);
    eventSender.mouseUp();
}

function onInputFileChange()
{
    var file = document.getElementById('file').files[0];
    var reader = new FileReader();
    reader.readAsText(file);
    console.log('Started reading...');

    top.location = 'data:text/html,<p>PASS if no crash.</p><script>testRunner.notifyDone()</scr' + 'ipt>';
}
</script>

<script>
if (window.eventSender) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}
document.write('<iframe src="data:text/html,<input type=file id=file onchange=\'onInputFileChange()\'><script>' + document.getElementsByTagName("script")[0].innerText + 'runTest()</scr' + 'ipt>" style="left:0px;top:0px"></iframe>');
</script>

<p>Test that using FileReader from a document with unique origin doesn't cause a crash.</p>
<p>If testing manually, please drop a file on an input above.</p>
</body>
</html>
