Commit Graph

9241 Commits

Author SHA1 Message Date
Florian Bruhin
6fe09c12da Add a setting for Chromium's low-end device mode
See #4039
See #2377
2018-09-17 18:39:41 +02:00
Ellis
8e42683f41 Changed QUrlPattern to UrlPattern 2018-09-17 12:27:45 -04:00
Ellis
c42a7dff0e Changed QUrl to QUrlPattern 2018-09-17 12:05:46 -04:00
Ellis
15b00cea6a Merge branch 'master' of https://github.com/qutebrowser/qutebrowser 2018-09-17 11:59:10 -04:00
Ellis
92b56b3d38 Changed configdata to use QUrl for adblock whitelisting 2018-09-17 11:57:20 -04:00
Florian Bruhin
574d7c6a11 Add settings for process models
See #4039, #2377
Fixes #4040
2018-09-17 17:22:51 +02:00
Florian Bruhin
27d0d148b8 Split up _asciidoc_fallback_path from qute_help 2018-09-17 10:29:00 +02:00
Florian Bruhin
be0d6ef3d2 Try more possible asciidoc paths for qute://help fallback 2018-09-17 09:51:15 +02:00
Ellis
1384e14bf1 Removed unused import statement 2018-09-16 20:36:00 -04:00
Ellis
3f8958054b Fixed is_whitelisted_host to use QUrl fixes #4179 2018-09-16 19:41:49 -04:00
Ellis
770a95c101 Changed is_whitelisted_host to use URL Patterns fixes #4179 2018-09-16 19:12:49 -04:00
Florian Bruhin
abff44def6 Get rid of end-of-doc-workaround in caret browsing
In Qt < 5.10 (and also sometimes on Windows), we get extra spaces or newlines
when moving to the end of the document. However, this only happens *sometimes*,
and manual testing confirms that with the current workaround, we actually lose
the last char in the selection.

I'm not sure what's happening there, but instead of making things worse with
the workaround, let's just be a bit less strict with the checking there and
accept both variants... This seems like some Chromium bug we can't do much
about.
2018-09-15 20:39:35 +02:00
Ryan Roden-Corrent
102c6b99dd
Don't highlight html escapes in completion.
Resolves #4199.

To avoid accidentally highlighting characters that were introduced by
html escaping the text before feeding it to setHtml, we can't just
escape the whole string before adding the highlighting. Instead, we need
to break the string up on the pattern, format and escape the individual
parts, then join them back together.

re.escape includes empty strings if there is a match at the start/end,
which ensures that matches always land on odd indices:

https://docs.python.org/3/library/re.html#re.split

> If there are capturing groups in the separator and it matches at the
> start of the string, the result will start with an empty string. The
> same holds for the end of the string
2018-09-15 14:06:28 -04:00
Ryan Roden-Corrent
4f99af5876
Don't escape quotes in completion text.
Resolves the example case in #4199, but not the larger problem. We don't
need to escape quotes as we don't put the string in an attribute value.
From the docs at
https://docs.python.org/3/library/html.html#html.escape:

