Commit Graph

25196 Commits

Author SHA1 Message Date
toofar c5fa5a0dc9 lint: Add misc check for QTimer initialization
Since we added some sanity checking in usertypes.Timer() around
QTBUG-124496 it would be convenient if there was a reminder for future
timer users to use our Timer object instead. Here's one!

It's looking for QTimer initialisations, we are still allowing
QTimer.singleShot(), although that probably can hit the same issue.

It uses an end-of-line anchor in the regex so you can put a comment (any
comment) on the end of the line to ignore the check.
2024-05-25 09:34:01 +12:00
Florian Bruhin 38abfdb8a0 check more timers 2024-05-25 09:34:01 +12:00
Florian Bruhin 52346a1910 Check all timers for early triggering 2024-05-25 09:34:01 +12:00
Florian Bruhin 38053466fd Ignore timeout 2024-05-25 09:34:01 +12:00
Florian Bruhin 00c56456be back to normal ipc impl 2024-05-25 09:34:01 +12:00
Florian Bruhin 5b84600fa6 logging 2024-05-25 09:34:01 +12:00
Florian Bruhin 48b27a356c timestamps 2024-05-25 09:34:01 +12:00
Florian Bruhin ef0517da69 Use a separate IPCConnection class 2024-05-25 09:34:01 +12:00
Florian Bruhin 4fadca2ae7 tests: Make ssl message matching fuzzier
Windows seems to struggle with the dash
2024-05-25 09:34:01 +12:00
Florian Bruhin 7144e72116 Use a proper increasing id for ipc logging 2024-05-25 09:34:01 +12:00
Florian Bruhin 6d99dff10b Merge branch 'update-dependencies' 2024-05-24 21:53:08 +02:00
Florian Bruhin a2983553bb Merge branch 'feat/pyqt67_enablement' 2024-05-24 21:51:34 +02:00
Florian Bruhin 72d7e2327b Update for new pylint/astroid releases
- Add a couple new "raise utils.Unreachable" to avoid
  possibly-used-before-assignment issues.
- Simplify an "if" for the same reason
- Remove an unneeded "return"
- Use "NoReturn" to prepare for pylint knowing about it in the future:
  https://github.com/pylint-dev/pylint/issues/9674
- Add some ignores for used-before-assignment false-positives
- Ignore new undefined-variable messages for Qt wrapers
- Ignore a new no-member warning for KeySequence:
  https://github.com/pylint-dev/astroid/issues/2448#issuecomment-2130124755
2024-05-24 21:46:04 +02:00
Florian Bruhin 470ec752e1 Add Riverbank Computing as extra index for PyQt requirements
Easier fix instead of 6c4be8ef03.
Seems to get picked up just fine, and shouldn't hurt when it's not needed, as we
don't use --pre. Thus, no development releases should be installed.
2024-05-24 17:08:56 +02:00
Florian Bruhin 0f51171141 Revert "Try getting PyQt 6.7 from Riverbank server"
This reverts commit 6c4be8ef03.

Possibly easier solution in next commit.
2024-05-24 17:08:56 +02:00
Florian Bruhin 8b44c26146 Try getting PyQt 6.7 from Riverbank server
See https://www.riverbankcomputing.com/pipermail/pyqt/2024-April/045832.html and https://github.com/pypi/support/issues/3949
2024-05-24 17:08:56 +02:00
toofar 3f1842b729 Update requirements and CI for PyQt6.7
6.7 is released now, some distros are already shipping it!

This commit:
1. adds a new 6.7 requirements file (the plain 6 one has already been
   updated by the bot)
2. adds a new tox env referring to the new requirements file
3. updates the mac and windows installer jobs to run with pyqt67 with the
   assumption we'll be including that in our next release
4. adds two new CI environments for 6.7, one each for python 3.11 and 3.12
   (3.12 only came out like 6 months ago)
5. updates a couple of references to the py37 tox env that looked like they
   were missed, 3.7 support was dropped in 93c7fdd
6. updates various ubuntu containers to the latest LTS instead of the previous
   related one - this is quite unrelated to this change but I thought I would
   give it a go, no need to use the old one unless we are specifically testing
   on it?
   - linters - they use tox but probably use system libraries
   - these all run in nested containers anyway, should be fully isolated
   - codeql - eh, uses a third party action, check the docs if it fails
   - irc - as above
