Attempt to display the File size quicker in the Document Properties dialog

Currently the File size field in the Document Properties dialog isn't set until `PDFView.pdfDocument.getDownloadInfo()` is resolved. If the Document Properties dialog is opened while a PDF file is loading with range requests, this leads to the less desirable situation where all fields *except* File size are available.

In cases where `PDFView.open()` is called with the `args` parameter defined, and `args` contains the property `length`, we actually know the File size when the PDF file begins to load. (This is usually the case when ranged loading is used in the Firefox addon/built-in version.)
Hence we can use `args.length` to set the File size immediately when `PDFView.open()` is called, resulting in a better user experience.
This commit is contained in:
Jonas Jenwald 2014-08-11 15:25:37 +02:00
parent 0e4d9061b2
commit 3fd6c468b7
2 changed files with 10 additions and 2 deletions

View file

@ -696,6 +696,10 @@ var PDFView = {
self.loading = false;
}
);
if (args && args.length) {
DocumentProperties.setFileSize(args.length);
}
},
download: function pdfViewDownload() {