From db7a7705427f52597cf494c66c241aa85ec6e21b Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Mon, 12 Jun 2017 10:14:46 -0500 Subject: [PATCH] Additional check in globalScope detections --- src/shared/compatibility.js | 7 ++++--- src/shared/util.js | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) 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];