Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8ae5e3d

Browse files
committed
version: Use correct profile for extension list
See#8785
1 parent4f40a8b commit8ae5e3d

File tree

4 files changed

+46
-24
lines changed

4 files changed

+46
-24
lines changed

‎doc/changelog.asciidoc‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Fixed
2828

2929
- The version info now includes the Wayland compositor name if wayland-client is
3030
available under a different name than`libwayland-client.so` (#8771).
31+
- The list of Chromium extensions in`--version` /`:version` now uses the
32+
correct Chromium data profile, also fixing a crash with Qt 6.10.1 (#8785).
3133
3234
[[v3.6.1]]
3335
v3.6.1 (2025-11-03)

‎qutebrowser/browser/webengine/webenginesettings.py‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,14 +458,18 @@ def _clear_webengine_permissions_json():
458458
)
459459

460460

461+
defdefault_qt_profile()->QWebEngineProfile:
462+
"""Get the default profile from Qt."""
463+
ifmachinery.IS_QT6:
464+
returnQWebEngineProfile("Default")
465+
else:
466+
returnQWebEngineProfile.defaultProfile()
467+
468+
461469
def_init_default_profile():
462470
"""Init the default QWebEngineProfile."""
463471
globaldefault_profile
464-
465-
ifmachinery.IS_QT6:
466-
default_profile=QWebEngineProfile("Default")
467-
else:
468-
default_profile=QWebEngineProfile.defaultProfile()
472+
default_profile=default_qt_profile()
469473
assertnotdefault_profile.isOffTheRecord()
470474

471475
assertparsed_user_agentisNone# avoid earlier profile initialization

‎qutebrowser/utils/version.py‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -931,12 +931,18 @@ def _webengine_extensions() -> Sequence[str]:
931931
lines:list[str]= []
932932
if (
933933
objects.backend==usertypes.Backend.QtWebEngine
934-
and"avoid-chromium-init"notinobjects.debug_flags
935934
andmachinery.IS_QT6# mypy; TODO early return once Qt 5 is dropped
936935
):
937-
fromqutebrowser.qt.webenginecoreimportQWebEngineProfile
938-
profile=QWebEngineProfile.defaultProfile()
939-
assertprofileisnotNone# mypy
936+
fromqutebrowser.browser.webengineimportwebenginesettings
937+
lines.append("WebExtensions:")
938+
939+
ifwebenginesettings.default_profile:
940+
profile=webenginesettings.default_profile
941+
elif"avoid-chromium-init"inobjects.debug_flags:
942+
lines[0]+=" unknown (avoiding init)"
943+
returnlines
944+
else:
945+
profile=webenginesettings.default_qt_profile()
940946

941947
try:
942948
ext_manager=profile.extensionManager()
@@ -945,7 +951,6 @@ def _webengine_extensions() -> Sequence[str]:
945951
return []
946952
assertext_managerisnotNone# mypy
947953

948-
lines.append("WebExtensions:")
949954
ifnotext_manager.extensions():
950955
lines[0]+=" none"
951956

‎tests/unit/utils/test_version.py‎

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,11 +1449,9 @@ def test_version_info(params, stubs, monkeypatch, config_stub):
14491449
monkeypatch.delattr(version,'qtutils.qWebKitVersion',raising=False)
14501450
ifmachinery.IS_QT6:
14511451
monkeypatch.setattr(
1452-
QWebEngineProfile,
1453-
"defaultProfile",
1454-
lambda:FakeExtensionProfile(
1455-
FakeExtensionManager([FakeExtensionInfo("ext1")])
1456-
),
1452+
webenginesettings,
1453+
"default_profile",
1454+
FakeExtensionProfile(FakeExtensionManager([FakeExtensionInfo("ext1")])),
14571455
)
14581456
substitutions['webextensions']= (
14591457
"\n"
@@ -1592,20 +1590,35 @@ def test_str_gles(self):
15921590
classTestWebEngineExtensions:
15931591

15941592
deftest_qtwebkit(self,monkeypatch:pytest.MonkeyPatch)->None:
1593+
assertwebenginesettings.default_profileisNone# -> default_qt_profile() used
15951594
monkeypatch.setattr(version.objects,"backend",usertypes.Backend.QtWebKit)
1596-
monkeypatch.setattr(QWebEngineProfile,"defaultProfile",lambda:1/0)
1595+
monkeypatch.setattr(webenginesettings,"default_qt_profile",lambda:1/0)
15971596
assertnotversion._webengine_extensions()
15981597

15991598
deftest_avoid_chromium_init(self,monkeypatch:pytest.MonkeyPatch)->None:
1599+
assertwebenginesettings.default_profileisNone# -> default_qt_profile() used
16001600
monkeypatch.setattr(version.objects,"backend",usertypes.Backend.QtWebEngine)
16011601
monkeypatch.setattr(objects,"debug_flags", {"avoid-chromium-init"})
1602-
monkeypatch.setattr(QWebEngineProfile,"defaultProfile",lambda:1/0)
1603-
assertnotversion._webengine_extensions()
1602+
monkeypatch.setattr(webenginesettings,"default_qt_profile",lambda:1/0)
1603+
assertversion._webengine_extensions()== [
1604+
"WebExtensions: unknown (avoiding init)"
1605+
]
16041606

16051607
deftest_no_extension_manager(self,monkeypatch:pytest.MonkeyPatch)->None:
1606-
monkeypatch.setattr(QWebEngineProfile,"defaultProfile",object)
1608+
assertwebenginesettings.default_profileisNone# -> default_qt_profile() used
1609+
monkeypatch.setattr(webenginesettings,"default_qt_profile",object)
16071610
assertnotversion._webengine_extensions()
16081611

1612+
@pytest.mark.parametrize("avoid_init", [True,False])
1613+
deftest_preexisting_profile(self,monkeypatch:pytest.MonkeyPatch,avoid_init:bool)->None:
1614+
"""Test that we use the pre-existing profile if available."""
1615+
monkeypatch.setattr(webenginesettings,"default_profile",FakeExtensionProfile(FakeExtensionManager([])))
1616+
ifavoid_init:
1617+
monkeypatch.setattr(objects,"debug_flags", {"avoid-chromium-init"})
1618+
1619+
result=version._webengine_extensions()
1620+
assertresult== ["WebExtensions: none"]
1621+
16091622
@pytest.mark.parametrize(
16101623
"extensions, expected",
16111624
[
@@ -1666,11 +1679,9 @@ def test_extensions(
16661679
expected:list[str],
16671680
)->None:
16681681
monkeypatch.setattr(
1669-
QWebEngineProfile,
1670-
"defaultProfile",
1671-
lambda:FakeExtensionProfile(
1672-
FakeExtensionManager(extensions)
1673-
),
1682+
webenginesettings,
1683+
"default_profile",
1684+
FakeExtensionProfile(FakeExtensionManager(extensions)),
16741685
)
16751686
assertversion._webengine_extensions()==expected
16761687

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp