OLD | NEW |
1 var global = this; | 1 var global = this; |
2 if (global.importScripts) { | 2 if (global.importScripts) { |
3 // Worker case | 3 // Worker case |
4 importScripts('/resources/testharness.js'); | 4 importScripts('/resources/testharness.js'); |
5 } | 5 } |
6 | 6 |
7 var testInLoadingState = async_test('Test aborting XMLHttpRequest with responseT
ype set to "stream" in LOADING state.'); | 7 var testInLoadingState = async_test('Test aborting XMLHttpRequest with responseT
ype set to "stream" in LOADING state.'); |
8 | 8 |
9 testInLoadingState.step(function() | 9 testInLoadingState.step(function() |
10 { | 10 { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 }); | 53 }); |
54 | 54 |
55 xhr.open('GET', '/resources/test.ogv', true); | 55 xhr.open('GET', '/resources/test.ogv', true); |
56 xhr.send(); | 56 xhr.send(); |
57 }); | 57 }); |
58 | 58 |
59 var testInDoneState = async_test('Test aborting XMLHttpRequest with responseType
set to "stream" in DONE state.'); | 59 var testInDoneState = async_test('Test aborting XMLHttpRequest with responseType
set to "stream" in DONE state.'); |
60 | 60 |
61 function readUntilDone(stream) { | 61 function readUntilDone(stream) { |
62 return stream.wait().then(function() { | 62 return stream.ready.then(function() { |
63 while (stream.state == 'readable') { | 63 while (stream.state == 'readable') { |
64 stream.read(); | 64 stream.read(); |
65 } | 65 } |
66 if (stream.state == 'closed' || stream.state == 'errored') { | 66 if (stream.state == 'closed' || stream.state == 'errored') { |
67 return stream.closed; | 67 return stream.closed; |
68 } else { | 68 } else { |
69 return readUntilDone(stream); | 69 return readUntilDone(stream); |
70 } | 70 } |
71 }); | 71 }); |
72 } | 72 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 }); | 124 }); |
125 | 125 |
126 xhr.open('GET', '/resources/test.ogv', true); | 126 xhr.open('GET', '/resources/test.ogv', true); |
127 xhr.send(); | 127 xhr.send(); |
128 }); | 128 }); |
129 | 129 |
130 if (global.importScripts) { | 130 if (global.importScripts) { |
131 // Worker case | 131 // Worker case |
132 done(); | 132 done(); |
133 } | 133 } |
OLD | NEW |