From 3888a993b125e22fdfffd36bf603baf830e6fbe2 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 15 Apr 2017 18:25:10 +0200 Subject: [PATCH] Remove the `URL` checks in the `createObjectURL` utility function, since the `URL` polyfill have made them redundant Also, this changes `createBlob` to throw when `Blob` isn't supported. --- src/shared/util.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/shared/util.js b/src/shared/util.js index dc8857472..f6f7f3974 100644 --- a/src/shared/util.js +++ b/src/shared/util.js @@ -1190,7 +1190,7 @@ var createBlob = function createBlob(data, contentType) { if (typeof Blob !== 'undefined') { return new Blob([data], { type: contentType }); } - warn('The "Blob" constructor is not supported.'); + throw new Error('The "Blob" constructor is not supported.'); }; var createObjectURL = (function createObjectURLClosure() { @@ -1198,9 +1198,8 @@ var createObjectURL = (function createObjectURLClosure() { var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; - return function createObjectURL(data, contentType, forceDataSchema) { - if (!forceDataSchema && - typeof URL !== 'undefined' && URL.createObjectURL) { + return function createObjectURL(data, contentType, forceDataSchema = false) { + if (!forceDataSchema) { var blob = createBlob(data, contentType); return URL.createObjectURL(blob); }