Commit Graph

8735 Commits

Author SHA1 Message Date
Florian Bruhin
b1506274c5 Implement a better workaround for chrome-error:// URLs
It looks like chrome-error://chromewebdata/ triggers another invalid scheme
load which is why the endless loop happens. When we install a custom scheme
handler for chrome-error:// we can at least show an error page.
2018-06-07 16:03:25 +02:00
Florian Bruhin
89f4333df1 Make sure external schemes are clickable via hints
This issue was probably introduced in 545539f28d
- with JavaScript, we can't "click" on an external link.

There might be a better solution using
QWebEngineSettings::setUnknownUrlSchemePolicy(QWebEngineSettings::AllowAllUnknownUrlSchemes)
temporarily when using hints with PyQt 5.11.

Fixes #2833
2018-06-07 14:33:49 +02:00
Florian Bruhin
0c0d204fd4 Add a workaround for chrome-error:// loops on Qt 5.11
See #3661
2018-06-07 13:49:33 +02:00
Florian Bruhin
0e9159e8e8 Revert "Fix Qt 5.11 issues with clicking invalid links"
This reverts commit 1956590df84a72c7f9a516e805d01529291fccf8.

Turns out the actual issue wasn't due to *invalid* links - it's with links
which have an unknown scheme.

There's still a change in behavior between Qt 5.10 and 5.11 though: Invalid
links are apparently not passed to acceptNavigationRequest (sometimes?) so we
don't show an error message. Instead, we just load about:blank. However,
Chromium does that too and we can't handle a real click easily, so let's just
ignore that one.

See #3661
2018-06-07 13:49:13 +02:00
Florian Bruhin
3d53d0d2c5 Fix Qt 5.11 issues with clicking invalid links
See #3661
2018-06-07 13:48:04 +02:00
Florian Bruhin
456fdc55cc Only set PseudoLayout with Qt 5.11 2018-06-06 20:26:12 +02:00
Florian Bruhin
7e31897dcc Fix lint 2018-06-06 20:26:12 +02:00
Florian Bruhin
5147fc832c Handle resizing via PseudoLayout
This fixes the scenario where we just get a grey view when opening a link in a
tab from DuckDuckGo.
2018-06-06 20:26:12 +02:00
Florian Bruhin
ec6c5ebb69 Try harder to get the RenderWidgetHostViewQt 2018-06-06 20:26:12 +02:00
Florian Bruhin
34d054e8a5 Revert "Use WrapperLayout instead of PseudoLayout"
This reverts commit 6cc920472ee4170b257a0b588687b175162e83df.

Since self._widget can go stale in the layout, we need to somehow solve this differently...
2018-06-06 20:26:12 +02:00
Florian Bruhin
e0213e7447 Use WrapperLayout instead of PseudoLayout 2018-06-06 20:26:12 +02:00
Florian Bruhin
cee88cd7ca Initial proof of concept for pseudo layout
Fixes #3920 - hopefully properly this time...
2018-06-06 20:26:12 +02:00
Florian Bruhin
982a42d453 Unbind Ctrl-Shift-Tab by default 2018-06-05 11:33:34 +02:00
Florian Bruhin
b3c95c1668 Release v1.3.1
(cherry picked from commit ac29c579ff6a5d54c97513280fd1d8d187304160)
2018-05-29 11:15:15 +02:00
Jay Kamat
c33a887b2d
Add support for following tab selected elements to :follow-selected 2018-05-25 12:39:36 -07:00
Jay Kamat
cd56b97e7d
Add an option to disable escape in the report dialog 2018-05-24 11:50:27 -07:00
Florian Bruhin
12e0edbcd0 Fix lint 2018-05-24 08:47:31 +02:00
Jay Kamat
40e391e199
Prevent closing :report dialog when pressing <escape> 2018-05-23 21:25:43 -07:00
Florian Bruhin
17cfb0d39c Add some more logging for #3920 2018-05-23 21:31:18 +02:00
Florian Bruhin
7162f15348 Use functools instead of a lambda for QTimer
It reads nicer, and this is also speculative fix for #3896 as PyQt5 is
hopefully better at disconnecting partial-objects from dead objects than it is
with lambdas.
2018-05-23 09:44:44 +02:00
Florian Bruhin
29ad252278 Handle ² keypress correctly
Turns out str.isdigit() also handles ² as a digit, but int('²') causes a
ValueError.

Here we use `string.digits` instead, which is '0123456789'.