> If the optional flag quote is true, the characters (") and (') are also
> translated; this helps for inclusion in an HTML attribute value
> delimited by quotes, as in <a href="...">.

Escaping quotes means we end up with a literal &#x27; in the completion
view wherever there is a quote in the source text.

However, problem in #4199, where unexpected parts of the text are
highlighted, can also happen with '<', '>', and '&', which still must be
escaped.
2018-09-15 13:39:49 -04:00
Florian Bruhin
59413810bf Clean up emitting of follow_selected_done 2018-09-15 15:48:40 +02:00
zaowen
bdc41db601 Adblock import handles local directories and paths
Fixes #464
* Handles local Directories
* Handles local paths without file://
2018-09-15 02:22:44 -06:00
Florian Bruhin
d74daf9294 Fix lint 2018-09-14 22:52:40 +02:00
Florian Bruhin
4ae78d9bb2 Revert "Revert "Make sure we wait until follow_selected is done""
This reverts commit 200c11625f.
2018-09-14 22:40:47 +02:00
Florian Bruhin
200c11625f Revert "Make sure we wait until follow_selected is done"
This reverts commit bc45aa33e0.
2018-09-14 21:58:42 +02:00
Florian Bruhin
bc45aa33e0 Make sure we wait until follow_selected is done 2018-09-14 20:18:33 +02:00
Jesko Dujmovic
25e396faea
Merge branch 'master' into master 2018-09-13 22:06:04 +02:00
Florian Bruhin
f9327731b8 Handle UTF-8 byte order marks in Greasemonkey scripts
See e.g. https://github.com/jerone/UserScripts/issues/135
2018-09-12 23:54:32 +02:00
Florian Bruhin
91b8002dd5 Clean up workaround for sqlite opening errors
Now that we know the real cause, we can be a bit stricter with our workaround.
2018-09-12 16:06:57 +02:00
Jay Kamat
59af280f5c
Merge pull request #4206 from airodactyl/feature/support-multiple-words-tab-give-take
Support multiple words for :tab-take without quotes
2018-09-11 18:37:21 -07:00
Florian Bruhin
c2a072f9fe Fix handling of sqlite out of memory errors
The "error_code == -1" check never passed, as error_code (confusingly) is a
string of a number.
2018-09-12 01:36:50 +02:00
Florian Bruhin
c8b447daec Clean up raise_sqlite_error 2018-09-12 01:31:41 +02:00
Florian Bruhin
941be6faed Add docstring 2018-09-11 20:45:15 +02:00
Florian Bruhin
6a480564cb Fix docs to say XDG_DATA_HOME instead of _DIR 2018-09-11 19:44:37 +02:00
Florian Bruhin
d80d9eb26c Allow downloading from PDF.js
When we click the download button in PDF.js, it downloads a blob://qute:...
URL. We can detect that and force a download rather than opening it in PDF.js
again.

Note that what actually happens depends on the Qt version and backend:

QtWebKit (any Qt version):
Downloads always work properly (regardless of Qt version).

QtWebEngine, Qt 5.7.1:
Downloads work.

QtWebEngine, Qt 5.9 - 5.11:
Downloads won't work as we need to tell PDF.js to not use blob: URLs:
https://bugreports.qt.io/browse/QTBUG-70420 - in theory, PDF.js could fall back
to downloading the existing qute:// URL, but it has a whitelist of schemes
which does not include qute://... Since it's not in that whitelist, it just
ends up doing nothing at all.

QtWebEngine, Qt 5.12:
Downloads should hopefully work properly again, as we can register the qute://
scheme with Chromium, which allows us to use blob:// URLs.
2018-09-10 13:15:39 +02:00
Florian Bruhin
02641b86fc Don't tell PDF.js to disable createObjectURL on Qt 5.7.1
Looks like things actually work fine there...
2018-09-10 13:01:01 +02:00
Michael Hoang
1b618b2501 Set maxsplit to 0 on :tab-take 2018-09-10 10:03:58 +10:00
Thomas Fischer
6b358fe955 (QtWebEngine) Unhide scrollbar on search result 2018-09-09 16:20:00 -07: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
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
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
Jesko
f22fb30ef3 fixing non controversial changes 2018-09-09 20:51:19 +12:00
Jimmy
5252541fe3 greasemonkey: better handle scripts without metadata
Previously calling `script.code()` would fail if the script didn't have
a `name`. This wasn't being hit in practice because the only place that
constructs GreasemonkeyScripts was checking for that condition and add
the filename there as a fallback.

This change make the `name` attribute more explicitly mandatory by
failing with a `ValueError` if it is not provided and make it still
possible to use the filename fallback in that case by adding a
`filename` keyward argument to `__init__()`.

Additionally where `script_meta` is used in `script.code()` a fallback
to and emptry string was added so it doesn't fail for raw javascript
files without greasemonkey metadata.
2018-09-09 20:51:19 +12:00
Jimmy
32268ae66a Split _inject_greasemonkey_scripts to separate requirements.
Because flake8 was complaining about cyclomatic complexity.
2018-09-09 20:45:21 +12:00
Jesko
abea603119 moving MAX_WORLD_ID to qtutils, changing test names, fixing linter errors, changing error type to WebTabError 2018-09-09 20:45:21 +12:00
Jesko
ee9b1f4950 adding tests and improving error messages 2018-09-09 20:45:21 +12:00
Jesko
0c38cbcbdd putting in current borders 2018-09-09 20:45:21 +12:00
Jesko
8aa682e769 catching greasemonkey errors aswell 2018-09-09 20:45:21 +12:00
Jesko
583c7e4198 catch the exception 2018-09-09 20:45:21 +12:00
Jay Kamat
e295e8054c
Add support for triggering change handlers when using :open-editor 2018-09-08 20:39:38 -07: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
45eece372f Don't access caretElement if it's gone 2018-09-08 15:51:42 +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
cauimsouza
4a8d8688cb Improve configuration description 2018-09-07 21:46:03 +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
Florian Bruhin
5ca911bcdb Fix lint 2018-09-06 20:09:57 +02:00
Florian Bruhin
ab6c8dde9a Decrease minimum QProgressDialog duration
We already have a threshold before we use a QProgressDialog at all, so let's
show it quite quickly and not after 4 seconds.
2018-09-06 17:26:28 +02:00
Florian Bruhin
d4f16f88b6 Remove support for importing pre-v1.0.0 history 2018-09-06 17:26:28 +02:00
Florian Bruhin
ec774379bd Add tests for history progress 2018-09-06 17:13:46 +02:00
Florian Bruhin
e4b7786bcc Factor out GUI stuff to a HistoryProgress object 2018-09-06 17:04:26 +02:00
Florian Bruhin
2109b2276e Initial progress dialog for history rebuild 2018-09-06 16:52:14 +02:00
Florian Bruhin
cd8fd8ab3c Use config cache for completion.web_history.exclude
On my machine, this speeds up regenerating from ~6min to ~25s.
2018-09-06 16:17:23 +02:00
Florian Bruhin
108cc65bc6 Merge remote-tracking branch 'origin/pr/4185' 2018-09-06 16:15:16 +02:00
Jay Kamat
8e82adc306
Refactor configcache to cache
Also fix and improve configcache tests
2018-09-05 22:26:12 -07:00
cauimsouza
a742f03bca Change setting name 2018-09-05 02:59:03 +02:00
cauimsouza
fc1d192880 Pass url as second argument to slot 2018-09-05 02:37:23 +02:00
Florian Bruhin
6293bc5178 Fix lint and test 2018-09-04 23:46:34 +02:00
SubbulakshmiRS
5b8e0d8d80 Fixing the previous patches
Patch files for correct usage of QuteSchemeError and general clean up.

Closes https://github.com/qutebrowser/qutebrowser/issues/4059
2018-09-04 23:15:05 +02:00
Florian Bruhin
58793d95d7 Further clean up error handling 2018-09-04 23:05:59 +02:00
Florian Bruhin
92fcc523c5 WIP: Properly signal scheme errors 2018-09-04 23:03:10 +02:00
Florian Bruhin
2fcdc5a0c9 Merge branch 'blacklist-history' 2018-09-04 22:19:52 +02:00
Florian Bruhin
f6d0ed78d0 Improve description for completion.web_history.exclude 2018-09-04 22:19:22 +02:00
cauimsouza
d324448039 Fix mute_per_domain feature
Users can allow sounds to be played by
default while specifying domains not allowed
to play sounds, or the opposite.
2018-09-04 16:40:05 +02:00
cauimsouza
9d91c22236 Allow tabs be muted by default 2018-09-04 04:25:37 +02:00
Philip Scheel
8d04f8cdc8 Fixed pylint complaints 2018-09-04 00:59:49 +02:00
Philip Scheel
cf13c31142 Resolved conflicts for merge, regenerated asciidoc, removed whitespace
Removed whitespace
2018-09-04 00:10:07 +02:00
Philip Scheel
35c2f95a58 Merged upstream, made requested modifications to the search engine code and added tests 2018-09-03 23:28:43 +02:00
Jay Kamat
d4cf5045ab
Fix tests for configcache 2018-09-02 18:03:36 -07:00
Jay Kamat
cc09f6c962
Fix doc issues in configcache 2018-09-02 14:38:46 -07:00
Jay Kamat
0335fc31c1
Use config cache to cache static hotspots 2018-09-02 14:23:01 -07:00
Jay Kamat
067d76616b
Implement config cache system 2018-09-02 14:23:00 -07:00
Florian Bruhin
79eece8fd0 Completely undo older changes 2018-09-02 18:27:30 +02:00
Florian Bruhin
87a4b1d662 Reduce code duplication 2018-09-02 18:26:43 +02:00
Florian Bruhin
5b0c10d430 Fix docstrings 2018-09-02 15:46:57 +02:00
Florian Bruhin
8a42256cff Merge remote-tracking branch 'origin/pr/4178' 2018-09-02 15:45:48 +02:00
Florian Bruhin
a7775ffc2d Release v1.4.2 2018-09-02 14:53:38 +02:00
Florian Bruhin
ed67263a64 Check redirect before patterns 2018-09-02 14:42:47 +02:00
Florian Bruhin
dbdeb6a9c7 Rename history.exclude to completion.web_history.exclude
If the blacklist is only valid for the completion, the setting should also be
under completion.

This also un-renames history.gap_interval and renames
completion.web_history_max_items.
2018-09-02 14:42:47 +02:00
Florian Bruhin
4f56355fbe Don't affect qute://history with history.exclude 2018-09-02 14:42:47 +02:00
Florian Bruhin
3a13614d0e Fix none_ok description in BaseType 2018-09-02 12:10:07 +02:00
Florian Bruhin
67b4b7d490 Handle :// as URL pattern 2018-09-02 11:58:34 +02:00
Florian Bruhin
37396d68f3 Define names for sqlite error codes 2018-09-01 22:25:22 +02:00
Florian Bruhin
f5c92ded41 Merge Sql{Environment,Bug}Error with Sqlite{Environment,Bug}Error 2018-09-01 22:25:22 +02:00
Florian Bruhin
50ae2bf2f9 Redesign SQL error handling
Instead of having an environmental attribute on exceptions, we now have two
different exception classes.

Fixes #3341
See #3073
2018-09-01 22:25:22 +02:00
Florian Bruhin
99ae49ccd6 Describe all sqlite error codes 2018-09-01 22:25:22 +02:00
Florian Bruhin
71a2dad570 Add a history.exclude setting
This allows to exclude URL patterns from being displayed in the completion or
in qute://history.
2018-09-01 22:25:22 +02:00
Florian Bruhin
7fb2224640 Add a UrlPattern config type
For some settings it makes sense to have a list of URL patterns in the config,
rather than having a per-domain boolean setting.
2018-09-01 18:25:58 +02:00
Florian Bruhin
5c8d4ede06 Rename history_gap_interval to history.gap_interval 2018-09-01 18:25:58 +02:00
Florian Bruhin
67a52527f5 Mark SQLITE_IOERR/SQLITE_CANTOPEN as environmental error
Fixes #3060

IOERR: The SQLITE_IOERR result code says that the operation could not finish
because the operating system reported an I/O error.

CANTOPEN: The SQLITE_CANTOPEN result code indicates that SQLite was unable to
open a file. The file in question might be a primary database file or on of
several temporary disk files.
2018-09-01 18:25:58 +02:00
Florian Bruhin
47218e5402 sql.Query: Roll back transactions on errors 2018-09-01 18:25:58 +02:00
Florian Bruhin
aff1108836 sql.Query: Make sure transaction/commit succeed 2018-09-01 18:25:58 +02:00
Florian Bruhin
992f13b5b8 Add sql.Query._check_ok 2018-09-01 18:25:58 +02:00
Florian Bruhin
3f2a468750 Also detect missing bound values for sql.Query.run_batch 2018-09-01 18:25:58 +02:00
Florian Bruhin
0e284944e7 Use composition instead of inheritance for sql.Query
This means we're more loosely coupled to Qt's QSqlQuery, and also can move some
logic for handling batch queries from the table to there.
2018-09-01 18:25:58 +02:00
Florian Bruhin
6b719fb218 Make sure queries don't have any missing bindings 2018-09-01 18:25:58 +02:00
Florian Bruhin
9fb794656b Make it possible to force a history rebuild
This adds a new CompletionMetaInfo table which is a simple key/value store.

Thanks to Python/sqlite duck typing, we can use that to store values of any
type, even new ones in the future.

Currently, the only allowed key is force_rebuild, which forces a rebuild of the
CompletionHistory table. This will be needed for a future change.
2018-09-01 18:25:58 +02:00
Vasilij Schneidermann
3fa6d94893 Display value when calling :set without a value
This change brings Qutebrowser closer to Vim's behavior of `:set
foo?` *and* `:set foo` displaying the current value of `foo`.
2018-08-31 21:34:42 +02:00
Florian Bruhin
1815070dab Make sure the host blocker doesn't block 0.0.0.0 2018-08-31 16:48:45 +02:00
Florian Bruhin
65caf40b06 Remove unneeded import 2018-08-31 11:47:18 +02:00
Florian Bruhin
a13607674f Elide URLs at the end and not in the middle
With a URL like http://www.example.com/long/path/end, an elision like
http://www.example.com/…/path/end would be nicest, but using ElideMiddle means
we can end up with something like http://www.example.…/path/end, which can
possibly trick a user during a phishing attempt.

Instead, let's just always elide at the end, so we end up with
http://www.example.com/long/…. That makes sure the scheme/hostname (which are
most important) are visible as long as possible.

Fixes #4170.
2018-08-30 07:46:01 +02:00
Florian Bruhin
8459afb76e Recognize "Command"/"Cmd" in keybindings 2018-08-28 18:57:47 +02:00
Florian Bruhin
1a7efd92d7 Merge remote-tracking branch 'origin/pr/4140' 2018-08-27 10:06:04 +02:00
Florian Bruhin
bfec5c9f7f
Merge pull request #4153 from vilhalmer/set-desktop-entry-name
Set desktop file name
2018-08-27 09:31:00 +02:00
Florian Bruhin
1dd857a51a Implement MouseLock permission
Closes #3287
2018-08-24 23:31:04 +02:00
vilhalmer
8ac9c72412
Set desktop file name 2018-08-21 21:38:26 -04:00
Jimmy
b192164f2e Don't alphabetically sort tab completion.
`ListCategory` sorts its completion by default, we are already building
the categories in the right order so don't need that.

The test tests the case of where you have 11 tabs and if the model was
sorted the tabs with index 10 and 11 would be sorted before the one with
index 2.

The `random.sample` bit for the tab url and title is to also make sure
the model isn't being sorted on those columns, whithout haveng to write
and all ten lines.
2018-08-19 16:42:36 +12:00
lufte
9c4337c359 Fix "Unnecessary generator - rewrite as a list comprehension." 2018-08-17 18:06:23 -03:00
lufte
fd70d6d2d8 Some memory improvements with generators 2018-08-17 01:00:32 -03:00
lufte
68b9dff747 Perform attribute updates on a record's clone 2018-08-17 00:59:14 -03:00
Florian Bruhin
de8fd25f43 Change key to leave passthrough mode to Shift-Escape
We changed this a while ago in a2f62238f1
already, but Ctrl-V was kind of cumbersome as well, as it conflicted with
pasting.

Shift-Escape is closer to the default leave-mode binding (Escape), and also
unlikely to conflict as it's used for the task manager in Chrome.
2018-08-15 18:34:26 +02:00
Jay Kamat
b962c5c4d9
Merge pull request #4118 from DerJesko/master
Tests for ipv6 support in urlmatch
2018-08-13 14:33:53 -07:00
wishfort36
0e3e41a5e8 Handle nitpicks 2018-08-13 07:50:54 +02:00
wishfort36
b05738dd6c Keep $QUTE_COUNT unset if a count is not given 2018-08-12 22:39:32 +02:00
wishfort36
359eefe1ab Expose $QUTE_COUNT to userscripts 2018-08-12 21:21:01 +02:00
Florian Bruhin
58dffafb1e Merge remote-tracking branch 'origin/pr/4126' 2018-08-12 20:24:56 +02:00
Florian Bruhin
2a1afd5255 Add more detailed info to _chromium_version docs 2018-08-11 22:18:52 +02:00
Jesko
0d78533480 remove useless config option 2018-08-11 19:43:11 +02:00
farlusiva
8e2307c546 Docstring things, change test
- Update the docstring for repeat
 - Remove the blank line after the docstring
 - Update the docstring with scripts/dev/src2asciidoc.py
 - Simplify the test
2018-08-11 19:32:41 +02:00
wishfort36
f27195d360 Have 'times' multiply with [count] by default 2018-08-11 18:31:17 +02:00
wishfort36
961fa07fb0 Core functionality 2018-08-11 17:59:45 +02:00
Jesko
a676cca6c5 changing the texts of the errors 2018-08-10 20:49:20 +02:00
Jesko
b74b069153 removing useless brackets 2018-08-10 19:14:48 +02:00
Florian Bruhin
73ab356756
Merge pull request #4105 from davidv171/master
Show warning when using --backend with a running instance
2018-08-10 06:53:01 +02:00
Florian Bruhin
e927fecbbc Make content.webrtc_public_interfaces_only work on Qt 5.11
69abc9a1a1 added the argument for Qt 5.9, but
didn't add the QWebEngineSetting for Qt >= 5.11.

See #3010, #2163.
2018-08-08 20:48:33 +02:00
Jesko
972b3ae960 changing suggested flaws 2018-08-08 18:30:12 +02:00
Jesko
484a22f111 now declining more wrong ipv6 addresses and cleaning up code 2018-08-08 17:53:14 +02:00
Jesko
4ce5d99b24 match minimizes ipv6 urls 2018-08-08 16:55:43 +02:00
Florian Bruhin
831d3e4044 Add gD keybinding for :tab-give (detach a tab) 2018-08-08 14:23:03 +02:00
Florian Bruhin
7ed71592e0 Handle OSError when creating download directory
Fixes #2570
2018-08-07 16:42:59 +02:00
Florian Bruhin
1cb547a8de Use exist_ok=True for os.path.makedirs
See #2570
2018-08-07 16:42:59 +02:00
Florian Bruhin
b617f1e03c Remove old pylint disable comments 2018-08-06 19:55:27 +02:00
Florian Bruhin
50823b9415 eslint: Disable require-unicode-regexp
See https://eslint.org/docs/rules/require-unicode-regexp
It would be useful to have, but Chromium 49 coming with Qt 5.7 doesn't support
it (Chromium 56 in Qt 5.9 would)...

Also see #3839
2018-08-04 13:43:00 +02:00
David
c692649ad1 Improved the style of the message 2018-08-04 01:12:39 +02:00
David
56caae9c47 Fixed the lack of whitespace between words 2018-08-04 01:09:15 +02:00
David
068ac0df82 Make the line shorter and span over 2 lines 2018-08-04 01:06:38 +02:00
David
1888423332 Added a warning when a second instance is being launched with a backend flag 2018-08-02 22:03:10 +02:00
Florian Bruhin
6b044d4aff Fix indent 2018-07-28 14:47:01 +02:00
Florian Bruhin
ee06ba0140 Handle invalid URLs in acceptNavigationRequest in the tab API 2018-07-28 11:54:58 +02:00
Florian Bruhin
7ac7ccc296 Ignore invalid URLs in acceptNavigationRequest 2018-07-28 09:18:50 +02:00
Florian Bruhin
d830dd69a4 Add workaround comment 2018-07-24 16:04:28 +02:00
Florian Bruhin
90d7ab84b0 Merge remote-tracking branch 'origin/pr/4072' 2018-07-24 16:03:54 +02:00
Florian Bruhin
f69cd2259e Don't require user interaction for clicking qute:// links
See #4090, #4073
2018-07-24 15:44:27 +02:00
Florian Bruhin
e70d796dad Merge remote-tracking branch 'origin/pr/4090' 2018-07-24 15:41:40 +02:00
Florian Bruhin
6c353a140f Bump up yaml_load deadline on CI 2018-07-23 21:32:09 +02:00
Jay Kamat
31d318ee0a
Add catch and error handling for errors in follow_selected click 2018-07-21 13:58:41 -07:00
Jay Kamat
2b8068f6da
Move audible strings into class variables 2018-07-21 12:50:45 -07:00
Florian Bruhin
3b6c4d4b85 Remove unneeded log prefix
We see the function anyways
2018-07-19 00:31:40 +02:00
Florian Bruhin
7d695d40b9 Add a QUTE_FAKE_OPENGL_VENDOR envvar 2018-07-19 00:31:23 +02:00
Florian Bruhin
8a748741ba Fix checks for Nouveau workaround 2018-07-19 00:28:12 +02:00
Florian Bruhin
a72eee8e39 Enable XSS auditing by default
Qt disables this by default, but Chromium does have it enabled.

I also submitted a change to Qt to hopefully enable it by default there
starting with Qt 5.12: https://codereview.qt-project.org/#/c/198354/15

This also removes the claim of having a (big) performance impact, as Chromium's
XSS design doc says the opposite:
https://www.chromium.org/developers/design-documents/xss-auditor
2018-07-17 12:01:17 +02:00
Florian Bruhin
b8c70e5986 Rewrite type comments again 2018-07-16 22:35:40 +02:00
Florian Bruhin
2d65f25a04 Remove unnecessary object inheritance 2018-07-16 14:44:31 +02:00
Florian Bruhin
e4a772c61c Fix try-except-raise for pylint 2.0
See https://github.com/PyCQA/pylint/issues/2302
2018-07-16 14:44:07 +02:00
Florian Bruhin
e0f3285f05 Fix bad-indentation issues for pylint 2.0
See https://github.com/PyCQA/pylint/issues/2301
2018-07-16 14:41:18 +02:00
Florian Bruhin
e50b6912a7 Fix pylint 2.0 useless-return cases
See https://github.com/PyCQA/pylint/issues/2300
2018-07-16 14:33:11 +02:00
Florian Bruhin
b1d508a3af Rewrite pseudo "type:" comments for pylint 2.0
See https://github.com/PyCQA/pylint/issues/2299
2018-07-16 14:15:00 +02:00
Florian Bruhin
9298f3d055 Refactor print handling and fix window.print
On Qt 5.7.1, window.print() caused a CommandError which wasn't handled as the
command was called from accept_navigation_request.

Instead, we now show the dialog in AbstractPrinting and use that directly.
2018-07-16 08:16:18 +02:00
Hendrik R
b1a060fb71 Process all events before issuing an alert
Fixes #2603

The call to processEvents fixes an apparent race condition with some window
managers, e.g. i3. QT seems to be thinking, that the window is not marked as
urgent and toggles it twice, so synchronizing before issuing the alert makes QT
behave correctly.

This change should not change the behaviour on other systems only correct the
fault reported in #2603.
2018-07-15 14:31:03 +02:00
Florian Bruhin
d1a25b6c3f Release v1.4.1 2018-07-11 17:17:51 +02:00
Florian Bruhin
43e58ac865 CVE-2018-10895: Fix CSRF issues with qute://settings/set URL
In ffc29ee043 (part of v1.0.0), a
qute://settings/set URL was added to change settings.

Contrary to what I apparently believed at the time, it *is* possible for
websites to access `qute://*` URLs (i.e., neither QtWebKit nor QtWebEngine
prohibit such requests, other than the usual cross-origin rules).

