Compare commits

...

10 Commits

Author SHA1 Message Date
calixteman
8791b24742
Merge pull request #19652 from calixteman/rm_useless_css_var
[Editor] Remove useless css variable
2025-03-13 16:48:50 +01:00
Calixte Denizet
7c706b6525 [Editor] Remove useless css variable 2025-03-13 16:40:30 +01:00
calixteman
dc61e36bf4
Merge pull request #19651 from calixteman/fix_ftl
[Editor] Fix variable name in the ftl file
2025-03-13 16:36:38 +01:00
Calixte Denizet
56f58bde9a [Editor] Fix variable name in the ftl file
and add a linting rule to avoid such an error in the future.
2025-03-13 16:26:16 +01:00
calixteman
d5c185b90a
Merge pull request #19649 from calixteman/bug1953298
[Editor] Fix the title of saved signature button (bug 1953298)
2025-03-13 13:50:43 +01:00
Calixte Denizet
da105f71f6 [Editor] Fix the title of saved signature button (bug 1953298) 2025-03-13 13:07:45 +01:00
Jonas Jenwald
78b310afb1
Merge pull request #19650 from Snuffleupagus/shorten-crypto
Shorten the `src/core/crypto.js` file a little bit
2025-03-13 12:46:53 +01:00
Jonas Jenwald
ef01ceda1b Change a couple of "password" ref-tests to "eq" tests
Currrently these are just "load" tests, and by also testing rendering we get slightly better test-coverage for the `src/core/crypto.js` file.
2025-03-13 11:58:13 +01:00
Jonas Jenwald
0e15f709c4 Remove unnecessary else if when checking the encryptionKey in the CipherTransformFactory constructor
This can be simplified a tiny bit since we already throw `PasswordException` when no password is provided.
2025-03-13 11:58:13 +01:00
Jonas Jenwald
cc63ffa6bb Reduce duplication when checking the userPassword, in CipherTransformFactory.prototype.#prepareKeyData
Currently we duplicate the exact same code in both the `if`- and `else`-branches, which seems unnecessary, and we can also replace the manual loop.
2025-03-13 11:58:02 +01:00
7 changed files with 36 additions and 28 deletions

View File

@ -25,3 +25,5 @@ CO01:
exclusions:
files: []
messages: []
VC:
disabled: false

View File

@ -365,10 +365,18 @@ pdfjs-editor-stamp-add-image-button-label = Add image
pdfjs-editor-free-highlight-thickness-input = Thickness
pdfjs-editor-free-highlight-thickness-title =
.title = Change thickness when highlighting items other than text
pdfjs-editor-add-signature-container =
.aria-label = Signature controls and saved signatures
pdfjs-editor-signature-add-signature-button =
.title = Add new signature
pdfjs-editor-signature-add-signature-button-label = Add new signature
# Used on the button to use an already saved signature.
# Variables:
# $description (String) - a string describing/labeling the signature.
pdfjs-editor-add-saved-signature-button =
.title = Saved signature: { $description }
# .default-content is used as a placeholder in an empty text editor.
pdfjs-free-text2 =
.aria-label = Text Editor
@ -603,9 +611,9 @@ pdfjs-editor-add-signature-add-button = Add
## Main menu for adding/removing signatures
pdfjs-editor-delete-signature-button =
.title = Remove signature
pdfjs-editor-delete-signature-button-label = Remove signature
pdfjs-editor-delete-signature-button1 =
.title = Remove saved signature
pdfjs-editor-delete-signature-button-label1 = Remove saved signature
## Editor toolbar

View File

