Bug 1811332 - Make sure `this.indicator` is truthy before using it. r=Gijs

The `indicator` getter may return `null` so we cannot just call methods on it.

Differential Revision: https://phabricator.services.mozilla.com/D169717
This commit is contained in:
William Durand 2023-02-14 12:03:02 +00:00
Родитель bb324f0e83
Коммит c4ea893f2d
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -471,7 +471,11 @@ const DownloadsIndicatorView = {
},
_maybeScheduleProgressUpdate() {
if (!this._progressRaf && document.visibilityState == "visible") {
if (
this.indicator &&
!this._progressRaf &&
document.visibilityState == "visible"
) {
this._progressRaf = requestAnimationFrame(() => {
// indeterminate downloads (unknown content-length) will show up as aValue = 0
if (this._percentComplete >= 0) {