In other words, this means a website can e.g. have an `<img>` tag which loads a
`qute://settings/set` URL, which then sets `editor.command` to a bash script.
The result of that is arbitrary code execution.

Fixes #4060
See #2332
2018-07-11 17:05:23 +02:00
Florian Bruhin
b9e3d3cab9 Add workaround for chrome-extension:// URLs
Fixes #4049
2018-07-09 12:29:35 +02:00
Florian Bruhin
274b66ec46 Strip trailing newlines from pastebin URL 2018-07-08 22:09:56 +02:00
Markus Ongyerth
40b2d03688 make the host_blocker aware of patterns
Add an additional argument to is_blocked for the current url, and enable
the host_blocking.enabled property to be set per domain.
This allows to bypass host blocking for specific domains
2018-07-08 16:17:24 +02:00
Olmo Kramer
daa8bc0507
Fix accidentally renamed hint group 2018-07-05 00:57:08 +02:00
Olmo Kramer
ca89b11398
Use configured links selector for navigate command 2018-07-04 22:56:47 +02:00
Olmo Kramer
6212dbc488
Add more input types to the input hints group 2018-07-04 22:56:47 +02:00
Olmo Kramer
1d39276d24
Add media hinting group 2018-07-04 22:56:47 +02:00
Olmo Kramer
0f8296d384
Add hints.selectors setting 2018-07-04 22:56:42 +02:00
Florian Bruhin
0a31e19eda Handle download errors when the reply is already gone
Fixes #1270
2018-07-03 17:16:02 +02:00
Florian Bruhin
0f037fb415 Release v1.4.0 2018-07-03 15:44:44 +02:00
Florian Bruhin
8cf22c85e0 Merge remote-tracking branch 'origin/pr/4019' 2018-07-03 13:52:24 +02:00
Florian Bruhin
d861c097b1 Support new dead keys added in Qt 5.11 properly
See https://codereview.qt-project.org/#/c/207231/
2018-07-02 22:32:59 +02:00
Florian Bruhin
ad19833e34 Revert "Add workaround for PyQt 5.11 headerDataChanged bug"
PyQt 5.11.1 has already been released, with the bug fixed.

