Commit Graph

16629 Commits

Author SHA1 Message Date
Florian Bruhin
bb96f8d297 Fix PDF.js test when no PDF.js is installed 2018-09-10 09:36:29 +02:00
Michael Hoang
1b618b2501 Set maxsplit to 0 on :tab-take 2018-09-10 10:03:58 +10:00
wildente
b1e2a1ec2d add proper multiline support for qute-pass
when using the 'username-taget secret' option, the supplied
regex 'username-pattern' will only scan the first line of the
secret file.

you could specify a username-pattern with '\n', but this will
break if the position of the username is not consistent.

this change will implement re.search and the re.MULTILINE
option to search every line in a secrect file.

example:

--secret file
my_secret_password
username: my_username
--secret file

spawn --userscript qute-pass --username-target secret --username-pattern "^username: (.*)"
2018-09-09 22:16:48 +02:00
Florian Bruhin
9b04c4b8e0 Add missing tests for qute://pdfjs 2018-09-09 19:22:39 +02:00
Florian Bruhin
b4077a8543 Fix lint 2018-09-09 18:39:22 +02:00
Florian Bruhin
b96898db37 Simplify and lock down PDF.js filename handling 2018-09-09 18:35:09 +02:00
Florian Bruhin
231c1fbe59 Add underscore to temporary download filename suffix 2018-09-09 18:35:09 +02:00
Florian Bruhin
8cfa46f539 100% test coverage for browser.pdfjs 2018-09-09 18:35:09 +02:00
Florian Bruhin
f7169dc0ba Enable content.pdfjs setting on QtWebEngine 2018-09-09 18:35:09 +02:00
Florian Bruhin
36ad2c45b5 Clean up PDF.js snippet 2018-09-09 18:35:09 +02:00
Florian Bruhin
24babe76a1 Remove dead code
Thanks vulture!
2018-09-09 18:35:09 +02:00
Florian Bruhin
3e25262437 Remove old backend patching 2018-09-09 18:35:09 +02:00
Florian Bruhin
490fe5e1a3 Add utils.guess_mimetype 2018-09-09 18:35:09 +02:00
Florian Bruhin
24148c649e Fix lint and tests 2018-09-09 18:35:09 +02:00
Florian Bruhin
2dccde8f4b Only set PDFJS.disableCreateObjectURL when necessary
See #4198
2018-09-09 18:35:09 +02:00
Florian Bruhin
6665a1348e Use jinja to get PDF.js script 2018-09-09 18:35:09 +02:00
Florian Bruhin
3ad7ae2a2c Remove fix_urls which isn't needed anymore
With qute://pdfjs/web/viewer.html we can use relative URLs
2018-09-09 18:35:09 +02:00
Florian Bruhin
c40ddf37b7 Set disableCreateObjectURL for PDF.js
We can't use blob URLs or we'll get a renderer crash:
https://bugreports.qt.io/browse/QTBUG-70420

Thankfully, we can tell PDF.js to use data: URLs instead.
2018-09-09 18:35:09 +02:00
Florian Bruhin
bbcb87e434 Get PDF.js to work
We need to use the /web/viewer.html path so relative references are correct.
2018-09-09 18:35:09 +02:00
Florian Bruhin
7206dde19c Revert "Simplify getting pdfjs main page"
This reverts commit 9c731bde85627308fdde4730b0181a014096cb47.

