Commit Graph

8950 Commits

Author SHA1 Message Date
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
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
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
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