Index: third_party/WebKit/Source/core/loader/FrameLoader.cpp |
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp |
index 27cc4b93872c298865140447341d021f73a9bb7a..d9ff10255d983a431a82f8c790bd8bc9eefa8e78 100644 |
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp |
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp |
@@ -329,6 +329,10 @@ void FrameLoader::replaceDocumentWhileExecutingJavaScriptURL(const String& sourc |
init.withNewRegistrationContext(); |
stopAllLoaders(); |
+ // Don't allow any new child frames to load in this frame: attaching a new |
+ // child frame during or after detaching children results in an attached |
+ // frame on a detached DOM tree, which is bad. |
+ SubframeLoadingDisabler disabler(m_frame->document()); |
m_frame->detachChildren(); |
m_frame->document()->detach(); |
clear(); |
@@ -1042,6 +1046,10 @@ bool FrameLoader::prepareForCommit() |
ThreadState::current()->schedulePageNavigationGCIfNeeded(ratio); |
} |
+ // Don't allow any new child frames to load in this frame: attaching a new |
+ // child frame during or after detaching children results in an attached |
+ // frame on a detached DOM tree, which is bad. |
+ SubframeLoadingDisabler disabler(m_frame->document()); |
if (m_documentLoader) { |
client()->dispatchWillClose(); |
dispatchUnloadEvent(); |