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

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

Issue 1060113004: [XMLHttpRequest] Stop throwing for network error in async mode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebease 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>
7 <script> 8 <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
26 function onInputFileChange() 9 function onInputFileChange()
27 { 10 {
28 var file = document.getElementById("file").files[0]; 11 var file = document.getElementById("file").files[0];
29 var fileURL = window.URL.createObjectURL(file);
30 12
31 log("Test that XMLHttpRequest GET succeeds."); 13 runXHRs(file);
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();
44 } 14 }
45 15
46 function runTests() 16 function runTests()
47 { 17 {
48 eventSender.beginDragWithFiles(['resources/UTF8.txt']); 18 eventSender.beginDragWithFiles(['resources/UTF8.txt']);
49 eventSender.mouseMoveTo(10, 10); 19 eventSender.mouseMoveTo(10, 10);
50 eventSender.mouseUp(); 20 eventSender.mouseUp();
51 } 21 }
52 22
53 if (window.eventSender) { 23 if (window.eventSender) {
54 testRunner.dumpAsText(); 24 testRunner.dumpAsText();
55 testRunner.waitUntilDone(); 25 testRunner.waitUntilDone();
56 window.onload = runTests; 26 window.onload = runTests;
57 } 27 }
58 </script> 28 </script>
59 </body> 29 </body>
60 </html> 30 </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