Commit Graph

15942 Commits

Author SHA1 Message Date
Florian Bruhin
e895ee8bdc Update changelog 2018-05-22 12:28:55 +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
db1287cb82 Update changelog 2018-05-22 09:40:54 +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
bc37af7c95 Document QtWebEngine internals
[ci skip]
2018-05-22 07:42:23 +02:00
Jay Kamat
3bf02aa62f
Clarify install command for Ubuntu 17.04 2018-05-21 17:29:23 -07:00
Florian Bruhin
ae06c2cdb7
Merge pull request #3938 from qutebrowser/pyup-scheduled-update-2018-05-21
Scheduled weekly dependency update for week 20
2018-05-21 21:31:03 +02:00
Florian Bruhin
89f019b710 Remove unneeded "except ... as e:" assignments 2018-05-21 20:03:18 +02:00
pyup-bot
228c86c799 Update virtualenv from 15.2.0 to 16.0.0 2018-05-21 18:53:26 +02:00
pyup-bot
c551e29f4c Update pytest-qt from 2.3.1 to 2.3.2 2018-05-21 18:53:25 +02:00
pyup-bot
7596dbdd43 Update pytest-instafail from 0.3.0 to 0.4.0 2018-05-21 18:53:23 +02:00
pyup-bot
616371a3c1 Update hypothesis from 3.56.9 to 3.57.0 2018-05-21 18:53:22 +02:00
pyup-bot
725a133b9a Update cheroot from 6.2.4 to 6.3.1 2018-05-21 18:53:20 +02:00
pyup-bot
f60c42b7fb Update pylint from 1.8.4 to 1.9.1 2018-05-21 18:53:19 +02:00
pyup-bot
9dc9ec3435 Update astroid from 1.6.3 to 1.6.4 2018-05-21 18:53:17 +02:00
pyup-bot
e7a779ef90 Update setuptools from 39.1.0 to 39.2.0 2018-05-21 18:53:16 +02:00
pyup-bot
5ec3f1949a Update pyflakes from 1.6.0 to 2.0.0 2018-05-21 18:53:14 +02:00
pyup-bot
5df4128e8d Update pep8-naming from 0.6.1 to 0.7.0 2018-05-21 18:53:13 +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
749b29e599 tests: Don't pretend to be using webkit if unavailable
Since `objects.backend` was being set to usertypes.Backend.QtWebKit by
default some feature detection code was calling
`version.qWebKitVersion()` which was failing because the import of
`PyQt5.QtWebKit` was failing in version.

This should not change behavior where both backends are available on if
any tests fail because they are expecting their environment to say they
are on webkit when they either aren't actually using any webkit features
or all mocked webkit features then they should probably be changed to
patch `objects.backend` or not depend on it.
2018-05-21 20:59:27 +12:00
Wayne Cheng
9a85796ac3 CR changes 2018-05-20 20:30:24 -04:00
Florian Bruhin
a31542269a Remove old files from MANIFEST.in 2018-05-20 16:12:33 +02:00
Wayne Cheng
36ddf3a328 Code review changes 2018-05-20 05:35:48 -04: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
6573a4d616 Tell pylint to shut its fat mouth.
I just want to return something I can refer to the attributes of via dot
syntax without having to pointlessly write the names both when I declare
the data class and when I assign the variables.

Such a stupid warning.
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
c7a9792b67 Greasemonkey: Add test for window scoping refinements.
Adds a test to codify what I think greasemonkey scripts expect from
their scope chains. Particularly that they can:

1. access the global `window` object
2. access all of the attributes of the global window object as global
   objects themselves
3. see any changes the page made to the global scope
4. write to attributes of `window` and have those attributes, and changes
   to existing attributes, accessable via global scope
5. do number 4 without breaking the pages expectations, that is what
   `unsafeWindow` is for

There are some other points about greasemonkey scripts' environment that
I believe to be true but am not testing in this change:

* changes a page makes to `window` _after_ a greasemonkey script is
  injected will still be visible to the script if it cares to check and
  it hasn't already shadowed them
* said changes will not overwrite changes that the greasemonkey script
  has made.
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
Wayne Cheng
7130f863cb Create lastpass implementation based off qute-pass code 2018-05-19 15:53:08 -04:00
Sebastian Heinlein
547edb3c4e appdata: install the metainfo using the Makefile
Furthermore add some information about the latest releases
and remove a few trailing whitespaces.
2018-05-19 13:57:26 +02: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
046c0a7ea2 Merge remote-tracking branch 'origin/pr/3914' 2018-05-17 17:53:47 +02:00
Florian Bruhin
d208c48532 Update changelog 2018-05-17 17:53:15 +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
d8569a36f9 Update changelog 2018-05-17 14:24:29 +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
pyup-bot
6784356d9d Update hypothesis from 3.56.5 to 3.56.9 2018-05-14 18:48:20 +02:00
pyup-bot
b0105b0157 Update python-dateutil from 2.7.2 to 2.7.3 2018-05-14 18:48:18 +02:00
pyup-bot
553a91c012 Update python-dateutil from 2.7.2 to 2.7.3 2018-05-14 18:48:17 +02:00
pyup-bot
b0f83615b6 Update wheel from 0.31.0 to 0.31.1 2018-05-14 18:48:15 +02:00
pyup-bot
0c674c7110 Update flake8-builtins from 1.3.1 to 1.4.1 2018-05-14 18:48:14 +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
0642695c7d
Update docs 2018-05-09 18:33:52 -07:00