Age | Commit message (Collapse) | Author |
|
Closes #7814
|
|
|
|
|
|
|
|
|
|
See #7646
|
|
Makes the lambdas more flexible, e.g. mapping a single key to a different flag depending on Chromium version. Ended up being unneeded for reading from canvas flag, but still useful.
|
|
Implemented as a separate setting in Chromium, but exposed to qutebrowser users
as a value for `policy.images`, as it's a simple toggle that does not have any
effect when `policy.images` is not set to `smart` anyways.
To support this, the _Settings.mapping value now supports None values,
which leads to _Setting.chromium_tuple to return None, which means that
no switch is added in this case.
See #7646
|
|
Closes #7929
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Given that the two branches share rather little, it seems simpler to separate the two tests. Also use monkeypatch, since we don't use any of unittest.mock's complexity
|
|
|
|
This was fixed up in https://github.com/qutebrowser/qutebrowser/pull/8006
after a mypy update caused us to examine the typing.AnyStr thing a bit more.
But both overloads got set to have a `str` return type, so the possible
bytes return type got lost. Mypy didn't pick that up because `binary=True` is
only used in `qutebrowser/browser/webkit/cookies.py` which probably isn't
being type checked.
I had to remove the default from the binary arg of the bytes version (the ` =
...` bit) because if both overloads have the kwarg as optional mypy doesn't
know which to match a call with just one positional argument against. Eg
`savefile_open('some_file')` would match both.
I checked with reveal_type:
diff --git i/qutebrowser/utils/qtutils.py w/qutebrowser/utils/qtutils.py
index 89175ca4ee60..5b86e441a1bc 100644
--- i/qutebrowser/utils/qtutils.py
+++ w/qutebrowser/utils/qtutils.py
@@ -290,6 +290,20 @@ def savefile_open(
raise QtOSError(f, msg="Commit failed!")
+def test_savefile_types() -> None:
+ from typing_extensions import reveal_type
+
+ maybe_str_default = savefile_open("/tmp/string_file")
+ # note: Revealed type is "contextlib._GeneratorContextManager[typing.IO[builtins.str]]"
+ reveal_type(maybe_str_default)
+ maybe_str_explicit = savefile_open("/tmp/string_file", binary=False)
+ # note: Revealed type is "contextlib._GeneratorContextManager[typing.IO[builtins.str]]"
+ reveal_type(maybe_str_explicit)
+ maybe_bytes = savefile_open("/tmp/bytes_file", binary=True)
+ # note: Revealed type is "contextlib._GeneratorContextManager[typing.IO[builtins.bytes]]"
+ reveal_type(maybe_bytes)
+
+
def qcolor_to_qsscolor(c: QColor) -> str:
"""Convert a QColor to a string that can be used in a QStyleSheet."""
ensure_valid(c)
|
|
This is just to get the CI to re-trigger.
Apparently the checkout action doesn't actually checkout the branch
being proposed for merge but checks out an actual merge commit. So if
you push a PR while main is broken it'll say changes from main are on
your branch. That's a little unexpected.
main is fixed now and I tried re-running the CI jobs from the web UI but
they are still failing with the same errors. Hence this merge of main
just to get a change on the branch. I could have gone and found a typo
to fix instead. I know I've left enough of them around.
ref: https://github.com/actions/checkout/issues/881
|
|
We thought #7489 would be fixed on chrome 112 but it appears to still be
an issue. As discussed on the issue, it's not clear how many workflows
would be affected by accelerated 2d canvas and we don't have enough data
to detect the affected graphics configurations. So lets just disable
accelerated 2d canvas by default and users who want it turned on can do
so via the setting.
If some major use case pops up to enable this by default where possible
we can revisit and think of more nuanced feature detection.
I've kept the handling of callable values of `_WEBENGINE_SETTINGS`
because I don't like have to have something like
`--disable-accelerated-2d-canvas` written in code twice. The setting
above this one could probably be changed to use it too.
|
|
read back the manifest inside the context manager so we can find the
work dir.
|
|
|
|
|
|
Makes things easier if we get build/ right with the return value
|
|
|
|
pdfjs.get_pdf_basename() returned None, causing in a TypeError. Instead of
throwing mocker.patch at it, fix the underlying issue.
Given we made the same mistake in three places:
- :version
- test_real_file for PDF.js
- is_available() in pdfjs.py (calls the function but doesn't use the result, so
is a nop now, even if PDF.js wasn't found)
...evidently we need to change the API so it still raises an exception if no
PDF.js is available.
Amends 0144ae3576aaecde295d40e22d636f04240d6761.
|
|
html.escape is not needed after latest toofar changes
|
|
Otherwise, doing :restart fails because it tries to copy quirk dir to quirk dir.
QtWebEngine reads the env var in resourcePath() in
src/core/web_engine_library_info.cpp. That only seems to be called from
WebEngineLibraryInfo::getPath(), and that in turn gets called from
ResourceBundle::LoadCommonResources() in src/core/resource_bundle_qt.cpp.
Finally, that only seems to be called during Chromium initialization, so it
seems alright for us to unset this as soon as we initialized the first profile.
It also seems to work fine in my testing on Google Meet, and indeed fixes
:restart.
|
|
Update dependencies
|
|
|
|
Now we aren't using it for the patching we don't need it in this function.
Move the `get_pdfjs_basename()` call into `is_available()` too since having to
call two methods to check everything is there sounds like a pain.
|
|
We are setting window.Response to undefined to cause certain versions of
pdf.js to detect that fetch() isn't available and to fall back to XHRs. In
more recent versions of pdf.js the HTML string we were matching against has
changed, it has a 'type="module"' attribute now, so we need to change the
pattern we match against.
I don't think it matters where we put this mocking though, so I've just put it
after '<head>', which should hopefully be less fragile than matching against a
'<script>' element.
Note that this workaround isn't even relevant for the latest versions of
pdf.js (4+). It doesn't seem to use a check on `window.Response` as part of
fetch feature detection anymore (instead it uses fetch() for https? urls and
XHR otherwise). But I figured it was better to have the workaround applying
consistently, and not having an effect, vs having the workaround silently fail
to apply. Don't have a strong opinion on it though.
The other way to fix this would have been something like:
attrs = ""
if pdfjs_name.endswith(".mjs"):
attrs = ' type="module"'
pdfjs_script = f'<script src="../build/{html.escape(pdfjs_name)}"{attrs}></script>'
|
|
Now that pdf.js could be shipped with either js or mjs file extensions we
shouldn't hardcode the filename. Call the function for detecting the filename
instead. And make it public.
|
|
On CI now the sandbox test is failing on windows when we pop the header
line with an index error. It looks like the only line present on the
page is "Sandbox Status". It was working on CI the other day! Grrr
Hopefully it's a timing issue and the JS just hasn't finished running
yet? Not sure if just loading it again is the most reliable. Ideally we
would be listening for some event...
Pretty low effort but if this makes the test stop being flaky and we
don't have to look at it again that's fine with me.
|
|
|
|
|
|
See https://bugreports.qt.io/browse/QTBUG-112017 and #5390
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useful for tools showing coverage info in e.g. your editor
|
|
|
|
|
|
|
|
|
|
|