OLD | NEW |
1 if (self.importScripts) { | 1 if (self.importScripts) { |
2 importScripts('../resources/fetch-test-helpers.js'); | 2 importScripts('../resources/fetch-test-helpers.js'); |
3 } | 3 } |
4 | 4 |
5 function consume(reader) { | 5 function consume(reader) { |
6 var chunks = []; | 6 var chunks = []; |
7 function rec(reader) { | 7 function rec(reader) { |
8 return reader.read().then(function(r) { | 8 return reader.read().then(function(r) { |
9 if (r.done) { | 9 if (r.done) { |
10 return chunks; | 10 return chunks; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 'Response.headers must not have Content-Type ' + | 105 'Response.headers must not have Content-Type ' + |
106 'for Blob with type = empty string (1)'); | 106 'for Blob with type = empty string (1)'); |
107 | 107 |
108 response = new Response(new Blob(['dummy'], {type: ''})); | 108 response = new Response(new Blob(['dummy'], {type: ''})); |
109 assert_equals(size(response.headers), 0, | 109 assert_equals(size(response.headers), 0, |
110 'Response.headers must not have Content-Type ' + | 110 'Response.headers must not have Content-Type ' + |
111 'for Blob with type = empty string (2)'); | 111 'for Blob with type = empty string (2)'); |
112 }, 'Response content type test'); | 112 }, 'Response content type test'); |
113 | 113 |
114 test(function() { | 114 test(function() { |
115 [0, 1, 100, 199, 600, 700].forEach(function(status) { | 115 [0, 1, 100, 101, 204, 205, 304, 199, 600, 700].forEach(function(status) { |
116 assert_throws({name: 'RangeError'}, | 116 assert_throws({name: 'RangeError'}, |
117 function() { | 117 function() { |
118 new Response(new Blob(), {status: status}); | 118 new Response(new Blob(), {status: status}); |
119 }, | 119 }, |
120 'new Response with status = ' + status + | 120 'new Response with status = ' + status + |
121 ' should throw'); | 121 ' should throw'); |
122 }); | 122 }); |
123 | 123 |
124 [300, 0, 304, 305, 306, 309, 500].forEach(function(status) { | 124 [300, 0, 304, 305, 306, 309, 500].forEach(function(status) { |
125 assert_throws({name: 'RangeError'}, | 125 assert_throws({name: 'RangeError'}, |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 test(function() { | 514 test(function() { |
515 ['http://ex\x0aample.com', | 515 ['http://ex\x0aample.com', |
516 'http://ex\x0dample.com'].forEach(function(url) { | 516 'http://ex\x0dample.com'].forEach(function(url) { |
517 assert_equals(Response.redirect(url).headers.get('Location'), | 517 assert_equals(Response.redirect(url).headers.get('Location'), |
518 'http://example.com/', | 518 'http://example.com/', |
519 'Location header value must not contain CR or LF'); | 519 'Location header value must not contain CR or LF'); |
520 }); | 520 }); |
521 }, 'Response.redirect() with URLs with CR or LF'); | 521 }, 'Response.redirect() with URLs with CR or LF'); |
522 | 522 |
523 done(); | 523 done(); |
OLD | NEW |