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

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

Issue 2631233003: Avoid mutating frame owner when detaching a provisional frame. (Closed)
Patch Set: Fix test to actually test the changed behavior. Created 3 years, 11 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/FrameTestHelpers.cpp
diff --git a/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp b/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp
index a6ea70041adad867ada53855c7bfee332fde4da3..f249400ab2f9a4968bd520a645c3e66bdefeb0cc 100644
--- a/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp
+++ b/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp
@@ -289,6 +289,26 @@ void WebViewHelper::resize(WebSize size) {
TestWebFrameClient::TestWebFrameClient() {}
+// TODO(dcheng): https://crbug.com/578349 tracks the removal of this code. This
+// override exists only to handle the confusing provisional frame case.
+void TestWebFrameClient::frameDetached(WebLocalFrame* frame, DetachType type) {
+ if (type == DetachType::Remove && frame->parent()) {
+ // Since this may be detaching a provisional frame, make sure |child| is
+ // actually linked into the frame tree (i.e. it is present in its parent
+ // node's children list) before trying to remove it as a child.
+ for (WebFrame* child = frame->parent()->firstChild(); child;
+ child = child->nextSibling()) {
+ if (child == frame)
+ frame->parent()->removeChild(frame);
+ }
+ }
+
+ if (frame->frameWidget())
+ frame->frameWidget()->close();
+
+ frame->close();
+}
+
WebLocalFrame* TestWebFrameClient::createChildFrame(
WebLocalFrame* parent,
WebTreeScopeType scope,

Powered by Google App Engine
This is Rietveld 408576698