From ee09336f32356470cbaa1ad439c7ba701713184f Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 27 Apr 2017 20:49:48 +0200 Subject: [PATCH] Restore the `URL.createObjectURL` check to the `createObjectURL` utility function (issue 8344) This is a regression from commit https://github.com/mozilla/pdf.js/commit/3888a993b125e22fdfffd36bf603baf830e6fbe2. It turns out the even though we have a `URL` polyfill, it's still dependent on the existence of native `URL.{createObjectURL, revokeObjectURL}` functions. Since no such thing exists in Node.js, our `createObjectURL` utility function breaks there. --- src/shared/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/util.js b/src/shared/util.js index f17cc92cb..8abaaf919 100644 --- a/src/shared/util.js +++ b/src/shared/util.js @@ -1199,7 +1199,7 @@ var createObjectURL = (function createObjectURLClosure() { 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; return function createObjectURL(data, contentType, forceDataSchema = false) { - if (!forceDataSchema) { + if (!forceDataSchema && URL.createObjectURL) { var blob = createBlob(data, contentType); return URL.createObjectURL(blob); }