2024-05-24 17:08:56 +02:00
Florian Bruhin f72b862da5 tests: Re-add pytest-benchmark warning ignore
This was fixed but never released...
2024-05-24 17:07:52 +02:00
Florian Bruhin ecf0fd225a Increase YAML warning deadline with --with-pydebug
This makes things significantly slower
2024-05-24 16:57:20 +02:00
Tobias Naumann 12ebc843d1 Move idna_encode function calls out of loops whenever possible to avoid repeated computations 2024-05-24 00:16:04 +02:00
Florian Bruhin 6339eacda4 py313: Upgrade typing-extensions 2024-05-23 14:52:10 +02:00
Florian Bruhin 2d89a6f4c0 tox: Add py313 2024-05-23 08:35:12 +02:00
Florian Bruhin f1c18360a2 tests: Remove warning ignores for fixed issues 2024-05-23 08:12:30 +02:00
toofar c0d883849d
Merge pull request #8200 from qutebrowser/feat/7901_handle_no_selectionmodel_on_clear_selection
Handle no selectionmodel on clear selection
2024-05-21 07:43:56 +12:00
qutebrowser bot 1d8a2acf77 Update dependencies 2024-05-20 04:21:17 +00:00
toofar 04b0d84bda update changelog for None selection model fix 2024-05-19 14:34:23 +12:00
toofar 117cb15b8d Handle selection model being None when clearing selection
Change `CompletionView.on_clear_completion_selection()` to call the Qt
selection model getter, instead of our one. Since it can be called when the
selection model has already been cleared and our one asserts that there
is a selection model to return.

Back in the distant past there was a change to handle the completion widget's
selection model being None when the `on_clear_completion_selection()` slot was
called: https://github.com/qutebrowser/qutebrowser/commit/88b522fa167e2f97b

More recently a common getter for the selection model was added so we could
have a single place to apply type narrowing to the returned object from the Qt
getter (the type hints had been updated to be wrapped in `Optional`): https://github.com/qutebrowser/qutebrowser/commit/92dea988c01e745#diff-1559d42e246323bea35fa064d54d48c990999aaf4c732b09ccd448f994da74cf

It seems this is one place where it does, and already did, handle that
optional. So it didn't need to change to use the new getter. This is called
from the `Command.on_mode_left` signal, not sure why the selection model is
None here. Perhaps it already gets cleared by the effects of the `hide_cmd`
signal that gets fired earlier, or perhaps even from the `self.hide()` on the
line before. Anyway, this was working for several years and seems harmless
enough.
2024-05-19 14:29:31 +12:00
Florian Bruhin 9bf0393923 tests: Don't make QSslSocket error fail tests
Bleeding environment fails tests/unit/browser/webkit/test_certificateerror.py on Qt 5, maybe due to OpenSSL 3.x
2024-05-16 09:31:42 +02:00
Florian Bruhin a7a7c434e2 Fix handling of missing QtWebEngine resources
I was getting crash reports from someone about this. Not sure what's going wrong
there (hence the additional information in the exception).

What's clear however is that we're raising ParseError, but only handling that
when actually parsing. The code calling copy_/_find_webengine_resources only
handles OSError. So let's raise a FileNotFoundError instead.
2024-05-10 18:41:50 +02:00
Florian Bruhin 81de20d78b
Merge pull request #8195 from vEnhance/patch-1
Fix some spelling errors
2024-05-10 12:50:54 +02:00
Evan Chen 350f94222d
reading comprehension failure
more coffee required
2024-05-09 13:35:13 -04:00
Evan Chen 310c865f29
Fix some spelling errors 2024-05-09 10:58:04 -04:00
Florian Bruhin dbcfab4fb9
Merge pull request #8189 from qutebrowser/update-dependencies
Update dependencies
2024-05-06 07:47:47 +02:00
qutebrowser bot 17ff150dfd Update dependencies 2024-05-06 04:20:35 +00:00
Florian Bruhin 99029144b5
Merge pull request #8182 from qutebrowser/dynamic-dark-mode
Dynamic dark mode
2024-05-05 20:37:01 +02:00
Florian Bruhin ef62208ce9
Merge pull request #8181 from qutebrowser/fill-in-security-version
Improve Chromium (security) version output
2024-05-05 20:36:09 +02:00
Florian Bruhin edba6f18cb Update changelog 2024-05-01 00:30:41 +02:00
Florian Bruhin 9c901b2101 Add more dark mode logic unit tests 2024-04-30 23:31:58 +02:00
Florian Bruhin 9320c8f2e5 Fix tests/lint 2024-04-30 23:31:58 +02:00
Florian Bruhin dfcfc686ce Support setting dark mode at runtime and with URL patterns
See #3636, #5542, #7743
2024-04-30 23:31:58 +02:00
Florian Bruhin 2edfd459a4 Infer Chromium security version when API is unavailable
We already had all this information in a comment anyways.
I made it machine-readable using:

    s/#\s+(\d*)\.(\d*)\.(\d*): Security fixes up to ([^ ]*)\s+\((.*)\)/utils.VersionNumber(\1, \2, \3): (_BASES[XX], '\4'),  # \5

