Ensure that automatic printing still works when the viewer and/or its pages are hidden (bug 1618621, bug 1618955)

Please note that this patch, on its own, won't magically fix all of these printing bugs without [bug 1618553](https://bugzilla.mozilla.org/show_bug.cgi?id=1618553) also being fixed.
(However I don't foresee that being too difficult, famous last words :-), but it will as suggested require a platform API that we can notify when the viewer is ready.)

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1618621
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1618955
Fixes 8208
This commit is contained in:
Jonas Jenwald 2020-03-24 12:58:34 +01:00
parent 85838fc505
commit c5b0b5c754
2 changed files with 23 additions and 2 deletions

View file

@ -229,7 +229,7 @@ function binarySearchFirstItem(items, condition) {
let minIndex = 0;
let maxIndex = items.length - 1;
if (items.length === 0 || !condition(items[maxIndex])) {
if (maxIndex < 0 || !condition(items[maxIndex])) {
return items.length;
}
if (condition(items[minIndex])) {