Merge branch 'Kingdread-pdfjs-1.6.210'

This commit is contained in:
Florian Bruhin 2016-10-06 22:59:08 +02:00
commit 5fd43e19c6
3 changed files with 8 additions and 5 deletions

View File

@ -179,6 +179,7 @@ Fixed
- Fixed hang when using multiple spaces in a row with the URL completion - Fixed hang when using multiple spaces in a row with the URL completion
- Fixed crash when closing a window without focusing it - Fixed crash when closing a window without focusing it
- Userscripts now can access QUTE_FIFO correctly on Windows - Userscripts now can access QUTE_FIFO correctly on Windows
- Compatibility with pdfjs v1.6.210
v0.8.3 (unreleased) v0.8.3 (unreleased)
------------------- -------------------

View File

@ -62,8 +62,10 @@ def _generate_pdfjs_script(url):
url: The url of the pdf page as QUrl. url: The url of the pdf page as QUrl.
""" """
return ( return (
'PDFJS.verbosity = PDFJS.VERBOSITY_LEVELS.info;\n' 'document.addEventListener("DOMContentLoaded", function() {{\n'
'PDFView.open("{url}");\n' ' PDFJS.verbosity = PDFJS.VERBOSITY_LEVELS.info;\n'
' (window.PDFView || window.PDFViewerApplication).open("{url}");\n'
'}});\n'
).format(url=javascript.string_escape(url.toString(QUrl.FullyEncoded))) ).format(url=javascript.string_escape(url.toString(QUrl.FullyEncoded)))

View File

@ -36,11 +36,11 @@ from qutebrowser.browser import pdfjs
'http://foobar/%22);alert(%22attack!%22);'), 'http://foobar/%22);alert(%22attack!%22);'),
]) ])
def test_generate_pdfjs_script(url, expected): def test_generate_pdfjs_script(url, expected):
expected_code = ('PDFJS.verbosity = PDFJS.VERBOSITY_LEVELS.info;\n' expected_open = 'open("{}");'.format(expected)
'PDFView.open("{}");\n'.format(expected))
url = QUrl(url) url = QUrl(url)
actual = pdfjs._generate_pdfjs_script(url) actual = pdfjs._generate_pdfjs_script(url)
assert actual == expected_code assert expected_open in actual
assert 'PDFView' in actual
def test_fix_urls(): def test_fix_urls():