Estimate progress when Content-Length header is missing

This commit is contained in:
tobspr 2022-06-18 16:47:35 +02:00
parent c74e4b9819
commit e870317a4f
2 changed files with 3 additions and 6 deletions

View File

@ -81,13 +81,10 @@
xhr.responseType = "arraybuffer";
xhr.onprogress = function (ev) {
if (ev.lengthComputable) {
console.log(ev.total);
progressHandler(ev.loaded / ev.total);
} else {
if (!notifiedNotComputable) {
notifiedNotComputable = true;
console.warn("Progress not computable:", ev);
progressHandler(0);
}
progressHandler(Math.min(1, ev.loaded / 1250000));
}
};

View File

@ -197,7 +197,7 @@ export class BackgroundResourcesLoader {
} else {
if (!notifiedNotComputable) {
notifiedNotComputable = true;
console.warn("Progress not computable:", ev);
console.warn("Progress not computable:", src, ev);
progressHandler(0);
}
}