Remove the findResultsCount-check from PDFFindBar.updateResultsCount, and unnecessary defaults from the constructor

Given that `PDFFindBar` is written *specifically* for the default viewer, rather than general usage (as opposed to the `PDFFindController`), we should be able to simply assume that the `findResultsCount` DOM-element is always present. Even more so, when we're purposely not doing any similar checks for other DOM-elements in this code.

Also, remove unnecessary `null` defaults for the various DOM-element options in the constructor, since the code simply assumes that all of the relevant DOM-elements are in fact available.
This commit is contained in:
Jonas Jenwald 2021-02-22 12:42:59 +01:00
parent 8b7dee0aae
commit c277e39b0b

View File

@ -28,16 +28,16 @@ class PDFFindBar {
constructor(options, eventBus, l10n = NullL10n) {
this.opened = false;
this.bar = options.bar || null;
this.toggleButton = options.toggleButton || null;
this.findField = options.findField || null;
this.highlightAll = options.highlightAllCheckbox || null;
this.caseSensitive = options.caseSensitiveCheckbox || null;
this.entireWord = options.entireWordCheckbox || null;
this.findMsg = options.findMsg || null;
this.findResultsCount = options.findResultsCount || null;
this.findPreviousButton = options.findPreviousButton || null;
this.findNextButton = options.findNextButton || null;
this.bar = options.bar;
this.toggleButton = options.toggleButton;
this.findField = options.findField;
this.highlightAll = options.highlightAllCheckbox;
this.caseSensitive = options.caseSensitiveCheckbox;
this.entireWord = options.entireWordCheckbox;
this.findMsg = options.findMsg;
this.findResultsCount = options.findResultsCount;
this.findPreviousButton = options.findPreviousButton;
this.findNextButton = options.findNextButton;
this.eventBus = eventBus;
this.l10n = l10n;
@ -147,9 +147,6 @@ class PDFFindBar {
}
updateResultsCount({ current = 0, total = 0 } = {}) {
if (!this.findResultsCount) {
return; // No UI control is provided.
}
const limit = MATCHES_COUNT_LIMIT;
let matchesCountMsg = "";