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

Unified Diff: Source/web/tests/WebFrameTest.cpp

Issue 655063003: Disconnect frame owners when detaching frames. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on top of frame detach streamlining and add a test Created 6 years, 2 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 | « Source/core/html/HTMLFrameOwnerElement.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index edf9a86ff32ccf5e848305e7d73f3b183716cf8a..87d74a5f2fb5832e82e3a9889e394f5c1f40a29b 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -6505,6 +6505,25 @@ TEST_F(WebFrameTest, ThemeColor)
EXPECT_EQ(0xff0000ff, frame->document().themeColor());
}
+// Make sure that an embedder-triggered detach with a remote frame parent
+// doesn't leave behind dangling pointers.
+TEST_F(WebFrameTest, EmbedderTriggeredDetachWithRemoteMainFrame)
+{
+ // FIXME: Refactor some of this logic into WebViewHelper to make it easier to
+ // write tests with a top-level remote frame.
+ FrameTestHelpers::TestWebViewClient viewClient;
+ FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
+ WebView* view = WebView::create(&viewClient);
+ view->setMainFrame(WebRemoteFrame::create(&remoteClient));
+ FrameTestHelpers::TestWebFrameClient childFrameClient;
+ WebLocalFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createLocalChild("", &childFrameClient);
+
+ // Purposely keep the LocalFrame alive so it's the last thing to be destroyed.
+ RefPtr<Frame> childCoreFrame = toCoreFrame(childFrame);
+ view->close();
+ childCoreFrame.clear();
+}
+
class WebFrameSwapTest : public WebFrameTest {
protected:
WebFrameSwapTest()
« no previous file with comments | « Source/core/html/HTMLFrameOwnerElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698