plus some manual post-processing.

Thanks to that, we can now get the security version from that data even on
QtWebEngine < 6.3, if that information is known. When we fall back to a base
version (e.g. 6.7.99 -> 6.7), we make sure to not pretend that we have the .0
state of things, though.

Finally, we cross-check the information against the current Qt version if we
have the API, which mostly ensures the data is accurate for human readers.

See #7187 and #8139.
2024-04-30 23:31:25 +02:00
Florian Bruhin a85c3e2712 version: Update security patch version comments
Mostly based on CHROMIUM_VERSION in QtWebEngine
and chromereleases.googleblog.com.
2024-04-30 23:31:25 +02:00
Florian Bruhin 6419cf282b Move pastebin button up for version info 2024-04-30 23:31:25 +02:00
Florian Bruhin 40f6193cc7 Split QtWebEngine version across multiple lines
More readable now that we have more information in it.

Also always show the source, now that we have the space for it, and "UA" isn't
the obvious default anymore anyways.
2024-04-30 23:31:25 +02:00
Florian Bruhin 5152296f7f
Merge pull request #8179 from qutebrowser/update-dependencies
Update dependencies
2024-04-30 23:06:30 +02:00
Florian Bruhin a8f4feabb7 Exit command mode in editor tests
Similarly to 24d01ad257, failing Qt 5.15 tests
showed some evidence of us being stuck in command mode in the next test file
(hints.feature). On the first test there ("Scenario: Using :hint-follow outside
of hint mode (issue 1105)"):

    17:38:51.073 ERROR    message    message:error:63 hint-follow: This command
    is only allowed in hint mode, not command.

but:

    end2end.fixtures.testprocess.WaitForTimeout: Timed out after 15000ms waiting
    for {'category': 'message', 'loglevel': 40, 'message': 'hint-follow: This
    command is only allowed in hint mode, not normal.'}.

I agree with what has been said: This should never happen, because we restart
the qutebrowser process between test files. I did some of the mentioned "more
examination" but also don't have an explanation.

To avoid more flaky tests, let's roll with another bandaid solution.
2024-04-30 20:34:50 +02:00
Florian Bruhin 3d96fc2656 Make qt.machinery.Unavailable inherit ModuleNotFoundError
With pytest 8.2, pytest.importorskip(...) now only considers ModuleNotFoundError
rather than all ImportErrors, and warns otherwise:
https://github.com/pytest-dev/pytest/pull/12220

While we could override this via

    pytest.importorskip(..., exc_type=machinery.Unavailable)

this is a simpler solution, and it also makes more sense semantically:

We only raise Unavailable when an import is being done that would otherwise
result in a ModuleNotFoundError anyways (e.g. trying to import QtWebKit on Qt
6).
2024-04-30 19:24:25 +02:00
Florian Bruhin 0fec3c7fb2 Update changelog 2024-04-30 17:15:22 +02:00
Florian Bruhin b0002ac71f Preload broken qutebrowser logo resource
When qutebrowser is running but its installation has been deleted/moved, it
fails in somewhat mysterious but predictable ways. This is e.g. the case
currently, when people upgrade their Archlinux packages and upgrade from Python
3.11 to 3.12. When doing that with qutebrowser open, on the next page load, it
will:

- Have a crashed renderer process, because (assumingly) the process executable
  is gone on disk.
- Which then causes us trying to render an error page, but that fails due to
  broken_qutebrowser_logo.png being gone from disk.
- The FileNotFoundError then causes jinja2 to import jinja2.debug at runtime,
  but that *also* fails because the jinja2 package is gone.

We work around this by loading the PNG into RAM early, and then using the cached
version instead. This amends b4a2352833 which did
the same with HTML/JS resources, but never for this PNG, which (looking at crash
logs) seems to be a somewhat common breakage.

Alternatives I've considered:

- Catching the FileNotFoundError and not showing an error page at all.
- Generating a PNG with an explanatory text via QPainter and returning that.

However, with the renderer process crash happening in the first place for
unknown reasons, it's unclear if the error page ever gets actually displayed...
Let's roll with this for now, and if this causes a repeating renderer process
crash, fix that separately (also see #5108).
2024-04-30 17:03:11 +02:00
Florian Bruhin 26ef6bffd2 tabbedbrowser: Clean up QTBUG 91715 workaround
By returning early, we can move the logic up a bit and handle the normal case after.
2024-04-30 15:26:04 +02:00