From 6beb925f0baabc5abba0397d372932055b8fb459 Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Thu, 3 Aug 2017 08:48:51 -0500 Subject: [PATCH] Checks Edge support for streams. --- src/shared/streams_polyfill.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/shared/streams_polyfill.js b/src/shared/streams_polyfill.js index 5e3ce9050..e35da6cd9 100644 --- a/src/shared/streams_polyfill.js +++ b/src/shared/streams_polyfill.js @@ -13,7 +13,22 @@ * limitations under the License. */ +let isReadableStreamSupported = false; if (typeof ReadableStream !== 'undefined') { + // MS Edge may say it has ReadableStream but they are not up to spec yet. + try { + // eslint-disable-next-line no-new + new ReadableStream({ + start(controller) { + controller.close(); + }, + }); + isReadableStreamSupported = true; + } catch (e) { + // The ReadableStream constructor cannot be used. + } +} +if (isReadableStreamSupported) { exports.ReadableStream = ReadableStream; } else { if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME')) {