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() |