Index: third_party/WebKit/Source/web/WebFrame.cpp |
diff --git a/third_party/WebKit/Source/web/WebFrame.cpp b/third_party/WebKit/Source/web/WebFrame.cpp |
index 29bf0d8c04e50f829b0c326208c3b21c650beb84..25467b57a4d9ee659e0f79b8df04209c77329e30 100644 |
--- a/third_party/WebKit/Source/web/WebFrame.cpp |
+++ b/third_party/WebKit/Source/web/WebFrame.cpp |
@@ -4,8 +4,10 @@ |
#include "public/web/WebFrame.h" |
+#include <algorithm> |
#include "bindings/core/v8/WindowProxyManager.h" |
#include "core/HTMLNames.h" |
+#include "core/dom/IncrementLoadEventDelayCount.h" |
#include "core/frame/FrameView.h" |
#include "core/frame/LocalFrame.h" |
#include "core/frame/RemoteFrame.h" |
@@ -22,7 +24,6 @@ |
#include "web/RemoteFrameOwner.h" |
#include "web/WebLocalFrameImpl.h" |
#include "web/WebRemoteFrameImpl.h" |
-#include <algorithm> |
namespace blink { |
@@ -40,6 +41,16 @@ bool WebFrame::Swap(WebFrame* frame) { |
if (!old_frame->PrepareForCommit()) |
return false; |
+ // If there is a local parent, it might incorrectly declare itself complete |
+ // during the detach phase of this swap. Suppress its completion until swap is |
+ // over, at which point its completion will be correctly dependent on its |
+ // newly swapped-in child. |
+ std::unique_ptr<IncrementLoadEventDelayCount> delay_parent_load = |
lfg
2017/04/27 17:08:25
This looks good, but do you mind explaining why th
|
+ parent_ && parent_->IsWebLocalFrame() |
+ ? IncrementLoadEventDelayCount::Create( |
+ *ToWebLocalFrameImpl(parent_)->GetFrame()->GetDocument()) |
+ : nullptr; |
+ |
if (parent_) { |
if (parent_->first_child_ == this) |
parent_->first_child_ = frame; |