Commit Graph

6422 Commits

Author SHA1 Message Date
Florian Bruhin 87f58a30b7 Fix half-finished test
(cherry picked from commit 40125ca73b)
2022-08-26 22:32:10 +02:00
Florian Bruhin ee4d6e0396 sql: Add *all* primary sqlite result codes
For three reasons:

- There are only 31 of them, and we don't really expect any more to
  turn up (last happened in 2013, and we have a test for it happening)
- It makes for nicer debug output
- It always felt strange to only have a small subset in the enum
2022-08-26 19:11:15 +02:00
Florian Bruhin 6ffc5174ea sql: Handle sqlite extended error codes
Qt 6.1 switched to using extended sqlite error codes:
https://codereview.qt-project.org/c/qt/qtbase/+/329472

This is neat because it gives us more granularity for errors, but it
also means that we now need to account for that by masking the error
codes accordingly for checking their category.

See unhandled I/O error here:
https://crashes.qutebrowser.org/view/d9b26c2f
2022-08-26 19:08:49 +02:00
Florian Bruhin 815374c6b6 js: Handle stylesheets in cross-origin frames gracefully
Otherwise the exception gets shown since the recent message change.

(cherry picked from commit 73e30e4738)
2022-08-23 20:10:57 +02:00
Florian Bruhin 496c14bc9e quteprocess: Add --qute-delay-start
Allows for some rudimentary debugging of subprocesses.
2022-08-23 18:31:42 +02:00
Florian Bruhin d31b2e2016 Qt 6.4: Adjust dark mode tests
See #7314 and #6097
2022-08-23 18:31:42 +02:00
Florian Bruhin 68f01b9072 Qt 6.4: Ignore new Chromium cert errors in tests
See #7314
2022-08-23 18:31:42 +02:00
Florian Bruhin 479aa075ac Qt 6.4: elf: More hacks to get version
With Qt 6.4, it looks like the full UA disappeared from the ELF string
table - see previosly: db1382f75c

However, the full Chromium version string is still stored separately,
most likely for qWebEngineChromiumVersion() - so let's go hunt for that.

Note that this code won't be used for most situations, as with an up-to-
date PyQt, we finally have an API to access this information properly.
But it's still useful as a fallback in strange situations like running
an older PyQt against a newer Qt.

See #7314
2022-08-23 18:31:42 +02:00
Florian Bruhin 34db7a1ef4 Qt 6.4: Add --webEngineArgs
See #7314
2022-08-23 18:31:42 +02:00
Florian Bruhin f7753550f2 keyutils: Move public functions to KeyInfo
This avoids the temptation of creating a Qt.Key() manually, which needs
to be checked for ValueError with PyQt 6.2 due to its handling of unknown enum
values.

This is exactly what happened in RegisterKeyParser, which caused such a
ValueError:
https://github.com/qutebrowser/qutebrowser/issues/7047#issuecomment-1163288560

Closes #7047
2022-08-23 18:31:42 +02:00
Florian Bruhin a7e6a3a178 Avoid deprecated QProcess.pid()
processId() got introduced in Qt 5.3

FIXME: pick to master?
2022-08-23 18:31:42 +02:00
Florian Bruhin 05fdb6ca7c Adjust test_notification for Qt 6 2022-08-23 18:31:42 +02:00
Florian Bruhin 76456e6bd9 tests: Ignore another Chromium line 2022-08-23 18:31:42 +02:00
Florian Bruhin 96dfd2bbf9 tests: Disable word wrap for rich text tests
Fixes #7267
2022-08-23 18:31:42 +02:00
Florian Bruhin ed19d7f58b Add --include-hidden for :config-diff
Needed it for debugging, so why not implement it properly.
TODO: Changelog, pick to master?
2022-08-23 18:31:42 +02:00
Florian Bruhin 836221ecaf Update Qt version test 2022-08-23 18:31:42 +02:00
Florian Bruhin 07434241ef Reintroduce skipped tests 2022-08-23 18:31:42 +02:00
Florian Bruhin 769ef6859f Adjust some fixme comments 2022-08-23 18:31:42 +02:00
Florian Bruhin 541d49d08b test that enums match their Qt equivalents
Also changes reloaded -> reload for consistency
(both to Qt and between the names).
2022-08-23 18:31:42 +02:00
Florian Bruhin 344fcb6918 Ignore additional chromium message
See https://github.com/qutebrowser/qutebrowser/runs/6658849317?check_suite_focus=true
2022-08-23 18:31:41 +02:00
Florian Bruhin 46933168fe qt 6: Fix getting importlib PyQtWebEngine versions
Needed for e.g. Windows and PyQt < 6.3.1
2022-08-23 18:31:41 +02:00
Florian Bruhin 3ba56bcc6e old qt: Remove unneeded multimedia key names
Those were added to Qt 5.14:
https://codereview.qt-project.org/c/qt/qtbase/+/278803

TODO: Changelog for different names for "To-do list" and
"Adjust contrast"?
2022-08-23 18:31:41 +02:00
Florian Bruhin ec8eebf996 lint: Fix remaining pylint issues 2022-08-23 18:31:41 +02:00
Florian Bruhin 21d9c9a585 lint: Fix various small flake8 issues 2022-08-23 18:31:41 +02:00
Florian Bruhin 80961cee6b lint: Fix flake8 whitespace issues 2022-08-23 18:31:41 +02:00
Florian Bruhin cf314aeb3a lint: Fix flake8 QtCore imports 2022-08-23 18:31:41 +02:00
Florian Bruhin e658ce6acf lint: Remove unused imports
Via autoflake and git add -p
2022-08-23 18:31:41 +02:00
Florian Bruhin 805e43cf97 WIP: Avoid line-too-long
TODO: Revert once we use black
2022-08-23 18:31:41 +02:00
Florian Bruhin ebdf248e44 WIP: Avoid linter issues with temporary Qt wrappers 2022-08-23 18:31:41 +02:00
Florian Bruhin 218f490484 Warn on QtWebEngine downgrade and Qt 5 -> 6 upgrade 2022-08-23 18:31:41 +02:00
Florian Bruhin 6ed0e1a370 version: Make sure QUTE_QTWEBENGINE_VERSION_OVERRIDE always wins
TODO: Pick to master?

