| Index: Source/web/tests/WebFrameTest.cpp
|
| diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
|
| index 4ba5c6abac73a93313e60c7177fdb4f04f4f4ab2..c0d587ebde42cc49a439ef5f55188c5876c71aa4 100644
|
| --- a/Source/web/tests/WebFrameTest.cpp
|
| +++ b/Source/web/tests/WebFrameTest.cpp
|
| @@ -7313,6 +7313,47 @@ TEST_F(WebFrameSwapTest, WindowOpenOnRemoteFrame)
|
| reset();
|
| }
|
|
|
| +class RemoteWindowCloseClient : public FrameTestHelpers::TestWebViewClient {
|
| +public:
|
| + void closeWidgetSoon() override
|
| + {
|
| + m_closed = true;
|
| + }
|
| +
|
| + bool closed() const { return m_closed; }
|
| +
|
| +private:
|
| + bool m_closed;
|
| +};
|
| +
|
| +TEST_F(WebFrameSwapTest, WindowOpenRemoteClose)
|
| +{
|
| + // Create a remote window that will be closed later in the test.
|
| + RemoteWindowCloseClient viewClient;
|
| + FrameTestHelpers::TestWebRemoteFrameClient frameClient;
|
| + WebRemoteFrame* webRemoteFrame = frameClient.frame();
|
| +
|
| + WebView* view = WebView::create(&viewClient);
|
| + view->setMainFrame(webRemoteFrame);
|
| + view->mainFrame()->setOpener(mainFrame());
|
| + webRemoteFrame->setReplicatedOrigin(WebSecurityOrigin::createFromString("http://127.0.0.1"));
|
| +
|
| + LocalFrame* localFrame = toLocalFrame(toCoreFrame(mainFrame()));
|
| + RemoteFrame* remoteFrame = toRemoteFrame(toCoreFrame(frameClient.frame()));
|
| +
|
| + // Attempt to close the window, which should fail as it isn't opened
|
| + // by a script.
|
| + remoteFrame->domWindow()->close(localFrame->document());
|
| + EXPECT_FALSE(viewClient.closed());
|
| +
|
| + // Marking it as opened by a script should now allow it to be closed.
|
| + remoteFrame->page()->setOpenedByDOM();
|
| + remoteFrame->domWindow()->close(localFrame->document());
|
| + EXPECT_TRUE(viewClient.closed());
|
| +
|
| + reset();
|
| +}
|
| +
|
| class CommitTypeWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
|
| public:
|
| explicit CommitTypeWebFrameClient()
|
|
|