Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Unified Diff: content/shell/browser/layout_test/blink_test_controller.cc

Issue 2134723002: Reland #1: Fix re-usage of stale cached WebPreferences in RenderViewHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanly reset WebPreferences with the initial untampered defaults. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/shell/browser/layout_test/blink_test_controller.cc
diff --git a/content/shell/browser/layout_test/blink_test_controller.cc b/content/shell/browser/layout_test/blink_test_controller.cc
index 205c53ac03be3b05e016e6ba1ca858c6d2d76320..7d0405d371e24e474911608440d6ff437a776492 100644
--- a/content/shell/browser/layout_test/blink_test_controller.cc
+++ b/content/shell/browser/layout_test/blink_test_controller.cc
@@ -292,6 +292,8 @@ bool BlinkTestController::PrepareForLayoutTest(
initial_size_);
WebContentsObserver::Observe(main_window_->web_contents());
current_pid_ = base::kNullProcessId;
+ default_prefs_ =
+ main_window_->web_contents()->GetRenderViewHost()->GetWebkitPreferences();
main_window_->LoadURL(test_url);
} else {
#if defined(OS_MACOSX)
@@ -309,9 +311,7 @@ bool BlinkTestController::PrepareForLayoutTest(
->WasResized();
RenderViewHost* render_view_host =
main_window_->web_contents()->GetRenderViewHost();
- WebPreferences prefs = render_view_host->GetWebkitPreferences();
- OverrideWebkitPrefs(&prefs);
Mike West 2016/07/08 13:16:37 I think you still need to call this against `defau
carlosk 2016/07/11 08:21:00 The default we save up there @ 295 does already in
- render_view_host->UpdateWebkitPreferences(prefs);
+ render_view_host->UpdateWebkitPreferences(default_prefs_);
HandleNewRenderFrameHost(render_view_host->GetMainFrame());
NavigationController::LoadURLParams params(test_url);
@@ -757,6 +757,15 @@ void BlinkTestController::OnPrintMessage(const std::string& message) {
void BlinkTestController::OnOverridePreferences(const WebPreferences& prefs) {
should_override_prefs_ = true;
prefs_ = prefs;
+
+ // Notifies the main RenderViewHost that Blink preferences changed so
+ // immediately apply the new settings and to avoid re-usage of cached
+ // preferences that are now stale. RenderViewHost::UpdateWebkitPreferences is
+ // not used here because it would send an unneeded preferences update to the
+ // renderer.
+ RenderViewHost* main_render_view_host =
+ main_window_->web_contents()->GetRenderViewHost();
+ main_render_view_host->OnWebkitPreferencesChanged();
}
void BlinkTestController::OnClearDevToolsLocalStorage() {
« no previous file with comments | « content/shell/browser/layout_test/blink_test_controller.h ('k') | content/shell/renderer/layout_test/blink_test_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698