This reverts commit 291763a55643342a6f977ce2a12dcc6f4badbe8a.
2018-07-02 22:32:59 +02:00
Florian Bruhin
eca08f064b Add workaround for PyQt 5.11 headerDataChanged bug
https://www.riverbankcomputing.com/pipermail/pyqt/2018-June/040445.html
2018-07-02 22:32:59 +02:00
Florian Bruhin
c3455d9082 Add a wrapper around sip
Starting with PyQt 5.11, the sip module now is bundled with PyQt as PyQt.sip.
Having a qutebrowser.qt also helps with #3625, see #995
2018-07-02 22:32:59 +02:00
Florian Bruhin
a7af5195d1 Set title when showing PDF.js error page
Fixes #3894
2018-06-28 11:22:44 +02:00
Florian Bruhin
e9c78b29ed Ignore Python 3.7 collections.abc warning
Related issues/PRs:
https://github.com/yaml/pyyaml/pull/181
https://github.com/pypa/setuptools/issues/1401
https://github.com/pallets/markupsafe/pull/98
https://github.com/yaml/pyyaml/pull/181
https://github.com/pallets/jinja/pull/867
2018-06-27 16:01:21 +02:00
Florian Bruhin
2f612aa6df Update comment 2018-06-26 15:54:56 +02:00
Florian Bruhin
8519aa940f Decorate slots properly 2018-06-26 10:40:13 +02:00
Florian Bruhin
ea4ee6f00b Use the url_changed signal in the tab API 2018-06-26 10:39:33 +02:00
Florian Bruhin
1536843f33 Only get greasemonkey object once 2018-06-26 10:39:04 +02:00
Florian Bruhin
61da5d0c7c Merge remote-tracking branch 'origin/pr/4017' 2018-06-26 10:37:17 +02:00
Florian Bruhin
85a9f6a08a Fix lint 2018-06-26 10:23:48 +02:00
Jimmy
c43d173197 greasemonkey: s/userscripts/greasemonkey_scripts/
No need to confuse developers as well as users.
2018-06-26 16:42:31 +12:00
Jimmy
ee2c765859 greasemonkey: check _widget is not deleted
Just for good luck.

