From 315f3ccf1e8ee697688d50012307a1cb6747a6b7 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 19 Jan 2015 15:37:56 +0100 Subject: Forbid mismatching profiles when adopting web content To avoid crashing due to a mismatch of browser-contexts used by webcontent and webcontent adapters and clients, we refuse to open content in a new window witha different profile and prints a warning so the developers may fix their software. Change-Id: I704266a96de2d7a5f8e1fa3ccf49a50f1d2307c9 Task-number: QTBUG-43898 Reviewed-by: Andras Becsi --- src/webengine/api/qquickwebengineview.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/webengine/api/qquickwebengineview.cpp') diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 460caa4d7..f6dbc18ff 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -512,6 +512,11 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent return; } + if (browserContextAdapter() != webContents->browserContextAdapter()) { + qWarning("Can not adopt content from a different WebEngineProfile."); + return; + } + Q_Q(QQuickWebEngineView); // This throws away the WebContentsAdapter that has been used until now. // All its states, particularly the loading URL, are replaced by the adopted WebContentsAdapter. -- cgit v1.2.1