Fixes #3743
2018-05-22 12:25:45 +02:00
Florian Bruhin
71ad8bdb47 Properly work around Qt 5.11 keyboard focus issues
Please let this be the last attempt... :D

Fixes #3939
Supersedes #3921
Reverts ae295a7f65
See #3661

This should not regress #3872. Might affect #3834 in some way.
2018-05-22 09:36:14 +02:00
Florian Bruhin
89f019b710 Remove unneeded "except ... as e:" assignments 2018-05-21 20:03:18 +02:00
Jimmy
47446baf29 s/obj/target/
Would a bit of consistency in variable names be too much to ask?
2018-05-21 21:23:38 +12:00
Jimmy
d162e01422 Greasemonkey: remove extra window scope IIFE
Also change the block scoped `window` declaration to be const because it
seemed like a good idea. The real window seems to just silently ignore
attempts to overwrite it.
2018-05-20 18:42:40 +12:00
Jimmy
b0d1a137da Greasemonkey: Don't attempt scope isolation on webkit
Since the JSCore used by WebKit 602.1 doesn't fully support Proxy and I
can't think of a way to provide isolation otherwise just revert to the
old behaviour in that case. I am checking for the specific WebKit
version because I'm pretty sure that version just happened to be
released when Proxy support was only partially done, any later release
will presumably have a newer JSCore where it works.

There I changed the indentation of a block in the jinja template which
will have inflated the diff.

I added mocking of `objects.backend` to the `webview` and
`webenginewebview` fixtures, I am pretty sure they are mutually
exclusive so don't expect any issues from that.

Because of the feature detection being at template compile time I had to
tweak the test setup to be done via a fixture instead of the setupClass
functionality that I was using before.
2018-05-20 18:42:40 +12:00
Jimmy
13249329f7 Greasemonkey: skip window scoping test on webkit
The implementation of Proxy in JSCore used by current QtWebkit (webkit
602.1) doesn't support the `set()` handler for whatever reason. So
instead of testing for a specific behaviour that we can't ensure on that
version let's just skip the tests and handle user complaints with
sympathy.
2018-05-20 18:42:40 +12:00
Jimmy
19242b6cb2 Greasemonkey: fix scoping function decleration.
Apparently making a function like `function foo() {};` in block scope is
illegal. It should be named via assignment.

Switched to an IIFE anyway because it doesn't need a name.
2018-05-20 18:42:40 +12:00
Jimmy
23bfe6daa2 Greasemonkey: fix window proxy for new attributes
Previously scripts were failing to find attributes that they assigned to
window and then tried to use from the global scope. Eg

    window.newthing = function() {...};
    newthing(...);  // newthing is not defined error

This wasn't the case for things that already existed in the global scope
and were just being overwritten.

This change just overrides the `Proxy.has()` function which seems to fix
it. Probably the `while` implementation was failing to pick up new
attributes because of the lack.

I also tweaked some comments and variable names and const-ness to be a
little more production ready.
2018-05-20 18:42:40 +12:00
Jimmy
ab50ad735b Greasemonkey: isolates scripts' writes to window
Since the global namespace of javascript in the browser is accessible
there where issues with scripts clobbering things that the page expected
to be attributes of window pages clobbering things that userscripts
saved to `window`. The latter was occuring with OneeChan. OneeChan was
setting `window.$` to a function that took a css selector and the 4chan
catalog script was setting `window.$` to some object. Since OneeChan was
set to run at document-start this broke OneeChan, switching it to
document-end broke scripts on 4chan.

I used OneeChan and 4chan-X on 4chan as the test case for this and
TamperMonkey as a guide for what is the correct way to handle scoping. I
didn't manage to pick apart just how TamperMonkey does what it does (I
think it might just be the environment that Chrome provides extensions
actually) but I got close to the same behaviour.

TamperMonkey provides a `window` object that appears to be what the
global window looked like before the webpage modified it. The global
scope though does have the pages modifications accessible. If the script
assigns something to an attribute `window` it can see that attribute in
the global scope. This implementation differs from that one in that, to
the scipt, `window` and the global scope always look the same, and that
is the same as the global scope looks in the environment provided by
TamperMonkey.

I am using the ES6 `Proxy` feature to allow the `window` object to look
like the actual (unsafe) one while allowing writing to it that doesn't
clobber the unsafe one. I am then using the ES4 `with` function to make
attributes of that window (proxy) object visible in the scope chain.
There may be other ways to do this without using `with` by using nested
functions and setting `this` creatively. There are notes around
alleging `with` to be various states of uncool[1].

