11cb0ef41Sopenharmony_ci<!DOCTYPE html>
21cb0ef41Sopenharmony_ci<html>
31cb0ef41Sopenharmony_ci<head>
41cb0ef41Sopenharmony_ci    <meta charset="utf-8">
51cb0ef41Sopenharmony_ci    <title>Blob and File reference URL Test(2)</title>
61cb0ef41Sopenharmony_ci    <link rel=help href="http://dev.w3.org/2006/webapi/FileAPI/#convenienceAPI">
71cb0ef41Sopenharmony_ci    <link rel=author title="Breezewish" href="mailto:me@breeswish.org">
81cb0ef41Sopenharmony_ci    <script src="/resources/testharness.js"></script>
91cb0ef41Sopenharmony_ci    <script src="/resources/testharnessreport.js"></script>
101cb0ef41Sopenharmony_ci</head>
111cb0ef41Sopenharmony_ci<body>
121cb0ef41Sopenharmony_ci    <form name="upload">
131cb0ef41Sopenharmony_ci        <input type="file" id="fileChooser"><br><input type="button" id="start" value="start">
141cb0ef41Sopenharmony_ci    </form>
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ci    <div>
171cb0ef41Sopenharmony_ci        <p>Test steps:</p>
181cb0ef41Sopenharmony_ci        <ol>
191cb0ef41Sopenharmony_ci            <li>Download the <a href="support/file_test2.txt">file</a>.</li>
201cb0ef41Sopenharmony_ci            <li>Select the file in the file inputbox.</li>
211cb0ef41Sopenharmony_ci            <li>Delete the file.</li>
221cb0ef41Sopenharmony_ci            <li>Click the 'start' button.</li>
231cb0ef41Sopenharmony_ci        </ol>
241cb0ef41Sopenharmony_ci    </div>
251cb0ef41Sopenharmony_ci
261cb0ef41Sopenharmony_ci    <div id="log"></div>
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_ci    <script>
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ci        var fileChooser = document.querySelector('#fileChooser');
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ci        setup({explicit_done: true});
331cb0ef41Sopenharmony_ci        setup({explicit_timeout: true});
341cb0ef41Sopenharmony_ci
351cb0ef41Sopenharmony_ci        on_event(document.querySelector('#start'), 'click', function() {
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ci            async_test(function(t) {
381cb0ef41Sopenharmony_ci
391cb0ef41Sopenharmony_ci                var url = URL.createObjectURL(fileChooser.files[0]);
401cb0ef41Sopenharmony_ci
411cb0ef41Sopenharmony_ci                var xhr = new XMLHttpRequest();
421cb0ef41Sopenharmony_ci                xhr.open('GET', url, true);
431cb0ef41Sopenharmony_ci                xhr.onreadystatechange = t.step_func(function() {
441cb0ef41Sopenharmony_ci                    switch (xhr.readyState) {
451cb0ef41Sopenharmony_ci                    case xhr.DONE:
461cb0ef41Sopenharmony_ci                        assert_equals(xhr.status, 500, 'status code should be 500.');
471cb0ef41Sopenharmony_ci                        t.done();
481cb0ef41Sopenharmony_ci                        return;
491cb0ef41Sopenharmony_ci                    }
501cb0ef41Sopenharmony_ci                });
511cb0ef41Sopenharmony_ci
521cb0ef41Sopenharmony_ci                xhr.send();
531cb0ef41Sopenharmony_ci
541cb0ef41Sopenharmony_ci            }, 'Check whether the browser response 500 in XHR if the selected file which File/Blob URL refered is not found');
551cb0ef41Sopenharmony_ci
561cb0ef41Sopenharmony_ci            done();
571cb0ef41Sopenharmony_ci
581cb0ef41Sopenharmony_ci        });
591cb0ef41Sopenharmony_ci
601cb0ef41Sopenharmony_ci    </script>
611cb0ef41Sopenharmony_ci</body>
621cb0ef41Sopenharmony_ci</html>
63