Update {PDFLinkService, PDFDocumentProperties}.setDocument to make the "url" parameter optional

This way the resetting of `PDFLinkService`/`PDFDocumentProperties` instances, as is done in `PDFViewerApplication.close`, only requires passing in *one* `null` argument instead of two.
This commit is contained in:
Jonas Jenwald 2018-09-30 12:11:27 +02:00
parent b40fb3814a
commit 6da78bcc3f
3 changed files with 5 additions and 5 deletions

View File

@ -595,8 +595,8 @@ let PDFViewerApplication = {
this.pdfThumbnailViewer.setDocument(null);
this.pdfViewer.setDocument(null);
this.pdfLinkService.setDocument(null, null);
this.pdfDocumentProperties.setDocument(null, null);
this.pdfLinkService.setDocument(null);
this.pdfDocumentProperties.setDocument(null);
}
this.store = null;
this.isInitialViewSet = false;

View File

@ -120,7 +120,7 @@ class PDFDocumentProperties {
return Promise.all([
info,
metadata,
contentDispositionFilename || getPDFFileNameFromURL(this.url),
contentDispositionFilename || getPDFFileNameFromURL(this.url || ''),
this._parseFileSize(this.maybeFileSize),
this._parseDate(info.CreationDate),
this._parseDate(info.ModDate),
@ -187,7 +187,7 @@ class PDFDocumentProperties {
* @param {Object} pdfDocument - A reference to the PDF document.
* @param {string} url - The URL of the document.
*/
setDocument(pdfDocument, url) {
setDocument(pdfDocument, url = null) {
if (this.pdfDocument) {
this._reset();
this._updateUI(true);

View File

@ -49,7 +49,7 @@ class PDFLinkService {
this._pagesRefCache = null;
}
setDocument(pdfDocument, baseUrl) {
setDocument(pdfDocument, baseUrl = null) {
this.baseUrl = baseUrl;
this.pdfDocument = pdfDocument;
this._pagesRefCache = Object.create(null);