diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-01-19 15:37:56 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-02-02 14:28:32 +0000 |
commit | 315f3ccf1e8ee697688d50012307a1cb6747a6b7 (patch) | |
tree | 0f97a7c5b3d64ee0f3c5dea137077621235127ba /src/core/web_contents_adapter.cpp | |
parent | b4864da72e5861c3958c66cc9018aaf5b681320b (diff) |
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 <andras.becsi@theqtcompany.com>
Diffstat (limited to 'src/core/web_contents_adapter.cpp')
-rw-r--r-- | src/core/web_contents_adapter.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 38573d833..ed8422b6e 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -667,7 +667,13 @@ qreal WebContentsAdapter::currentZoomFactor() const BrowserContextQt* WebContentsAdapter::browserContext() { Q_D(WebContentsAdapter); - return d->browserContextAdapter->browserContext(); + return d->browserContextAdapter ? d->browserContextAdapter->browserContext() : d->webContents ? static_cast<BrowserContextQt*>(d->webContents->GetBrowserContext()) : 0; +} + +BrowserContextAdapter* WebContentsAdapter::browserContextAdapter() +{ + Q_D(WebContentsAdapter); + return d->browserContextAdapter ? d->browserContextAdapter.data() : d->webContents ? static_cast<BrowserContextQt*>(d->webContents->GetBrowserContext())->adapter() : 0; } #ifndef QT_NO_ACCESSIBILITY |