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

Unified Diff: content/browser/renderer_host/render_view_host_browsertest.cc

Issue 305103003: Fix for 'Simple Adblock' extension crashes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: #include <map> Created 6 years, 6 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/browser/renderer_host/render_view_host_browsertest.cc
diff --git a/content/browser/renderer_host/render_view_host_browsertest.cc b/content/browser/renderer_host/render_view_host_browsertest.cc
index 31ecee94aaa0f8e476297ff58e52dc76c8c434c8..6015c04306ee5fec1ade6a4b13a9dc6eadffcbc6 100644
--- a/content/browser/renderer_host/render_view_host_browsertest.cc
+++ b/content/browser/renderer_host/render_view_host_browsertest.cc
@@ -129,4 +129,36 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, IsFocusedElementEditable) {
EXPECT_TRUE(rvh->IsFocusedElementEditable());
}
+IN_PROC_BROWSER_TEST_F(RenderViewHostTest, ReleaseSessionOnCloseACK) {
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+ GURL test_url = embedded_test_server()->GetURL(
+ "/access-session-storage.html");
+ NavigateToURL(shell(), test_url);
+
+ // Make a new Shell, a seperate tab with it's own session namespace and
+ // have it start loading a url but still be in progress.
+ ShellAddedObserver new_shell_observer;
+ EXPECT_TRUE(ExecuteScript(shell()->web_contents(), "window.open();"));
+ Shell* new_shell = new_shell_observer.GetShell();
+ new_shell->LoadURL(test_url);
+ RenderViewHost* rvh = new_shell->web_contents()->GetRenderViewHost();
+ SiteInstance* site_instance = rvh->GetSiteInstance();
+ scoped_refptr<SessionStorageNamespace> session_namespace =
+ rvh->GetDelegate()->GetSessionStorageNamespace(site_instance);
+ EXPECT_FALSE(session_namespace->HasOneRef());
+
+ // Close it, or rather start the close operation. The session namespace
+ // should remain until RPH gets an ACK from the renderer about having
+ // closed the view.
+ new_shell->Close();
+ EXPECT_FALSE(session_namespace->HasOneRef());
+
+ // Do something that causes ipc queues to flush and tasks in
+ // flight to complete such that we should have received the ACK.
+ NavigateToURL(shell(), test_url);
+
+ // Verify we have the only remaining reference to the namespace.
+ EXPECT_TRUE(session_namespace->HasOneRef());
+}
+
} // namespace content
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/browser/renderer_host/render_view_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698