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

Side by Side Diff: LayoutTests/http/tests/xmlhttprequest/workers/resources/xmlhttprequest-timeout-override-worker.js

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: Fixed accuracy issues with removed Timer methods Created 6 years, 7 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 importScripts("worker-pre.js");
2
3 function log(message) {
4 postMessage("log " + message);
5 }
6
7 function done() {
8 postMessage("DONE");
9 }
10
11 function eventHandler(e) {
12 log(e.type);
13 done();
14 }
15
16 function init() {
17 try {
18 var xhr = new XMLHttpRequest();
19 xhr.ontimeout = eventHandler;
20 xhr.onabort = eventHandler;
21 xhr.onerror = eventHandler;
22 xhr.onload = eventHandler;
23
24 xhr.timeout = 1000;
tyoshino (SeeGerritForStatus) 2014/05/12 09:21:17 ditto
25 xhr.open("GET", "../../../resources/load-and-stall.php?name=../resources /test.mp4&stallAt=0&stallFor=1000&mimeType=video/mp4", true);
26
27 // Defer overriding timeout
28 setTimeout(function() {
29 xhr.timeout = 400;
30 }, 200);
31
32 setTimeout(function() {
33 xhr.abort();
tyoshino (SeeGerritForStatus) 2014/05/12 09:21:17 4 space indentation
34 }, 1000);
35
36 xhr.send();
37
tyoshino (SeeGerritForStatus) 2014/05/12 09:21:17 remove this blank line
38 } catch (e) {
39 log(e);
40 done();
41 }
42 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698