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

Side by Side Diff: LayoutTests/http/tests/xmlhttprequest/ontimeout-event-override-after-preflight-failure.html

Issue 273993002: Allow XHR timeout attribute to be overridden after send(), per spec (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add CORS preflight-failure test case Created 6 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
OLDNEW
(Empty)
1 <html>
2 <body>
3 <pre id='console'></pre>
4 <script type="text/javascript">
5 function log(message)
6 {
7 document.getElementById('console').appendChild(document.createTextNode(messa ge + "\n"));
8 }
9
10 if (window.testRunner) {
11 testRunner.dumpAsText();
12 testRunner.waitUntilDone();
13 }
14
15 (function() {
16 var xhr = new XMLHttpRequest;
17 var error = false;
18 var errorCalled = false;
19
20 function testSuccess() {
21 if (!error)
22 log("PASS: Timeout not overridden after preflight failure");
23 }
24
25 function performAssertions() {
26 if (!errorCalled)
27 log("FAIL: preflight failure not reported");
28 else
29 testSuccess();
30 if (window.testRunner)
31 testRunner.notifyDone();
32 }
33
34 xhr.onerror = function() {
35 xhr.timeout = 1;
36 errorCalled = true;
37 };
38
39 xhr.ontimeout = function() {
40 error = true;
41 log("FAIL: Timeout overridden after error");
tyoshino (SeeGerritForStatus) 2014/07/08 11:36:00 what we want to check is setting timeout doesn't s
42 }
43
44 xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-contr ol-basic-denied.cgi");
45 xhr.timeout = 100;
46 // This is going to fail because the cgi script is not prepared for an OPTIO NS request.
47 xhr.send();
48
49 setTimeout(performAssertions, 200);
50 })();
51 </script>
52 </body>
53 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698