diff --git a/qutebrowser/browser/pdfjs.py b/qutebrowser/browser/pdfjs.py index e36824223..2e6cb5de2 100644 --- a/qutebrowser/browser/pdfjs.py +++ b/qutebrowser/browser/pdfjs.py @@ -76,33 +76,6 @@ def _generate_pdfjs_script(url): ).format(url=javascript.string_escape(url.toString(QUrl.FullyEncoded))) -def fix_urls(asset): - """Take an html page and replace each relative URL with an absolute. - - This is specialized for pdf.js files and not a general purpose function. - - Args: - asset: js file or html page as string. - """ - new_urls = [ - ('viewer.css', 'qute://pdfjs/web/viewer.css'), - ('compatibility.js', 'qute://pdfjs/web/compatibility.js'), - ('locale/locale.properties', - 'qute://pdfjs/web/locale/locale.properties'), - ('l10n.js', 'qute://pdfjs/web/l10n.js'), - ('../build/pdf.js', 'qute://pdfjs/build/pdf.js'), - ('debugger.js', 'qute://pdfjs/web/debugger.js'), - ('viewer.js', 'qute://pdfjs/web/viewer.js'), - ('compressed.tracemonkey-pldi-09.pdf', ''), - ('./images/', 'qute://pdfjs/web/images/'), - ('../build/pdf.worker.js', 'qute://pdfjs/build/pdf.worker.js'), - ('../web/cmaps/', 'qute://pdfjs/web/cmaps/'), - ] - for original, new in new_urls: - asset = asset.replace(original, new) - return asset - - SYSTEM_PDFJS_PATHS = [ # Debian pdf.js-common # Arch Linux pdfjs (AUR) diff --git a/tests/unit/browser/test_pdfjs.py b/tests/unit/browser/test_pdfjs.py index a33dae5bf..594e69df6 100644 --- a/tests/unit/browser/test_pdfjs.py +++ b/tests/unit/browser/test_pdfjs.py @@ -43,27 +43,6 @@ def test_generate_pdfjs_script(url, expected): assert 'PDFView' in actual -def test_fix_urls(): - page = textwrap.dedent(""" - - - - - - """).strip() - - expected = textwrap.dedent(""" - - - - - - """).strip() - - actual = pdfjs.fix_urls(page) - assert actual == expected - - @pytest.mark.parametrize('path, expected', [ ('web/viewer.js', 'viewer.js'), ('build/locale/foo.bar', 'locale/foo.bar'),