No crash has been reported here but it is a common pattern for functions
called from signals.
2018-06-26 16:42:31 +12:00
Jimmy
6f1232e621 greasemonkey: move 5.7.1 injection method into _WebEngineScripts
Moves the 5.8 check to `_WebEngineScripts.init()`.

Changes `_inject_userscripts` to allow for the two code paths. With
5.7.1 we need to specify the injection point and not clear all scripts
for each call, since we have to call it three times.

Change the 5.8+ hook to call a new method which passes all the scripts
into `_inject_userscripts` so that doesn't have to have a fallback
conditional inside it because thats an inversion of responsibility!

Pulling the remove scripts part into a seperate function and making it
the callers responsibilty to call that first would tidy it up a little
more but meh.

I was worried about just doing `_widget.page().urlChanged.connect()`
once at tab init, where before it was connected at page init, because I
was under the impression that the child page can be replaced at any
time, eg when navigating to a new origin. But under manual testing I
didn't see that at all. Maybe I was mistaken or maybe that only started
in a later Qt version.
2018-06-26 16:42:31 +12:00
Jimmy
747acfe7fa Makes sanitize_filenames platform dependant.
Hopefully having the posix bad_chars list so minimal won't ruin anyones day.
2018-06-26 16:29:38 +12:00
Jimmy
1febcb9fce Also call sanitize_filename in TempDownloadManager
Just in case the suggested name used for the temp file suffix somehow
has an illegal character in it.
2018-06-26 16:14:22 +12:00
Jimmy
ffd6ffef45 Add force_encoding call to sanitize_filename.
So that callers don't have to call both.
2018-06-26 16:14:22 +12:00
Jimmy
5f4efced7b Sanitize generated filenames for downloads.
Replace characters that Windows doesn't like from generated and
suggested filenames for downloads. Does not apply to filenames that a
user inters via the downloads location prompt.

