mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Move the disableCreateObjectURL
option from the global PDFJS
object and into getDocument
instead
This commit is contained in:
parent
05c05bdef5
commit
1d03ad0060
11 changed files with 54 additions and 36 deletions
|
@ -178,6 +178,9 @@ function setPDFNetworkStreamFactory(pdfNetworkStreamFactory) {
|
|||
* The default value is `false`.
|
||||
* NOTE: It is also necessary to disable streaming, see above,
|
||||
* in order for disabling of pre-fetching to work correctly.
|
||||
* @property {boolean} disableCreateObjectURL - (optional) Disable the use of
|
||||
* `URL.createObjectURL`, for compatibility with older browsers.
|
||||
* The default value is `false`.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -289,6 +292,10 @@ function getDocument(src) {
|
|||
if (typeof params.disableAutoFetch !== 'boolean') {
|
||||
params.disableAutoFetch = false;
|
||||
}
|
||||
if (typeof params.disableCreateObjectURL !== 'boolean') {
|
||||
params.disableCreateObjectURL =
|
||||
apiCompatibilityParams.disableCreateObjectURL || false;
|
||||
}
|
||||
|
||||
// Set the main-thread verbosity level.
|
||||
setVerbosityLevel(params.verbosity);
|
||||
|
@ -373,7 +380,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
|
|||
},
|
||||
maxImageSize: source.maxImageSize,
|
||||
disableFontFace: source.disableFontFace,
|
||||
disableCreateObjectURL: getDefaultSetting('disableCreateObjectURL'),
|
||||
disableCreateObjectURL: source.disableCreateObjectURL,
|
||||
postMessageTransfers: worker.postMessageTransfers,
|
||||
docBaseUrl: source.docBaseUrl,
|
||||
nativeImageDecoderSupport: source.nativeImageDecoderSupport,
|
||||
|
@ -2148,6 +2155,7 @@ var WorkerTransport = (function WorkerTransportClosure() {
|
|||
disableRange: params.disableRange,
|
||||
disableStream: params.disableStream,
|
||||
disableAutoFetch: params.disableAutoFetch,
|
||||
disableCreateObjectURL: params.disableCreateObjectURL,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -336,8 +336,6 @@ function getDefaultSetting(id) {
|
|||
switch (id) {
|
||||
case 'pdfBug':
|
||||
return globalSettings ? globalSettings.pdfBug : false;
|
||||
case 'disableCreateObjectURL':
|
||||
return globalSettings ? globalSettings.disableCreateObjectURL : false;
|
||||
default:
|
||||
throw new Error('Unknown default setting: ' + id);
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
*/
|
||||
|
||||
import {
|
||||
createBlob, createObjectURL, createPromiseCapability, InvalidPDFException,
|
||||
isLittleEndian, MissingPDFException, OPS, PageViewport, PasswordException,
|
||||
PasswordResponses, removeNullCharacters, shadow, UnexpectedResponseException,
|
||||
createBlob, createPromiseCapability, InvalidPDFException, isLittleEndian,
|
||||
MissingPDFException, OPS, PageViewport, PasswordException, PasswordResponses,
|
||||
removeNullCharacters, shadow, UnexpectedResponseException,
|
||||
UnknownErrorException, UNSUPPORTED_FEATURES, Util
|
||||
} from '../shared/util';
|
||||
import {
|
||||
|
@ -45,9 +45,6 @@ PDFJS.OPS = OPS;
|
|||
PDFJS.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
|
||||
PDFJS.shadow = shadow;
|
||||
PDFJS.createBlob = createBlob;
|
||||
PDFJS.createObjectURL = function PDFJS_createObjectURL(data, contentType) {
|
||||
return createObjectURL(data, contentType, PDFJS.disableCreateObjectURL);
|
||||
};
|
||||
Object.defineProperty(PDFJS, 'isLittleEndian', {
|
||||
configurable: true,
|
||||
get: function PDFJS_isLittleEndian() {
|
||||
|
@ -71,13 +68,6 @@ PDFJS.createPromiseCapability = createPromiseCapability;
|
|||
*/
|
||||
PDFJS.pdfBug = (PDFJS.pdfBug === undefined ? false : PDFJS.pdfBug);
|
||||
|
||||
/**
|
||||
* Disables URL.createObjectURL usage.
|
||||
* @var {boolean}
|
||||
*/
|
||||
PDFJS.disableCreateObjectURL = (PDFJS.disableCreateObjectURL === undefined ?
|
||||
false : PDFJS.disableCreateObjectURL);
|
||||
|
||||
PDFJS.getDocument = getDocument;
|
||||
PDFJS.LoopbackPort = LoopbackPort;
|
||||
PDFJS.PDFDataRangeTransport = PDFDataRangeTransport;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue