mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Remove the PDFPageView.error
property, and simply include Errors in the "pagerendered" event instead
The way that rendering errors are handled in `PDFPageView` is *very* old, and predates e.g. the introduction of the `EventBus` by several years. Hence we should be able to simplify things a bit here, by including the Error (when it exists) in the "pagerendered" event and thus avoid having to reach into `PDFPageView` for it.
This commit is contained in:
parent
7b15094cdf
commit
9efc1784b2
3 changed files with 12 additions and 10 deletions
|
@ -2126,8 +2126,7 @@ function webViewerResetPermissions() {
|
|||
appConfig.viewerContainer.classList.remove(ENABLE_PERMISSIONS_CLASS);
|
||||
}
|
||||
|
||||
function webViewerPageRendered(evt) {
|
||||
const pageNumber = evt.pageNumber;
|
||||
function webViewerPageRendered({ pageNumber, timestamp, error }) {
|
||||
const pageIndex = pageNumber - 1;
|
||||
const pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex);
|
||||
|
||||
|
@ -2155,7 +2154,7 @@ function webViewerPageRendered(evt) {
|
|||
Stats.add(pageNumber, pageView.stats);
|
||||
}
|
||||
|
||||
if (pageView.error) {
|
||||
if (error) {
|
||||
PDFViewerApplication.l10n
|
||||
.get(
|
||||
"rendering_error",
|
||||
|
@ -2163,13 +2162,13 @@ function webViewerPageRendered(evt) {
|
|||
"An error occurred while rendering the page."
|
||||
)
|
||||
.then(msg => {
|
||||
PDFViewerApplication.error(msg, pageView.error);
|
||||
PDFViewerApplication.error(msg, error);
|
||||
});
|
||||
}
|
||||
|
||||
PDFViewerApplication.externalServices.reportTelemetry({
|
||||
type: "pageInfo",
|
||||
timestamp: evt.timestamp,
|
||||
timestamp,
|
||||
});
|
||||
// It is a good time to report stream and font types.
|
||||
PDFViewerApplication.pdfDocument.getStats().then(function (stats) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue