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

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

Issue 2760793002: Use v8::Context::NewRemoteContext in RemoteWindowProxy. (Closed)
Patch Set: RemoteDOMWindow in DOMDataStore Created 3 years, 9 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
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 dcaacbcf8c23311905e408621585bb18e1b8140e..47d4f94d5609b8a0f4c1c062b8d20713c4982983 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -60,6 +60,7 @@
#include "core/frame/FrameHost.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalFrame.h"
+#include "core/frame/RemoteDOMWindow.h"
dcheng 2017/03/23 01:47:09 Needed, because a few things in here now are deref
#include "core/frame/RemoteFrame.h"
#include "core/frame/Settings.h"
#include "core/frame/VisualViewport.h"
@@ -8950,6 +8951,24 @@ TEST_F(WebFrameSwapTest, RemoteWindowNamedAccess) {
reset();
}
+TEST_F(WebFrameSwapTest, RemoteWindowToString) {
+ v8::HandleScope scope(v8::Isolate::GetCurrent());
+
+ FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
+ WebRemoteFrame* remoteFrame = remoteClient.frame();
+ lastChild(mainFrame())->swap(remoteFrame);
+ remoteFrame->setReplicatedOrigin(SecurityOrigin::createUnique());
+ v8::Local<v8::Value> exception = mainFrame()->executeScriptAndReturnValue(
+ WebScriptSource("try { '' + window[2]; } catch (e) { e; }"));
+ ASSERT_FALSE(exception.IsEmpty());
+ EXPECT_STREQ(
+ "SecurityError: Blocked a frame with origin \"http://internal.test\" "
+ "from accessing a cross-origin frame.",
+ *v8::String::Utf8Value(exception));
+
+ reset();
+}
+
// TODO(alexmos, dcheng): This test and some other OOPIF tests use
// very little of the test fixture support in WebFrameSwapTest. We should
// clean these tests up.

Powered by Google App Engine
This is Rietveld 408576698