web: Don't auto-panic on browsers without ReadableStream (#11699)

* web: Don't auto-panic on browsers without ReadableStream

* web: Add comment explaining Pale Moon issue

* web: Simplify ReadableStream check
This commit is contained in:
Daniel Jacobs 2023-06-24 11:10:19 -04:00 committed by GitHub
parent 494902cf39
commit 9a093d20be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -68,7 +68,11 @@ async function fetchRuffle(
? new URL("../dist/ruffle_web-wasm_extensions_bg.wasm", import.meta.url)
: new URL("../dist/ruffle_web_bg.wasm", import.meta.url);
const wasmResponse = await fetch(wasmUrl);
if (progressCallback) {
// The Pale Moon browser currently lacks support for ReadableStream.
// Unfortunately, currently it also lacks a sufficient WASM runtime.
// If this becomes the last thing Pale Moon lacks, allow Ruffle to work.
const readableStreamDefined = typeof ReadableStream === "function";
if (progressCallback && readableStreamDefined) {
const contentLength =
wasmResponse?.headers?.get("content-length") || "";
let bytesLoaded = 0;