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

Unified Diff: content/browser/frame_host/render_frame_host_manager_browsertest.cc

Issue 166033006: Clear the pending_and_current_web_ui_ if we reuse it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test and fix style. Created 6 years, 10 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
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/render_frame_host_manager_browsertest.cc
diff --git a/content/browser/frame_host/render_frame_host_manager_browsertest.cc b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
index 77d3813c5795c27d81fdee81bdc818fa3225bdb3..71e96cdf812f54ef6078310bfe0d31caaa5958e4 100644
--- a/content/browser/frame_host/render_frame_host_manager_browsertest.cc
+++ b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
@@ -13,6 +13,7 @@
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/site_instance_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/browser/webui/web_ui_impl.h"
#include "content/common/content_constants_internal.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
@@ -1421,4 +1422,28 @@ IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest,
crash_observer2.Wait();
}
+// Ensure that pending_and_current_web_ui_ is cleared when a URL commits.
+// Otherwise it might get picked up by InitRenderView when granting bindings
+// to other RenderViewHosts. See http://crbug.com/330811.
+IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, ClearPendingWebUIOnCommit) {
+ // Visit a WebUI page with bindings.
+ GURL webui_url(GURL(std::string(kChromeUIScheme) + "://" +
+ std::string(kChromeUIGpuHost)));
+ NavigateToURL(shell(), webui_url);
+ EXPECT_TRUE(ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings(
+ shell()->web_contents()->GetRenderProcessHost()->GetID()));
+ WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(
+ shell()->web_contents());
+ WebUIImpl* webui = web_contents->GetRenderManagerForTesting()->web_ui();
+ EXPECT_TRUE(webui);
+ EXPECT_FALSE(web_contents->GetRenderManagerForTesting()->pending_web_ui());
+
+ // Navigate to another WebUI URL that reuses the WebUI object. Make sure we
+ // clear pending_web_ui() when it commits.
+ GURL webui_url2(webui_url.spec() + "#foo");
+ NavigateToURL(shell(), webui_url2);
+ EXPECT_EQ(webui, web_contents->GetRenderManagerForTesting()->web_ui());
+ EXPECT_FALSE(web_contents->GetRenderManagerForTesting()->pending_web_ui());
+}
+
} // namespace content
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698