summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorKaloyan Chehlarski <kaloyan.chehlarski@qt.io>2024-08-15 16:27:44 +0200
committerKaloyan Chehlarski <kaloyan.chehlarski@qt.io>2024-08-24 18:19:31 +0200
commit8001d8e149b2d109718f6a671c93e3489c4ecd54 (patch)
tree60a1e6c087323b3cfed9b806faddb66bbd53fa47 /examples
parentbc5cec1a57afd85f0030a04af1ec26af8857c284 (diff)
Permission manager: separate tracking of transient permissions
Following the rewrite of the permissions API, transient (a.k.a non-persistent) permissions still passed through the persistent store sometimes, but were filtered out when using user-facing APIs. Unfortunately, thisstill presented some edge cases in the AskEveryTime permission policy mode. This change modifies the PermissionManagerQt class to store a second set of permissions, and associate them with a RenderFrameHost the way the Chromium API is designed to do anyway. This way, a permission will be kept around for the lifetime of a web page, and calling JavaScript APIs that trigger checks for permission state will work properly (e.g. navigator.mediaDevices.enumerateDevices). The new store is regularly cleaned up to make sure expired permissions are purged before they impact performance. As a side effect, this change also introduces pre-granting of non-persistent permissions, which was the biggest omission in the permissions rewrite. In those cases, the permissions will be temporarily stored inside the persistent store, and moved to the transient one the next time they're queried (and can thus be associated with a RenderFrameHost). This also fixes some extremely broken test cases that relied on invalid web API. Fixes: QTBUG-127951 Pick-to: 6.8 Change-Id: Ic084af7673ea0b255d98d94382e77323bb5e7ab0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/webenginewidgets/simplebrowser/browser.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/examples/webenginewidgets/simplebrowser/browser.cpp b/examples/webenginewidgets/simplebrowser/browser.cpp
index fd68246d0..30c7fc98e 100644
--- a/examples/webenginewidgets/simplebrowser/browser.cpp
+++ b/examples/webenginewidgets/simplebrowser/browser.cpp
@@ -33,6 +33,7 @@ BrowserWindow *Browser::createHiddenWindow(bool offTheRecord)
}
auto profile = !offTheRecord ? m_profile.get() : QWebEngineProfile::defaultProfile();
auto mainWindow = new BrowserWindow(this, profile, false);
+ profile->setPersistentPermissionsPolicy(QWebEngineProfile::PersistentPermissionsPolicy::AskEveryTime);
m_windows.append(mainWindow);
QObject::connect(mainWindow, &QObject::destroyed, [this, mainWindow]() {
m_windows.removeOne(mainWindow);