mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 01:35:43 +02:00
Introduces disableObjectCreateURL
This commit is contained in:
parent
95a7be0df4
commit
a8c11ad1e5
4 changed files with 23 additions and 7 deletions
|
@ -1179,18 +1179,17 @@ PDFJS.createBlob = function createBlob(data, contentType) {
|
|||
};
|
||||
|
||||
PDFJS.createObjectURL = (function createObjectURLClosure() {
|
||||
if (typeof URL !== 'undefined' && URL.createObjectURL) {
|
||||
return function createObjectURL(data, contentType) {
|
||||
var blob = PDFJS.createBlob(data, contentType);
|
||||
return URL.createObjectURL(blob);
|
||||
};
|
||||
}
|
||||
|
||||
// Blob/createObjectURL is not available, falling back to data schema.
|
||||
var digits =
|
||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
||||
|
||||
return function createObjectURL(data, contentType) {
|
||||
if (!PDFJS.disableCreateObjectURL &&
|
||||
typeof URL !== 'undefined' && URL.createObjectURL) {
|
||||
var blob = PDFJS.createBlob(data, contentType);
|
||||
return URL.createObjectURL(blob);
|
||||
}
|
||||
|
||||
var buffer = 'data:' + contentType + ';base64,';
|
||||
for (var i = 0, ii = data.length; i < ii; i += 3) {
|
||||
var b1 = data[i] & 0xFF;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue