Work around timing difference between Chrome and polyfill
When piping a stream to a writable stream and erroring that, the input (readable) stream only gets cancelled after pipeTo() returns in Chrome.
This commit is contained in:
parent
55fd292fba
commit
411b626149
|
@ -1,8 +1,8 @@
|
|||
import util from './util';
|
||||
|
||||
// if (typeof TransformStream === 'undefined') {
|
||||
Object.assign(typeof window !== 'undefined' ? window : global, require('@mattiasbuelens/web-streams-polyfill'));
|
||||
// }
|
||||
if (typeof TransformStream === 'undefined') {
|
||||
require('@mattiasbuelens/web-streams-polyfill');
|
||||
}
|
||||
|
||||
const nodeStream = util.getNodeStream();
|
||||
|
||||
|
@ -130,6 +130,7 @@ function transformPair(input, fn) {
|
|||
const outgoing = transformWithCancel(async function() {
|
||||
incomingTransformController.error(new Error('Readable side was canceled.'));
|
||||
await pipeDonePromise;
|
||||
await new Promise(setTimeout);
|
||||
});
|
||||
fn(incoming.readable, outgoing.writable);
|
||||
return outgoing.readable;
|
||||
|
|
|
@ -5,9 +5,9 @@ if (typeof Symbol === 'undefined') {
|
|||
if (typeof Promise === 'undefined') {
|
||||
require('core-js/fn/promise');
|
||||
}
|
||||
// if (typeof TransformStream === 'undefined') {
|
||||
Object.assign(typeof window !== 'undefined' ? window : global, require('@mattiasbuelens/web-streams-polyfill'));
|
||||
// }
|
||||
if (typeof TransformStream === 'undefined') {
|
||||
require('@mattiasbuelens/web-streams-polyfill');
|
||||
}
|
||||
|
||||
(typeof window !== 'undefined' ? window : global).resolves = function(val) {
|
||||
return new Promise(function(res) { res(val); });
|
||||
|
|
Loading…
Reference in New Issue
Block a user