Index: Source/core/dom/Document.cpp |
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
index 646a36b53a65645d7d145b0ce1565c7bb7008fb3..f38386deb6230ca4caceae2d557affb0521d3a14 100644 |
--- a/Source/core/dom/Document.cpp |
+++ b/Source/core/dom/Document.cpp |
@@ -2161,13 +2161,19 @@ void Document::detach(const AttachContext& context) |
void Document::prepareForDestruction() |
{ |
- m_markers->prepareForDestruction(); |
- disconnectDescendantFrames(); |
+ ASSERT(!m_frame || m_frame->tree().childCount() == 0); |
- // The process of disconnecting descendant frames could have already detached us. |
if (!isActive()) |
return; |
+ ScriptForbiddenScope forbidScript; |
+ // We detach the FrameView's custom scroll bars as early as |
+ // possible to prevent detach() from messing with the view |
+ // such that its scroll bars won't be torn down. |
+ // |
+ // FIXME: We should revisit this. |
dcheng
2015/04/03 20:37:21
I moved this logic over from LocalFrame::detachVie
|
+ view()->prepareForDetach(); |
+ m_markers->prepareForDestruction(); |
if (LocalDOMWindow* window = this->domWindow()) |
window->willDetachDocumentFromFrame(); |
detach(); |