| 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 promise_test(function(t) { | 339 promise_test(function(t) { |
| 340 var res = new Response(new Blob([''])); | 340 var res = new Response(new Blob([''])); |
| 341 return res.blob() | 341 return res.blob() |
| 342 .then(function(blob) { | 342 .then(function(blob) { |
| 343 assert_equals(blob.type, ''); | 343 assert_equals(blob.type, ''); |
| 344 assert_equals(res.headers.get('Content-Type'), null); | 344 assert_equals(res.headers.get('Content-Type'), null); |
| 345 }); | 345 }); |
| 346 }, 'MIME type for Blob'); | 346 }, 'MIME type for Blob'); |
| 347 | 347 |
| 348 promise_test(function(t) { | 348 promise_test(function(t) { |
| 349 var res = new Response(new Blob([''], {type: 'Text/Plain'})); | 349 var res = new Response(new Blob(['hello'], {type: 'Text/Plain'})); |
| 350 return res.blob() | 350 return res.blob() |
| 351 .then(function(blob) { | 351 .then(function(blob) { |
| 352 assert_equals(blob.type, 'text/plain'); | 352 assert_equals(blob.type, 'text/plain'); |
| 353 assert_equals(blob.size, 5); |
| 354 assert_equals(res.headers.get('Content-Type'), 'text/plain'); |
| 355 return res.blob(); |
| 356 }).then(function(blob) { |
| 357 // When we read from a response twice, it returns an empty contents. |
| 358 // But the type should remain. |
| 359 assert_equals(blob.type, 'text/plain'); |
| 360 assert_equals(blob.size, 0); |
| 353 assert_equals(res.headers.get('Content-Type'), 'text/plain'); | 361 assert_equals(res.headers.get('Content-Type'), 'text/plain'); |
| 354 }); | 362 }); |
| 355 }, 'MIME type for Blob with non-empty type'); | 363 }, 'MIME type for Blob with non-empty type'); |
| 356 | 364 |
| 357 promise_test(function(t) { | 365 promise_test(function(t) { |
| 358 var res = new Response(new FormData()); | 366 var res = new Response(new FormData()); |
| 359 return res.blob() | 367 return res.blob() |
| 360 .then(function(blob) { | 368 .then(function(blob) { |
| 361 assert_equals(blob.type.indexOf('multipart/form-data; boundary='), | 369 assert_equals(blob.type.indexOf('multipart/form-data; boundary='), |
| 362 0); | 370 0); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 test(function() { | 505 test(function() { |
| 498 ['http://ex\x0aample.com', | 506 ['http://ex\x0aample.com', |
| 499 'http://ex\x0dample.com'].forEach(function(url) { | 507 'http://ex\x0dample.com'].forEach(function(url) { |
| 500 assert_equals(Response.redirect(url).headers.get('Location'), | 508 assert_equals(Response.redirect(url).headers.get('Location'), |
| 501 'http://example.com/', | 509 'http://example.com/', |
| 502 'Location header value must not contain CR or LF'); | 510 'Location header value must not contain CR or LF'); |
| 503 }); | 511 }); |
| 504 }, 'Response.redirect() with URLs with CR or LF'); | 512 }, 'Response.redirect() with URLs with CR or LF'); |
| 505 | 513 |
| 506 done(); | 514 done(); |
| OLD | NEW |