mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Merge pull request #13105 from Snuffleupagus/BasePdfManager-parseDocBaseUrl
Improve memory usage around the `BasePdfManager.docBaseUrl` parameter (PR 7689 follow-up)
This commit is contained in:
commit
8269ddbd16
10 changed files with 251 additions and 244 deletions
|
@ -40,6 +40,7 @@ import {
|
|||
deprecated,
|
||||
DOMCanvasFactory,
|
||||
DOMCMapReaderFactory,
|
||||
isDataScheme,
|
||||
loadScript,
|
||||
PageViewport,
|
||||
RenderingCancelledException,
|
||||
|
@ -288,6 +289,15 @@ function getDocument(src) {
|
|||
params.pdfBug = params.pdfBug === true;
|
||||
params.enableXfa = params.enableXfa === true;
|
||||
|
||||
if (
|
||||
typeof params.docBaseUrl !== "string" ||
|
||||
isDataScheme(params.docBaseUrl)
|
||||
) {
|
||||
// Ignore "data:"-URLs, since they can't be used to recover valid absolute
|
||||
// URLs anyway. We want to avoid sending them to the worker-thread, since
|
||||
// they contain the *entire* PDF document and can thus be arbitrarily long.
|
||||
params.docBaseUrl = null;
|
||||
}
|
||||
if (!Number.isInteger(params.maxImageSize)) {
|
||||
params.maxImageSize = -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue