diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2018-05-24 09:45:15 +0200 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2018-05-25 08:58:49 +0000 |
commit | 2957239985e6e343bf2e3f3b9a08c6c5ff379bda (patch) | |
tree | 660f2bca2bbc93f6cb6f057201fd6bcc7750a2a3 /src/core/web_contents_adapter.cpp | |
parent | 9456f41c932cffd82e60389adf5b2b429fb98e34 (diff) |
Apply settings on pending RVH too
This is an improvement of:
bab4abab Keep settings synchronized when RVH swaps
Updating settings during RVH swap is flaky because it happens after
the load start of RenderFrame thus it is not guaranteed the
ViewMsg_UpdateWebPreferences message is received by the render process
before the load finishes. This means that the setting might not be applied
on the current page if it was set during the navigation.
The new RVH is created at the very beginning of the navigation, so access
it via the pending or speculative main frame of the page thereby make it
possible to update its settings before the load of RenderFrame starts.
Task-number: QTBUG-66656
Task-number: QTBUG-68424
Change-Id: I4fbba597579551bb3329936ccd7b357cf8daa4ea
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Diffstat (limited to 'src/core/web_contents_adapter.cpp')
-rw-r--r-- | src/core/web_contents_adapter.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 4ebed8fc9..63cda7fa1 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -1052,6 +1052,15 @@ void WebContentsAdapter::updateWebPreferences(const content::WebPreferences & we Q_D(WebContentsAdapter); CHECK_INITIALIZED(); d->webContents->GetRenderViewHost()->UpdateWebkitPreferences(webPreferences); + + // In case of updating preferences during navigation, there might be a pending RVH what will + // be active on successful navigation. + content::RenderFrameHost *pendingRFH = (static_cast<content::WebContentsImpl*>(d->webContents.get()))->GetPendingMainFrame(); + if (pendingRFH) { + content::RenderViewHost *pendingRVH = pendingRFH->GetRenderViewHost(); + Q_ASSERT(pendingRVH); + pendingRVH->UpdateWebkitPreferences(webPreferences); + } } void WebContentsAdapter::download(const QUrl &url, const QString &suggestedFileName, |