Polyfill URL.parse for PDF.js v5 modern build

This commit is contained in:
Florian Bruhin 2025-03-21 10:41:48 +01:00
parent b43c79989e
commit 59be37007d
2 changed files with 17 additions and 0 deletions

View File

@ -29,6 +29,11 @@ Changed
* `qute-bitwarden` now passes your password to the subprocess in an
environment variable when unlocking your vault, instead of as a command
line argument. (#7781)
- New `-D no-system-pdfjs` debug flag to ignore system-wide PDF.js installations
for testing.
- Polyfill for missing `URL.parse` with PDF.js v5 and QtWebEngine < 6.9. Note
this is a "best effort" fix and you should be using the "older browsers"
("legacy") build of PDF.js instead.
Fixed
~~~~~

View File

@ -19,4 +19,16 @@ SPDX-License-Identifier: GPL-3.0-or-later
return { promise, resolve, reject }
}
}
// Chromium 126 / QtWebEngine 6.9
// https://caniuse.com/mdn-api_url_parse_static
if (typeof URL.parse === "undefined") {
URL.parse = function(url, base) {
try {
return new URL(url, base);
} catch (e) {
return null;
}
}
}
})();