| OLD | NEW |
| 1 'use strict'; | 1 'use strict'; |
| 2 | 2 |
| 3 if (self.importScripts) { | 3 if (self.importScripts) { |
| 4 self.importScripts('/resources/testharness.js'); | 4 self.importScripts('/resources/testharness.js'); |
| 5 } | 5 } |
| 6 | 6 |
| 7 | 7 |
| 8 test(() => { | 8 test(() => { |
| 9 | 9 |
| 10 const theError = new Error('a unique string'); | 10 const theError = new Error('a unique string'); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 }).getReader().closed; | 373 }).getReader().closed; |
| 374 | 374 |
| 375 return closed.catch(e => { | 375 return closed.catch(e => { |
| 376 assert_true(startCalled); | 376 assert_true(startCalled); |
| 377 assert_equals(e, firstError, 'closed should reject with the first error'); | 377 assert_equals(e, firstError, 'closed should reject with the first error'); |
| 378 }); | 378 }); |
| 379 | 379 |
| 380 }, 'Underlying source: calling error and returning a rejected promise from pull
should cause the stream to error ' + | 380 }, 'Underlying source: calling error and returning a rejected promise from pull
should cause the stream to error ' + |
| 381 'with the first error'); | 381 'with the first error'); |
| 382 | 382 |
| 383 const error1 = { name: 'error1' }; |
| 384 |
| 385 promise_test(t => { |
| 386 |
| 387 let pullShouldThrow = false; |
| 388 const rs = new ReadableStream({ |
| 389 pull(controller) { |
| 390 if (pullShouldThrow) { |
| 391 throw error1; |
| 392 } |
| 393 controller.enqueue(0); |
| 394 } |
| 395 }, new CountQueuingStrategy({highWaterMark: 1})); |
| 396 const reader = rs.getReader(); |
| 397 return Promise.resolve().then(() => { |
| 398 pullShouldThrow = true; |
| 399 return Promise.all([ |
| 400 reader.read(), |
| 401 promise_rejects(t, error1, reader.closed, '.closed promise should reject') |
| 402 ]); |
| 403 }); |
| 404 |
| 405 }, 'read should not error if it dequeues and pull() throws'); |
| 406 |
| 383 done(); | 407 done(); |
| OLD | NEW |