diff --git a/src/shared/compatibility.js b/src/shared/compatibility.js index 10a2065c0..0af66a21e 100644 --- a/src/shared/compatibility.js +++ b/src/shared/compatibility.js @@ -21,9 +21,10 @@ if ((typeof PDFJSDev === 'undefined' || !PDFJSDev.test('FIREFOX || MOZCENTRAL || CHROME')) && (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked)) { -var globalScope = (typeof window !== 'undefined') ? window : - (typeof global !== 'undefined') ? global : - (typeof self !== 'undefined') ? self : this; +var globalScope = + (typeof window !== 'undefined' && window.Math === Math) ? window : + (typeof global !== 'undefined' && global.Math === Math) ? global : + (typeof self !== 'undefined' && self.Math === Math) ? self : this; var userAgent = (typeof navigator !== 'undefined' && navigator.userAgent) || ''; var isAndroid = /Android/.test(userAgent); diff --git a/src/shared/util.js b/src/shared/util.js index bde41df2f..e338adbe6 100644 --- a/src/shared/util.js +++ b/src/shared/util.js @@ -17,9 +17,10 @@ import './compatibility'; import { ReadableStream } from '../../external/streams/streams-lib'; -var globalScope = (typeof window !== 'undefined') ? window : - (typeof global !== 'undefined') ? global : - (typeof self !== 'undefined') ? self : this; +var globalScope = + (typeof window !== 'undefined' && window.Math === Math) ? window : + (typeof global !== 'undefined' && global.Math === Math) ? global : + (typeof self !== 'undefined' && self.Math === Math) ? self : this; var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];