We need to set some PDF.js options, so we can't just use the default viewer
with ?file=...
2018-09-09 18:35:09 +02:00
Florian Bruhin
a0b4f09f02 Initial PDF.js support for QtWebEngine 2018-09-09 18:35:09 +02:00
Florian Bruhin
cb0c313404 Add qute://pdfjs/file to get files
Cross-origin requests aren't supported for qute:// URLs, and qute:// can't
access file://, so we need to get the files that way.
2018-09-09 18:35:09 +02:00
Florian Bruhin
8f19820a7a Remove pdfjs.fix_urls
Now that we use qute://pdfjs to show the viewer, we don't need to rewrite any
URLs.
2018-09-09 18:35:09 +02:00
Florian Bruhin
24fb3b0d1b Simplify getting pdfjs main page 2018-09-09 18:35:09 +02:00
Florian Bruhin
df67c254f8 Initial attempt at getting PDF.js to work with separate downloads 2018-09-09 18:35:09 +02:00
Florian Bruhin
8f1690eff7 Move pdfjs error page to pdfjs.py 2018-09-09 18:35:09 +02:00
Florian Bruhin
36b2f5e63f Remove qute:// backend= argument 2018-09-09 18:35:09 +02:00
Florian Bruhin
dc82ac3eb2 Move qute_pdfjs to qutescheme.py 2018-09-09 18:35:09 +02:00
Florian Bruhin
b611ff52cf Support URL patterns for content.autoplay 2018-09-09 18:31:41 +02:00
Jay Kamat
e295e8054c
Add support for triggering change handlers when using :open-editor 2018-09-08 20:39:38 -07:00
Ben Gartner
f5a07ba3cf Use outsuffix for relative links in asciidoc files 2018-09-08 12:34:13 -05:00
Florian Bruhin
88cbc9bb12 caret: Also enable end-of-doc-workaround on Windows 2018-09-08 16:32:28 +02:00
Florian Bruhin
3738a8c8a9 Apply caret mode workarounds correctly 2018-09-08 16:20:58 +02:00
Florian Bruhin
1647c28632 Allow lists for javascript.convert_js_arg 2018-09-08 16:20:38 +02:00
Florian Bruhin
b8ab378083 Show web_engine_tab container
This is needed for caret tests on Qt < 5.11
2018-09-08 16:04:29 +02:00
Florian Bruhin
20da259de6 Rewrite some :follow-selected tests as unit tests 2018-09-08 16:01:38 +02:00
Florian Bruhin
45eece372f Don't access caretElement if it's gone 2018-09-08 15:51:42 +02:00
Florian Bruhin
8c0366f0a7 Configure JS logging for test tab objects 2018-09-08 15:34:28 +02:00
Florian Bruhin
bb5fee4adc Also add a container for webengine_tab
Seems to be needed with Qt < 5.11 for things to work.
2018-09-08 14:52:57 +02:00
Florian Bruhin
9c67239847 Fix lint 2018-09-08 14:52:47 +02:00
Florian Bruhin
7cb32dca07 Add a container around webkit_tab
This makes the selection appear properly in caret tests - otherwise, --no-xvfb
would be needed.
2018-09-08 13:36:02 +02:00
Florian Bruhin
5978605873 Make caret unittests run with QtWebKit 2018-09-08 13:22:17 +02:00
Florian Bruhin
03dea493de Make sure we only update the caret selection once
Otherwise, stuff goes haywire when trying to use the caret mode very fast (like
in a unit test), because new stuff runs before we've managed to update the selection.
2018-09-08 13:18:09 +02:00
Florian Bruhin
db6935b42e Fix TestSearch caret tests
For some reason, they need the window to be shown on a screen to work...
2018-09-08 12:26:00 +02:00
Florian Bruhin
64e321d47c Rewrite most caret tests as unit tests 2018-09-08 12:15:32 +02:00
Florian Bruhin
a58abf8f4c Set __tracebackhide__ for CallbackChecker.check 2018-09-08 12:15:14 +02:00
Florian Bruhin
8ac3162425 Call modeman.init() in mode_manager fixture 2018-09-08 12:14:55 +02:00
Florian Bruhin
93eb05598e Fix request logging 2018-09-07 16:12:40 +02:00
Florian Bruhin
0b27779c9d Allow null initiator for qute:// URLs on Qt 5.11
Before Qt 5.11.2, for unique origins, we always got QUrl() and thus passed it
through.

With Qt 5.11.2, only missing origins (browser-initiated requests) get an empty
initiator, while unique origins get QUrl("null"):
https://codereview.qt-project.org/#/c/234849/
https://bugreports.qt.io/browse/QTBUG-69372

In theory, those should be locked down (as an unique origin is e.g. a sandboxed
iframe) and never have access to any other content.

However, thanks to a Qt bug, XHR on qute:// pages has QUrl("null") as origin as
long as the URL scheme is not registered. We can only do the registering once
Qt 5.12 is out.

Since unique origins were effectively already allowed on Qt 5.11.0/.1, we pass
them through here as well until Qt 5.12.

See #4198
2018-09-07 12:25:07 +02:00
Florian Bruhin
15c547b3f5 Move QuteSchemeHandler._check_initiator to its own method 2018-09-07 12:24:54 +02:00