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

Side by Side Diff: LayoutTests/http/tests/xmlhttprequest/upload-request-error-event-order.html

Issue 20560007: On request error, always fire events on the XMLHttpRequestUpload before the XMLHttpRequest (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <link rel="help" href="http://www.w3.org/TR/2012/WD-XMLHttpRequest-20121206/#req uest-error"/>
5 <script src="../resources/js-test-pre.js"></script>
6 </head>
7 <body>
8 <script>
9 description("Test to validate the order in which the events are fired in case of a request error.");
10 window.jsTestIsAsync = true;
11
12 expectedOrder = "rsdone,upload.onerror,upload.onloadend,onerror,onloadend,";
13 actualOrder = "";
14
15 var xhr = new XMLHttpRequest();
16 xhr.open("POST", "http://localhost:8000/xmlhttprequest/resources/cross-site-prog ress-events.cgi", true);
17 xhr.setRequestHeader("Content-Type", "text/plain");
18
19 xhr.onreadystatechange = function () {
20 if (xhr.readyState == XMLHttpRequest.DONE) {
21 actualOrder += "rsdone,";
22 }
23 };
24 xhr.upload.onerror = function (evt) {
25 actualOrder += "upload.onerror,";
26 };
27 xhr.upload.onloadend = function () {
28 actualOrder += "upload.onloadend,";
29 };
30 xhr.onerror = function (evt) {
31 actualOrder += "onerror,";
32 };
33 xhr.onloadend = function () {
34 actualOrder += "onloadend,";
35 shouldBeEqualToString('actualOrder', '' + expectedOrder);
36 finishJSTest();
37 };
38
39 xhr.send("test");
40
41 </script>
42 <script src="../resources/js-test-post.js"></script>
43 </body>
44 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698