Fixes #3922
2018-06-26 16:14:22 +12:00
Jimmy
324966cfe7 greasemonkey: also support qute-js-world on 5.7.1
A straight copy from webengintab.

Yes I know I shouldn't be importing a private thing from webenginetab,
I'm working on refactoring now.
2018-06-26 15:00:35 +12:00
Jimmy
521268a1f7 Update comment. 2018-06-26 15:00:35 +12:00
Jimmy
54ca9b34e5 greasemonkey: enable running in isolated js worlds
QtWebEngine (via chromium) has the ability to run injected scripts in
isolated "worlds". What is isolated is just the javascript environment,
so variables and functions defined by the page and the script won't
clobber each other, or be able to interact (including variables saved to
the global `window` object). The DOM is still accessible from "isolated"
scripts.

This is NOT a security measure. You cannot put untrusted scripts in one
of these isolated worlds and expect it to not be able to do whatever
page js can do, it is just for namespacing convenience. See
https://stackoverflow.com/questions/9515704/insert-code-into-the-page-context-using-a-content-script
for some examples of how to inject scripts into the page scope using DOM
elements.

Now you can specify the world ID in a `@qute-js-world` directive like:

```
// ==UserScript==
// @name         Do thing
// @match        *://some.site/*
// @qute-js-world 1234
// ==/UserScript==
document.body.innerHTML = "<strong>overwritten</strong>"
```

The QtWebEngine docs say worldid is a `quint32` so you can put whatever
number (positive, whole, real) you want there. I have chosen to allow
the `qutebrowser.utils.usertypes` enum as aliases for IDs that are
predefined in
`qutebrowser.browser.webengine.webenginetab._JS_WORLD_MAP`. So you can
pass `main`, `application`, `user` or `jseval` in there too. `main` (0)
is the default one and is the only one in which JS disabled when
`content.javascript.enabled` is set to `false`. All others are still
enabled.

I'm not sure whether using any of those already-named worlds makes
sense, apart from `main`. We could stop people from using them I
suppose. Another option is to allow people to pass in `*` as a value to
have scripts put into their own little worlds, probably backed by a
counter in the GreaseMonkeyManager class.

Chrome docs: https://developer.chrome.com/extensions/content_scripts#execution-environment
Webengine docs: https://doc.qt.io/qt-5/qwebenginescript.html#details
2018-06-26 15:00:35 +12:00
Florian Bruhin
876aa5a9b1 Fix lint 2018-06-25 22:51:55 +02:00
Florian Bruhin
81b3ef937e Move handling of certificate errors to webenginetab 2018-06-25 21:04:32 +02:00
Florian Bruhin
8a4bba11ed Disable certificate workaround on Qt >= 5.9
Fixes #4020
2018-06-25 20:35:48 +02:00
Jay Kamat
da0a6305df
Fix crash when tab is closed after a per-domain forced reload 2018-06-25 12:45:17 -04:00
Florian Bruhin
6c9e23af4a eslint: Turn off max-lines-per-function 2018-06-25 08:14:02 +02:00
Florian Bruhin
f2f481d991 Support URL patterns for permissions and ssl_strict
See #3636
2018-06-24 21:38:37 +02:00
Florian Bruhin
f5e69b2174 Show inspector after creating it 2018-06-24 19:57:52 +02:00
Florian Bruhin
e6e844b039 Support URL patterns for content.headers settings
See #3636
2018-06-24 19:54:24 +02:00
Jay Kamat
454c532668
Fix behavior when toggling stacking behavior in a single tab 2018-06-23 12:33:35 -04:00
Florian Bruhin
a02c25dfb1 Don't escape URLs for qute://history
We only use the URL to set a 'href' attribute, which does not need escaping.

