fix(Browser): Prevent access to Chrome extension messaging API

Meanwhile we don't support Chrome extensions in the embedded browser, prevent access to specific extension messaging APIs that can cause QtWebEngine crashes.

Fix #21122
This commit is contained in:
Noelia
2026-06-10 08:26:32 +02:00
committed by saledjenic
parent b55215e5da
commit 57a2f7572c
3 changed files with 9 additions and 2 deletions
+2 -2
View File
@@ -597,9 +597,9 @@ ifeq ($(REBUILD_UI),true)
endif
ifeq ($(host_os),darwin)
UI_SOURCES := $(shell find -E ui -type f -iregex '.*(qmldir|qml|qrc)$$' -not -iname 'resources.qrc')
UI_SOURCES := $(shell find -E ui -type f -iregex '.*(qmldir|qml|qrc|js)$$' -not -iname 'resources.qrc')
else
UI_SOURCES := $(shell find ui -type f -regextype egrep -iregex '.*(qmldir|qml|qrc)$$' -not -iname 'resources.qrc')
UI_SOURCES := $(shell find ui -type f -regextype egrep -iregex '.*(qmldir|qml|qrc|js)$$' -not -iname 'resources.qrc')
endif
UI_RESOURCES := resources.rcc
@@ -0,0 +1,6 @@
// Status does not implement Chrome extensions. Prevent page access to the
// Chrome extension messaging API from causing crashes in QtWebEngine.
if (window.chrome && window.chrome.runtime) {
window.chrome.runtime.sendMessage = undefined;
window.chrome.runtime.connect = undefined;
}
@@ -16,6 +16,7 @@ QtObject {
property string httpUserAgent: ""
readonly property var scriptPaths: root.featureEnabled ? [
{ path: Qt.resolvedUrl("../js/webengine_runtime_guard.js"), runOnSubFrames: true },
{ path: Qt.resolvedUrl("../js/qwebchannel.js"), runOnSubFrames: true },
{ path: Qt.resolvedUrl("../js/ethereum_wrapper.js"), runOnSubFrames: true },
{ path: Qt.resolvedUrl("../js/eip6963_announcer.js"), runOnSubFrames: false },