Skip to content

Commit

Permalink
Merge pull request #13217 from Snuffleupagus/generic-signature-warn
Browse files Browse the repository at this point in the history
[GENERIC viewer] Display a warning message, using the `errorWrapper`, for documents with signatures (PR 13214 follow-up, issue 13215)
  • Loading branch information
timvandermeij committed Apr 11, 2021
2 parents 646bb07 + 52494be commit a3669a4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
3 changes: 3 additions & 0 deletions l10n/en-US/viewer.properties
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,6 @@ password_cancel=Cancel
printing_not_supported=Warning: Printing is not fully supported by this browser.
printing_not_ready=Warning: The PDF is not fully loaded for printing.
web_fonts_disabled=Web fonts are disabled: unable to use embedded PDF fonts.
# LOCALIZATION NOTE (unsupported_feature_signatures): Should contain the same
# exact string as in the `chrome.properties` file.
unsupported_feature_signatures=This PDF document contains digital signatures. Validation of signatures is not supported.
18 changes: 15 additions & 3 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class DefaultExternalServices {
const PDFViewerApplication = {
initialBookmark: document.location.hash.substring(1),
_initializedCapability: createPromiseCapability(),
fellback: false,
_fellback: false,
appConfig: null,
pdfDocument: null,
pdfLoadingTask: null,
Expand Down Expand Up @@ -830,6 +830,7 @@ const PDFViewerApplication = {
this.pdfDocumentProperties.setDocument(null);
}
webViewerResetPermissions();
this._fellback = false;
this.store = null;
this.isInitialViewSet = false;
this.downloadComplete = false;
Expand Down Expand Up @@ -1056,10 +1057,21 @@ const PDFViewerApplication = {
}
// Only trigger the fallback once so we don't spam the user with messages
// for one PDF.
if (this.fellback) {
if (this._fellback) {
return;
}
this.fellback = true;
this._fellback = true;

// Ensure that, for signatures, a warning is shown in non-Firefox builds.
if (
(typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) &&
featureId === UNSUPPORTED_FEATURES.signatures
) {
this.l10n.get("unsupported_feature_signatures").then(msg => {
this._otherError(msg);
});
}

this.externalServices
.fallback({
featureId,
Expand Down
2 changes: 2 additions & 0 deletions web/l10n_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ const DEFAULT_L10N_STRINGS = {
printing_not_ready: "Warning: The PDF is not fully loaded for printing.",
web_fonts_disabled:
"Web fonts are disabled: unable to use embedded PDF fonts.",
unsupported_feature_signatures:
"This PDF document contains digital signatures. Validation of signatures is not supported.",
};

function getL10nFallback(key, args) {
Expand Down
4 changes: 2 additions & 2 deletions web/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

--main-color: rgba(12, 12, 13, 1);
--body-bg-color: rgba(237, 237, 240, 1);
--errorWrapper-bg-color: rgba(255, 74, 74, 1);
--errorWrapper-bg-color: rgba(255, 110, 110, 1);
--progressBar-color: rgba(10, 132, 255, 1);
--progressBar-indeterminate-bg-color: rgba(221, 221, 222, 1);
--progressBar-indeterminate-blend-color: rgba(116, 177, 239, 1);
Expand Down Expand Up @@ -101,7 +101,7 @@
:root {
--main-color: rgba(249, 249, 250, 1);
--body-bg-color: rgba(42, 42, 46, 1);
--errorWrapper-bg-color: rgba(199, 17, 17, 1);
--errorWrapper-bg-color: rgba(169, 14, 14, 1);
--progressBar-color: rgba(0, 96, 223, 1);
--progressBar-indeterminate-bg-color: rgba(40, 40, 43, 1);
--progressBar-indeterminate-blend-color: rgba(20, 68, 133, 1);
Expand Down

0 comments on commit a3669a4

Please sign in to comment.