TODO: changelog
2022-08-23 18:31:41 +02:00
Florian Bruhin b5aa728c30 qt6: Use new API to get Chromium/QtWebEngine versions 2022-08-23 18:31:41 +02:00
Florian Bruhin c7ea2f705f tests: Skip broken PDF.js installations
See #7135

TODO: cherry-pick to master?
2022-08-23 18:31:41 +02:00
Florian Bruhin ee7b283afb Fix sandboxing tests on Flatpak
See https://github.com/flathub/org.qutebrowser.qutebrowser/issues/193

TODO: Cherry-pick to master?
2022-08-23 18:31:41 +02:00
Florian Bruhin ef486aa263 Remove unneeded old log ignores 2022-08-23 18:31:41 +02:00
Florian Bruhin e4bc609ff4 Update dark mode tests for Qt 6 and ARM
Thanks to tinywrkb for running them on Flatpak infrastructure!
2022-08-23 18:31:41 +02:00
Florian Bruhin 242ce99fc9 tests: Fix test_from_str_hypothesis for FlagList
TODO: cherry-pick to master
2022-08-23 18:31:41 +02:00
Florian Bruhin 29d1096e8e Adjust test_preferred_colorscheme_with_dark_mode for Qt 6 2022-08-23 18:31:41 +02:00
Florian Bruhin 634cbc2d5f Adjust dark mode tests for Qt 6 2022-08-23 18:31:41 +02:00
Florian Bruhin 81a67a9201 Adjust referrer handling for Qt 6
As suspected in a comment, ReducedReferrerGranularity does not exist anymore
with Chromium 90, and neither does an option for getting the full referrer back:

https://chromium-review.googlesource.com/c/chromium/src/+/2545444
https://bugs.chromium.org/p/chromium/issues/detail?id=1150018
2022-08-23 18:31:41 +02:00
Florian Bruhin 473f048041 downloads: Bump up maximum redirects
TODO: Cherry-pick to master?
TODO: Changelog
2022-08-23 18:31:41 +02:00
Florian Bruhin 59922dfe4e Delete empty files after download errors
It's debatable whether we should keep non-empty files, but surely empty
ones are useless.

TODO: Add changelog entry
TODO: Pick to master?
2022-08-23 18:31:41 +02:00
Florian Bruhin 4812c8e30e Add a test for insecure download redirects
TODO: Pick to master?
TODO: Changelog entry
2022-08-23 18:31:41 +02:00
Florian Bruhin 556d6cbdc2 Let Qt handle QtNetwork redirects
With Qt 6, the default changed to Qt handling network redirects instead of us
doing so manually. This seems like a good thing, so instead of setting the
redirect policy back to QNetworkRequest.RedirectPolicy.ManualRedirectPolicy,
let's just let Qt handle everything.

By default, Qt allows 50 redirects before giving up. That seems a tad much, so
we set it back to our former default.

This change comes with a few changes in behavior:

- Redirects to the same URL now fail (too many redirects) rather than being
  ignored. I'm not sure how the previous behavior was useful. We added it in the
  initial implemetation in 6856c49be9 (later
  refactored a bit in 70e390a2e8) and added a test
  in d13f88f0ac. But it doesn't make sense...

- We use QNetworkRequest.RedirectPolicy.NoLessSafeRedirectPolicy (no HTTPS ->
  HTTP redirects allowed), while the former behavior didn't validate redirects
  at all. Interestingly enough, I can't get Chromium to error out in that case
  for downloads (though I only tried on localhost with a self-signed
  certificate). However, it seems like a reasonable default.
  Test will be added in a follow-up commit.

- Partially downloaded files aren't deleted anymore on a "too many redirect"
  error. This should be solved in a more generic way, will do so in a follow-up
  commit.

TODO: Pick to master?

Fixes #2679.
2022-08-23 18:31:41 +02:00
Florian Bruhin e5d632edf2 tests: Add initial unit tests for browsertab.py 2022-08-23 18:31:41 +02:00
Florian Bruhin 76514547cf qt6 tests: Update ignored messages
On Qt 6.3: 'ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.'
2022-08-23 18:31:41 +02:00
Florian Bruhin 7bc01145cc tests: Update QUrl tests for Qt 6.3
See https://bugreports.qt.io/browse/QTBUG-85371 and
https://bugreports.qt.io/browse/QTBUG-60364
2022-08-23 18:31:41 +02:00
Florian Bruhin 4a799c15e7 Skip urlutils.same_domain tests on Qt 6
We never really use its functionality with QtWebEngine.
2022-08-23 18:31:41 +02:00
Florian Bruhin 995629eec3 Fix qenum_key with invalid flag values 2022-08-23 18:31:41 +02:00
Florian Bruhin b7eb182e74 debug: Use existing qflags_key logic for Qt 6
The existing logic seems to work fine now (with some adjustments) and results in
better output compared to the repr.

Partially reverts 111e0c7f3dcccb4d0ff807854cacb6506a93e1f2.
2022-08-23 18:31:41 +02:00