I also ran into an issue where a userscript calling
`window.addEventListener(...)` would fail with `TypeError: Illegal
Execution` which is apparently due to `this` not being set correctly. I
looked at the functions which threw that error and those that didn't and
am using whether they have a `prototype` attribute or not to tell
whether I need to bind them with `window` as `this`. I am not sure how
correct that is but it worked for all the cases I ran into.

[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/with
2018-05-20 18:42:40 +12:00
Joakim Särehag
4966a70709 Merge from main repo master, resolved conflict in webenginetab.py 2018-05-18 13:59:25 +02:00
Florian Bruhin
dacca0d2ed Remove double settings 2018-05-17 15:54:26 +02:00
Florian Bruhin
6ccd69dad2 Fix reload for JavaScript support on Qt 5.11 2018-05-17 15:54:17 +02:00
Florian Bruhin
44d26f77a5 Add workaround for the "split page" Qt bug (QTBUG-68224)
Fixes #3920
2018-05-17 14:21:14 +02:00
Florian Bruhin
6eadff4a10 Add Python executable to :version 2018-05-14 22:13:15 +02:00
Jay Kamat
563afb277d
Fix style issues 2018-05-10 08:04:48 -07:00
Jay Kamat
4bb048cb6a
Fix mocked tests 2018-05-09 21:41:59 -07:00
Jay Kamat
ae04da7b78
Upgrade indicator to show recentlyAudible status 2018-05-09 18:57:53 -07:00
Jay Kamat
7a297e2e3f
Add support for muting tabs 2018-05-09 18:28:05 -07:00
Joakim Särehag
dc7f39514d pull request #3864, reverted webview changes, fixed regression 2018-05-09 18:28:52 +02:00
Joakim Särehag
72c2962908 removed trailing whitespace 2018-05-09 15:52:22 +02:00
Joakim Särehag
cbf95d76bd Merge branch 'master' of https://github.com/qutebrowser/qutebrowser 2018-05-09 14:37:27 +02:00
Joakim Särehag
0e756d2f68 changes to pull request 3864, window.print for webengine 2018-05-09 14:36:03 +02:00
Florian Bruhin
48c44e1b4d Fix and update docs 2018-05-08 15:22:49 +02:00
Florian Bruhin
8531f89ca3 Merge remote-tracking branch 'origin/pr/3789' 2018-05-08 11:45:20 +02:00
Florian Bruhin
89a1c43b4c Merge remote-tracking branch 'origin/pr/3790' 2018-05-08 11:43:30 +02:00
Florian Bruhin
b718c8b43a Merge remote-tracking branch 'origin/pr/3899' 2018-05-08 11:40:43 +02:00
Jay Kamat
906da44d70
Simplify visited link clearing by looping over connections 2018-05-07 14:10:20 -07:00
Jay Kamat
ca48f9f100
Clear url from visitedLinks if a single url is deleted 2018-05-07 13:48:38 -07:00
Jay Kamat
d0b2360745
Clear visited links db when running :history-clear on webengine 2018-05-07 13:35:41 -07:00
Pol Van Aubel
f1b481dcc7 Short options for --debug and --debug-flags 2018-05-07 22:35:32 +02:00
Pol Van Aubel
431a52da6c Short options for --basedir and --temp-basedir 2018-05-07 22:10:08 +02:00
Florian Bruhin
b9fc068af5 Add a log-requests debug-flag 2018-05-07 10:23:56 +02:00
Florian Bruhin
7762017f00 Release v1.3.0 2018-05-03 19:25:04 +02:00
Florian Bruhin
adf2f9860d Disable spellcheck when it's unneeded.
Fixes #3753
2018-05-03 17:58:56 +02:00
Florian Bruhin
f0f1a4a1d1 Merge remote-tracking branch 'origin/pr/3702' 2018-05-03 17:56:03 +02:00
Florian Bruhin
ae295a7f65 Call setFocus() when navigating
See #3661:
https://github.com/qutebrowser/qutebrowser/issues/3661#issuecomment-386308601
This doesn't seem to fully fix this, but at least the top four failed tests
there...

This should not regress #3872. Might affect #3834 in some way.
2018-05-03 17:43:19 +02:00
Jay Kamat
2663feea2f
Add :hint inputs --first as a default binding to gi 2018-05-03 11:37:31 -04:00
Florian Bruhin
68794cc2e2 Revert "Always set FocusOnNavigationEnabled"
This reverts commit fa41af63b6.

See #3661
Fixes #3872
2018-05-03 15:25:41 +02:00
Florian Bruhin
acdf0a1c60 Call _handle_search before leaving the mode 2018-05-03 15:23:45 +02:00
Florian Bruhin
626abd3c83 Fix lint 2018-05-03 15:18:21 +02:00
Florian Bruhin
979b7cfaba Add a stop-gap solution for AssertionError when retrying downloads
See #3847
2018-05-03 14:52:10 +02:00
Florian Bruhin
2b6b4e82a7 Handle event_target() being None
As a stop-gap solution for #3888
2018-05-03 14:45:55 +02:00
Florian Bruhin
6eb8284fe0 Refactor handling search in command.py 2018-05-03 14:04:56 +02:00
Florian Bruhin
49bdcd5a97 Merge remote-tracking branch 'origin/pr/3796' 2018-05-03 13:58:26 +02:00
Florian Bruhin
106e591a36 Refactor matching of Greasemonkey scripts 2018-05-03 13:53:10 +02:00
Florian Bruhin
4932cc4d24 Merge remote-tracking branch 'origin/pr/3804' 2018-05-03 13:33:08 +02:00
Jimmy
19554ba4a1 Update PyPI api URL.
Flask 1.0 is out, pip made breaking changes, warehouse is a thing, new
requests soon. So
much fun in python world lately.
2018-05-02 23:08:51 +12:00
toofar
d16d9e403a Make HTTPClient follow redirects by default.
Closes #3875

The autoupdator, which uses `qutebrowser.misc.httpclient` has been failing recently because the URL that it hits to check version information is now serving a 301 moved permanently. By default QNetworkRequest doesn't follow redirects so it was getting back a (non-json, despite the request) body pointing to the new location, instead or version information. This changes fixes that by changing HTTPClient to use a QNetworkRequest subclass which follows redirects by default.

It lookes like HTTPClient is currently only used in autoupdate.py, version.py, and crashdialog.py so I don't expect any breakage.

5.6-5.8 Only had a boolean setting available which allows redirects, but not from the https scheme to http, 5.9 introduces a more nuanced setting. I have tested locally on 5.7.1 and 5.10.
2018-05-02 23:08:51 +12:00
Joakim Särehag
199eac2db8 window.print() support for WebEngine 2018-04-24 14:05:53 +02:00
Florian Bruhin
fa41af63b6 Always set FocusOnNavigationEnabled
This fixes some focus issues after Qt 5.11 changes. There might be better ways
to solve them, but for now, this will work.

See https://codereview.qt-project.org/#/c/221408/10 and #3661:
https://github.com/qutebrowser/qutebrowser/issues/3661#issuecomment-375969315

Might also negatively affect #3834 as it essentially reintroduces QTBUG-52999 on
any Qt version: https://bugreports.qt.io/browse/QTBUG-52999

Might be reverted at a later date, but for now, I want an easy way to make tests
work on Qt 5.11 to spot further issues.
2018-04-23 16:57:10 +02:00
Florian Bruhin
bc9a8dd63f Handle focusProxy being None
This fixes running with Qt 5.11

See https://codereview.qt-project.org/#/c/221408/10 and #3661:
https://github.com/qutebrowser/qutebrowser/issues/3661#issuecomment-375969315
2018-04-23 16:52:53 +02:00
Florian Bruhin
6640768860 Enable libGL workaround on any system where it's available
Fixes #3772
2018-04-23 11:20:56 +02:00
Michal Siedlaczek
c94ea5f8d4 Merge remote-tracking branch 'upstream/master' into filter-dict-names
Merging to investigate failed tests that seem unrelated to the PR.
2018-04-21 13:29:18 -04:00
Jay Kamat
1d2dd5bf55
Use CommandDispatcher directly for / searches 2018-04-19 21:16:33 -04:00
rr-
537aa22d64 Change clipboard mocking 2018-04-18 11:00:05 +02:00
Jay Kamat
cbb246fd0b
Update tests for new implementation 2018-04-16 23:28:32 -04:00
Jay Kamat
646e92707a
Call search command directly instead of using arguments 2018-04-16 23:15:56 -04:00
Florian Bruhin
4a93389356 Merge remote-tracking branch 'origin/pr/3813' 2018-04-16 17:04:53 +02:00
rr-
563d9bd097 Fix crash in non-rapid link yanking 2018-04-16 08:52:06 +02:00
Jimmy
c5334fb683 Greasemonkey: use UrlPatterns for match directives
The greasemonkey `@match` directive is used to match urls against
chromium url patterns (as opposed to `@include` which treats its
argument as a glob expression). I was using fnmatch for both here
because I am lazy and knew someone else was going to implement chromium
url patterns for me eventually. Now it is done and I should switch to
using them instead. The most common failing case that this will fix is
something matching on `*://*.domain.com/*` because it wouldn't match
the url with no subdomain.

This codepath is only used on webengine 5.7.1 and webkit backends.
2018-04-14 10:31:20 +12:00
Jay Kamat
0829511221
Merge pull request #3803 from toofar/fix/greasemonkey_includes_fallback
Greasemonkey: fix default include value
2018-04-13 18:26:46 -04:00
Jay Kamat
3f9099613b
Merge pull request #3807 from slackhead/tabs.mute_messages
Add option to mute the Last Tab/First Tab messages when tabs.wrap is false
2018-04-13 12:11:45 -04:00
rr-
d705e600e2 Simplify num in hinting to first_run 2018-04-13 11:03:39 +02:00
Jay Kamat
77fa0730c8
Merge pull request #3802 from jgkamat/jay/tab-take-completion
Fix win_id 0 always being included in :tab-take completion
2018-04-10 16:24:48 -04:00
rr-
46e4aeb3e9 Don't hardcode newline 2018-04-10 08:45:23 +02:00
rr-
945bc44550 Support rapid hinting mode in yanking 2018-04-09 17:20:35 +02:00
Slackhead
62aa9bdbb3 Added debug() logging for next/prev-tab and test scenarios 2018-04-09 02:03:02 +01:00
Slackhead
b7964d9baf Remove first/last tab messages 2018-04-08 10:31:12 +01:00
Jay Kamat
76dbfa7305
Allow searching for double semicolons
Possibly breaks scripts using :search with ;; to split commands. A
workaround is to put the :search command at the end.
2018-04-05 17:20:50 -04:00
Jay Kamat
d0d5ad2eda
Stop read timer when download is cancelled 2018-04-04 01:17:37 -04:00
Slackhead
39c08cb582 Add option to mute the Last Tab/First Tab messages when tabs.wrap is false 2018-04-03 16:27:04 +01:00
Jimmy
164ea98a5b Greasemonkey: fix default include value
Greasemonkey scripts are supposed to default to running on all pages.
@jgkamat and @nemanjan00 repurted some script not running on all pages
unless they either removed (or broke) the metadata block or added an
include directive. Indeed I had a logic error when it only defaulted to
being included on all pages when no metadata block at all was included.
Whoops.
2018-04-03 20:11:15 +12:00
Jay Kamat
3b2c0823af
Fix win_id 0 always being included in :tab-take completion 2018-04-02 20:34:34 -04:00
Jay Kamat
423192e9c9
Join text arguments for :search 2018-04-01 21:00:02 -04:00
Jimmy
1c0616f3ec Greasemonkey: fix early addstyle with fast sites.
nemanjan00 reported this script not having any effect da850e49cc/duckduckgo-deepdark.user.js

It turns out that the previous implementation of GM_addStyle was relying
on `document.onreadystatechange` when the script ran early enough that
there was no `head` element. That event wasn't getting fired for the
main frame of duckduckgo.com for whatever reason. Maybe using
`DOMContentLoaded` or something would have worked but I just copied the
fallback in the above linked script which seems to work just fine.
2018-04-01 12:38:48 +12:00
Ryan Roden-Corrent
707fc1176d
Regen completion if args change.
Allow completion functions to react dynamically to args as the user
inputs them. This allows config-cycle to filter out values that were
already provided.

Args provided after the maxsplit do not cause the completion to regen.
For example, successive words typed after `:open` just set the filter
pattern and do not spuriously regenerate the completion model.
2018-03-31 11:45:50 -04:00
Jay Kamat
3d5d679561
Add basic implementation for clicking first hinted element 2018-03-30 15:03:08 -04:00
Florian Bruhin
d438aa15fa Simplify setting _qute_script_id 2018-03-30 11:48:06 +02:00
Jay Kamat
7f5a79cdfd
Escape strings with string_escape rather than tojson 2018-03-30 01:40:49 -04:00