Since #12241 we have notifications for this when the user navigates away from the viewer, but we do not yet warn when switching documents, which means that if you call e.g. `PDFViewerApplication.open` with a new document (or directly call `BaseViewer.setDocument` when using the viewer components standalone) there won't be any warning about losing form data. This should be addressed.
};
    loadingTask.onProgress = ({ loaded, total }) => {
      this.progress(loaded / total);
    };
    
    loadingTask.onUnsupportedFeature = this.fallback.bind(this);
    return loadingTask.promise.then(
      pdfDocument => {
        this.load(pdfDocument);
      },
      exception => {
        if (loadingTask !== this.pdfLoadingTask) {
          return undefined; 
        }
        let key = "loading_error";
        if (exception instanceof InvalidPDFException) {
          key = "invalid_file_error";
        } else if (exception instanceof MissingPDFException) {
          key = "missing_file_error";
        } else if (exception instanceof UnexpectedResponseException) {
          key = "unexpected_response_error";
        }
        return this.l10n.get(key).then(msg => {
          this._documentError(msg, { message: exception?.message });
          throw exception;
        });
      }
    );
  },
  download({ sourceEventType = "download" } = {}) {