See #4011
Fixes #4012
2018-06-23 14:27:07 +02:00
Florian Bruhin
d2254ca48b Release v1.3.3
(cherry picked from commit ad9b50601c82f66646088e9ebdd66613eb2e93e2)
2018-06-21 23:32:56 +02:00
Florian Bruhin
0864ad4069 Fix shadowing of 'html' name 2018-06-21 22:28:27 +02:00
Florian Bruhin
5a7869f2fe Fix XSS issue on qute://history
Fixes #4011
2018-06-21 21:20:19 +02:00
Florian Bruhin
62d8b5b574 Don't depend on PyQt5.QtQuickWidgets to get RWHV
Some distributions (at least FreeBSD) don't package that module, so let's not
rely on it.
2018-06-21 17:14:29 +02:00
Florian Bruhin
c87757a913 Revert "Properly add QtQuickWidgets dependency"
Looks like FreeBSD doesn't have QtQuickWidgets packaged at all, so let's do the
same without requiring it...

This reverts commit e5405f0ae9.
2018-06-21 16:35:29 +02:00
Florian Bruhin
9f5ca475c9 Don't try to set focus if prev_focus is None 2018-06-21 01:44:15 +02:00
Florian Bruhin
e7a300865c Fix lint 2018-06-21 01:43:09 +02:00
Florian Bruhin
e5405f0ae9 Properly add QtQuickWidgets dependency 2018-06-21 00:21:52 +02:00
Jay Kamat
0e7bbccd71
Fix stacking tabs setting with new_tab prev 2018-06-19 12:10:21 -04:00
Jay Kamat
1919029858
Add setting for controlling stacking of new tabs 2018-06-18 18:09:13 -04:00
Florian Bruhin
3399f2df96 Always clear searches between page loads
Looks like this wasn't properly fixed in Qt for some reason.
Fixes #3693
See #2728 and bef372e5f5
2018-06-17 21:03:44 +02:00
Florian Bruhin
2029f52fdc Show cause when ~/.netrc can't be read 2018-06-17 20:53:29 +02:00
Florian Bruhin
663d1a4d2f Read dictionaries from /usr/share/qt on Qt >= 5.10
Fixes #3759
Supersedes #3762
See #2939, #4003
2018-06-17 20:27:52 +02:00
Philip
0a9806daf3 Fixed crash which could occur if user adds nonexistent category to url.open_categories_shown 2018-06-17 10:42:45 +02:00
Philip
a2b1e041d6 Implemented use of the order of url.open_categories_shown in the :open dialogue.
Reworded the description of this option to match.
2018-06-17 10:29:57 +02:00
Philip
a62aeb4abe Added support for searchengines listing in :open dialogue. Added settings for selecting what categories are shown in the :open dialogue. 2018-06-17 05:33:53 +02:00
Florian Bruhin
7654467f36 Remove unused import 2018-06-14 17:43:20 +02:00
Florian Bruhin
07cf2f5b60 Unconditionally restore mode after prompt 2018-06-14 16:09:30 +02:00
Florian Bruhin
4dddc07753 Make sure modeman.enter(KeyMode.normal) does something sensible 2018-06-14 16:09:26 +02:00