@ -916,23 +916,15 @@ class CipherTransformFactory {
cipher = new ARCFourCipher(derivedKey);
checkData = cipher.encryptBlock(checkData);
}
for (j = 0, n = checkData.length; j < n; ++j) {
if (userPassword[j] !== checkData[j]) {
return null;
}
}
} else {
cipher = new ARCFourCipher(encryptionKey);
checkData = cipher.encryptBlock(
CipherTransformFactory._defaultPasswordBytes
);
for (j = 0, n = checkData.length; j < n; ++j) {
if (userPassword[j] !== checkData[j]) {
return null;
}
}
}
return encryptionKey;
return checkData.every((data, k) => userPassword[k] === data)
? encryptionKey
: null;
}
#decodeUserPassword(password, ownerPassword, revision, keyLength) {
@ -1133,12 +1125,13 @@ class CipherTransformFactory {
perms
);
}
if (!encryptionKey && !password) {
throw new PasswordException(
"No password given",
PasswordResponses.NEED_PASSWORD
);
} else if (!encryptionKey && password) {
if (!encryptionKey) {
if (!password) {
throw new PasswordException(
"No password given",
PasswordResponses.NEED_PASSWORD
);
}
// Attempting use the password as an owner password
const decodedPassword = this.#decodeUserPassword(
passwordBytes,

View File

@ -992,7 +992,7 @@
"password": "ELXRTQWS",
"md5": "db2fedbd36d6fa27d4e52f9bd2d96b8c",
"rounds": 1,
"type": "load"
"type": "eq"
},
{
"id": "issue5334",
@ -5961,7 +5961,7 @@
"md5": "b58adce5dbb08936ddb0d904f0da8716",
"rounds": 1,
"link": false,
"type": "load",
"type": "eq",
"password": "abc"
},
{
@ -5970,7 +5970,7 @@
"md5": "73a8091d0ab2a47af5ca45047f04da99",
"rounds": 1,
"link": false,
"type": "load",
"type": "eq",
"password": "\u00E6\u00F8\u00E5",
"about": "The password (æøå) is UTF8 encoded."
},

View File

@ -48,7 +48,6 @@
.signatureDialog {
--primary-color: var(--text-primary-color);
--description-input-color: var(--primary-color);
--border-color: #8f8f9d;
--open-link-fg: var(--link-fg-color);
--open-link-hover-fg: var(--link-hover-fg-color);

View File

@ -708,11 +708,17 @@ class SignatureManager {
button.append(svg);
const span = document.createElement("span");
span.ariaHidden = true;
button.append(span);
button.classList.add("toolbarAddSignatureButton");
button.type = "button";
button.title = span.textContent = description;
span.textContent = description;
button.setAttribute(
"data-l10n-id",
"pdfjs-editor-add-saved-signature-button"
);
button.setAttribute("data-l10n-args", JSON.stringify({ description }));
button.tabIndex = 0;
const path = svgFactory.createElement("path");
@ -729,7 +735,7 @@ class SignatureManager {
deleteButton.classList.add("toolbarButton", "deleteButton");
deleteButton.setAttribute(
"data-l10n-id",
"pdfjs-editor-delete-signature-button"
"pdfjs-editor-delete-signature-button1"
);
deleteButton.type = "button";
deleteButton.tabIndex = 0;
@ -749,7 +755,7 @@ class SignatureManager {
deleteButton.append(deleteSpan);
deleteSpan.setAttribute(
"data-l10n-id",
"pdfjs-editor-delete-signature-button-label"
"pdfjs-editor-delete-signature-button-label1"
);
this.#addSignatureToolbarButton.before(div);

View File

@ -249,7 +249,7 @@ See https://github.com/adobe-type-tools/cmap-resources
<span data-l10n-id="pdfjs-editor-signature-button-label">Add signature</span>
</button>
<div class="editorParamsToolbar hidden doorHangerRight menu" id="editorSignatureParamsToolbar">
<div id="addSignatureDoorHanger" class="menuContainer">
<div id="addSignatureDoorHanger" class="menuContainer" role="region" data-l10n-id="pdfjs-editor-add-signature-container">
<button id="editorSignatureAddSignature" class="toolbarButton labeled" type="button" title="Add new signature" tabindex="0" data-l10n-id="pdfjs-editor-signature-add-signature-button">
<span data-l10n-id="pdfjs-editor-signature-add-signature-button-label" class="editorParamsLabel">Add new signature</span>
</button>