[api-minor] Move the ReadableStream polyfill to the global scope

Note that most (reasonably) modern browsers have supported this for a while now, see https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream#Browser_compatibility

By moving the polyfill into `src/shared/compatibility.js` we can thus get rid of the need to manually export/import `ReadableStream` and simply use it directly instead.

The only change here which *could* possibly lead to a difference in behavior is in the `isFetchSupported` function. Previously we attempted to check for the existence of a global `ReadableStream` implementation, which could now pass (assuming obviously that the preceding checks also succeeded).
However I'm not sure if that's a problem, since the previous check only confirmed the existence of a native `ReadableStream` implementation and not that it actually worked correctly. Finally it *could* just as well have been a globally registered polyfill from an application embedding the PDF.js library.
This commit is contained in:
Jonas Jenwald 2019-10-14 13:19:41 +02:00
parent af4ba75f68
commit e24050fa13
8 changed files with 32 additions and 68 deletions

View file

@ -15,7 +15,6 @@
/* eslint no-var: error */
import './compatibility';
import { ReadableStream } from './streams_polyfill';
const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
@ -930,7 +929,6 @@ export {
readUint16,
readUint32,
removeNullCharacters,
ReadableStream,
setVerbosityLevel,
shadow,
string32,