Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp |
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp |
index 575676031f3e38dae4b38e7c5a93e4d394b832db..311e60a25111bfc8dfa2ddd7a3215ecb4bdb7f46 100644 |
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp |
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp |
@@ -7068,14 +7068,26 @@ namespace { |
class SwapMainFrameWhenTitleChangesWebFrameClient : public FrameTestHelpers::TestWebFrameClient { |
public: |
- SwapMainFrameWhenTitleChangesWebFrameClient() {} |
- ~SwapMainFrameWhenTitleChangesWebFrameClient() override {} |
+ SwapMainFrameWhenTitleChangesWebFrameClient() |
+ : m_remoteFrame(nullptr) |
+ { |
+ } |
+ |
+ ~SwapMainFrameWhenTitleChangesWebFrameClient() override |
+ { |
+ if (m_remoteFrame) |
+ m_remoteFrame->close(); |
+ } |
void didReceiveTitle(WebLocalFrame* frame, const WebString&, WebTextDirection) override |
{ |
- if (!frame->parent()) |
- frame->swap(WebRemoteFrame::create(WebTreeScopeType::Document, nullptr)); |
+ if (!frame->parent()) { |
+ m_remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Document, nullptr); |
+ frame->swap(m_remoteFrame); |
+ } |
} |
+private: |
+ WebRemoteFrame* m_remoteFrame; |
}; |
} // anonymous namespace |