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.
This commit is contained in:
parent
2928578164
commit
3888a993b1
@ -1190,7 +1190,7 @@ var createBlob = function createBlob(data, contentType) {
|
|||||||
if (typeof Blob !== 'undefined') {
|
if (typeof Blob !== 'undefined') {
|
||||||
return new Blob([data], { type: contentType });
|
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() {
|
var createObjectURL = (function createObjectURLClosure() {
|
||||||
@ -1198,9 +1198,8 @@ var createObjectURL = (function createObjectURLClosure() {
|
|||||||
var digits =
|
var digits =
|
||||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
||||||
|
|
||||||
return function createObjectURL(data, contentType, forceDataSchema) {
|
return function createObjectURL(data, contentType, forceDataSchema = false) {
|
||||||
if (!forceDataSchema &&
|
if (!forceDataSchema) {
|
||||||
typeof URL !== 'undefined' && URL.createObjectURL) {
|
|
||||||
var blob = createBlob(data, contentType);
|
var blob = createBlob(data, contentType);
|
||||||
return URL.createObjectURL(blob);
|
return URL.createObjectURL(blob);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user