From a39dd64c5ebece50b0ae3574a5bb44885b99cefd Mon Sep 17 00:00:00 2001 From: toofar Date: Mon, 27 Nov 2023 08:16:34 +1300 Subject: Move pdf.js fetch() disabler earlier in the file. We are setting window.Response to undefined to cause certain versions of pdf.js to detect that fetch() isn't available and to fall back to XHRs. In more recent versions of pdf.js the HTML string we were matching against has changed, it has a 'type="module"' attribute now, so we need to change the pattern we match against. I don't think it matters where we put this mocking though, so I've just put it after '', which should hopefully be less fragile than matching against a '' --- qutebrowser/browser/pdfjs.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/qutebrowser/browser/pdfjs.py b/qutebrowser/browser/pdfjs.py index 427ef4537..1a13f5bda 100644 --- a/qutebrowser/browser/pdfjs.py +++ b/qutebrowser/browser/pdfjs.py @@ -63,11 +63,11 @@ def generate_pdfjs_page(filename, url): viewhtml = viewhtml.replace('', ''.format(script)) # WORKAROUND for the fact that PDF.js tries to use the Fetch API even with - # qute:// URLs. - pdfjs_script = f'' - viewhtml = viewhtml.replace(pdfjs_script, - '\n' + - pdfjs_script) + # qute:// URLs, this is probably no longer needed in PDFjs 4+. See #4235 + viewhtml = viewhtml.replace( + '', + '\n\n' + ) return viewhtml -- cgit v1.2.3-54-g00ecf