Stop exposing the URL polyfill in the global scope

This moves/exposes the `URL` polyfill similarily to the existing `ReadableStream` polyfill, rather than exposing it globally, to avoid interfering with any "outside" code.
Both the `URL` and `ReadableStream` polyfills are now exposed on the `pdfjsLib` object, such that they are accessible to the viewer components.
Furthermore, the `no-restricted-globals` ESLint rule is also enabled to prevent accidental usage of the native `URL`/`ReadableStream` implementations directly in the `src/` and `web/` folders; see also https://eslint.org/docs/rules/no-restricted-globals

Addresses the remaining TODO in https://github.com/mozilla/pdf.js/projects/6
This commit is contained in:
Jonas Jenwald 2018-07-03 18:32:39 +02:00
parent 42922c9ae5
commit a9ce4e8417
17 changed files with 736 additions and 671 deletions

View file

@ -15,6 +15,7 @@
import './compatibility';
import { ReadableStream } from './streams_polyfill';
import { URL } from './url_polyfill';
var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
@ -1075,6 +1076,7 @@ export {
readUint32,
removeNullCharacters,
ReadableStream,
URL,
setVerbosityLevel,
shadow,
string32,