Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(668)

Side by Side Diff: LayoutTests/fast/files/apply-blob-url-to-xhr.html

Issue 1240503004: Revert of [XMLHttpRequest] Stop throwing for network error in async mode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/files/apply-blob-url-to-xhr-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <body> 3 <body>
4 <input type="file" name="file" id="file" onchange="onInputFileChange()"> 4 <input type="file" name="file" id="file" onchange="onInputFileChange()">
5 <pre id='console'></pre> 5 <pre id='console'></pre>
6 6
7 <script src="resources/apply-blob-url-to-xhr.js"></script>
8 <script> 7 <script>
8 function log(message)
9 {
10 document.getElementById('console').appendChild(document.createTextNode(messa ge + "\n"));
11 }
12
13 function sendXMLHttpRequest(method, url)
14 {
15 var xhr = new XMLHttpRequest();
16 xhr.open(method, url, false);
17 try {
18 xhr.send();
19 log("Status: " + xhr.status);
20 log("Response: " + xhr.responseText);
21 } catch (error) {
22 log("Received exception, code: " + error.code + ", name: " + error.name + ", message: " + error.message);
23 }
24 }
25
9 function onInputFileChange() 26 function onInputFileChange()
10 { 27 {
11 var file = document.getElementById("file").files[0]; 28 var file = document.getElementById("file").files[0];
29 var fileURL = window.URL.createObjectURL(file);
12 30
13 runXHRs(file); 31 log("Test that XMLHttpRequest GET succeeds.");
32 sendXMLHttpRequest("GET", fileURL);
33
34 log("Test that XMLHttpRequest POST fails.");
35 sendXMLHttpRequest("POST", fileURL);
36
37 log("Test that XMLHttpRequest GET fails after the blob URL is revoked.");
38 window.URL.revokeObjectURL(fileURL);
39 sendXMLHttpRequest("GET", fileURL);
40
41 log("DONE");
42 if (testRunner.notifyDone)
43 testRunner.notifyDone();
14 } 44 }
15 45
16 function runTests() 46 function runTests()
17 { 47 {
18 eventSender.beginDragWithFiles(['resources/UTF8.txt']); 48 eventSender.beginDragWithFiles(['resources/UTF8.txt']);
19 eventSender.mouseMoveTo(10, 10); 49 eventSender.mouseMoveTo(10, 10);
20 eventSender.mouseUp(); 50 eventSender.mouseUp();
21 } 51 }
22 52
23 if (window.eventSender) { 53 if (window.eventSender) {
24 testRunner.dumpAsText(); 54 testRunner.dumpAsText();
25 testRunner.waitUntilDone(); 55 testRunner.waitUntilDone();
26 window.onload = runTests; 56 window.onload = runTests;
27 } 57 }
28 </script> 58 </script>
29 </body> 59 </body>
30 </html> 60 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/files/apply-blob-url-to-xhr-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698