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

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

Issue 1166493003: Prevent reentrancy of WebFrameClient::didClearWindowObject. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fxied android compile Created 5 years, 7 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/loader/FrameLoader.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 c7a5791205a0d1655397e6f8b05c6dbb4e049fab..734ce639400cbeb75c5082067e45bd6c757bc177 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -411,6 +411,32 @@ TEST_P(ParametrizedWebFrameTest, LocationSetEmptyPort)
EXPECT_EQ("http://internal.test:0/" + fileName, content);
}
+class EvaluateOnLoadWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
+public:
+ EvaluateOnLoadWebFrameClient() : m_executing(false), m_wasExecuted(false) { }
+
+ void didClearWindowObject(WebLocalFrame* frame) override
+ {
+ EXPECT_FALSE(m_executing);
+ m_wasExecuted = true;
+ m_executing = true;
+ v8::HandleScope handleScope(v8::Isolate::GetCurrent());
+ frame->executeScriptAndReturnValue(WebScriptSource(WebString("window.someProperty = 42;")));
+ m_executing = false;
+ }
+
+ bool m_executing;
+ bool m_wasExecuted;
+};
+
+TEST_P(ParametrizedWebFrameTest, DidClearWindowObjectIsNotRecursive)
+{
+ EvaluateOnLoadWebFrameClient webFrameClient;
+ FrameTestHelpers::WebViewHelper webViewHelper(this);
+ webViewHelper.initializeAndLoad("about:blank", true, &webFrameClient);
+ EXPECT_TRUE(webFrameClient.m_wasExecuted);
+}
+
class CSSCallbackWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
public:
CSSCallbackWebFrameClient() : m_updateCount(0) { }
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698