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

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

Issue 1112843007: Fix frameElement for frames with a remote parent. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add comment about doing the access check on the frame vs node. Created 5 years, 8 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/frame/LocalDOMWindow.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 6848e91f3170131c08562b4c14be84f78253bbd7..0367c7c721cb98e9ea68ee6e22d6888e9fa4058b 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -7027,6 +7027,28 @@ TEST_F(WebFrameSwapTest, FramesOfRemoteParentAreIndexable)
reset();
}
+// Check that frames with a remote parent don't crash while accessing window.frameElement.
+TEST_F(WebFrameSwapTest, FrameElementInFramesWithRemoteParent)
+{
+ v8::HandleScope scope(v8::Isolate::GetCurrent());
+
+ FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
+ WebRemoteFrame* remoteParentFrame = remoteClient.frame();
+ mainFrame()->swap(remoteParentFrame);
+ remoteParentFrame->setReplicatedOrigin(SecurityOrigin::createUnique());
+
+ FrameTestHelpers::TestWebFrameClient childFrameClient;
+ WebLocalFrame* childFrame = remoteParentFrame->createLocalChild("", WebSandboxFlags::None, &childFrameClient);
+ FrameTestHelpers::loadFrame(childFrame, m_baseURL + "subframe-hello.html");
+
+ v8::Local<v8::Value> frameElement = childFrame->executeScriptAndReturnValue(WebScriptSource("window.frameElement"));
+ // frameElement shouldn't be accessible cross-origin.
+ EXPECT_TRUE(frameElement.IsEmpty());
+
+ // Manually reset to break WebViewHelper's dependency on the stack allocated clients.
+ reset();
+}
+
class RemoteToLocalSwapWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
public:
explicit RemoteToLocalSwapWebFrameClient(WebRemoteFrame* remoteFrame)
« no previous file with comments | « Source/core/frame/LocalDOMWindow.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698