OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
(...skipping 2164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2175 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); | 2175 m_lifecycle.advanceTo(DocumentLifecycle::StyleClean); |
2176 } | 2176 } |
2177 | 2177 |
2178 void Document::detach(const AttachContext& context) | 2178 void Document::detach(const AttachContext& context) |
2179 { | 2179 { |
2180 TRACE_EVENT0("blink", "Document::detach"); | 2180 TRACE_EVENT0("blink", "Document::detach"); |
2181 ASSERT(!m_frame || m_frame->tree().childCount() == 0); | 2181 ASSERT(!m_frame || m_frame->tree().childCount() == 0); |
2182 if (!isActive()) | 2182 if (!isActive()) |
2183 return; | 2183 return; |
2184 | 2184 |
| 2185 // Frame navigation can cause a new Document to be attached. Don't allow tha
t, since that will |
| 2186 // cause a situation where LocalFrame still has a Document attached after th
is finishes! |
| 2187 // Normally, it shouldn't actually be possible to trigger navigation here. H
owever, plugins |
| 2188 // (see below) can cause lots of crazy things to happen, since plugin detach
involves nested |
| 2189 // message loops. |
| 2190 FrameNavigationDisabler navigationDisabler(*m_frame); |
| 2191 // Defer widget updates to avoid plugins trying to run script inside ScriptF
orbiddenScope, |
| 2192 // which will crash the renderer after https://crrev.com/200984 |
2185 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; | 2193 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; |
| 2194 // Don't allow script to run in the middle of detach() because a detaching D
ocument is not in a |
| 2195 // consistent state. |
2186 ScriptForbiddenScope forbidScript; | 2196 ScriptForbiddenScope forbidScript; |
2187 view()->dispose(); | 2197 view()->dispose(); |
2188 m_markers->prepareForDestruction(); | 2198 m_markers->prepareForDestruction(); |
2189 if (LocalDOMWindow* window = this->domWindow()) | 2199 if (LocalDOMWindow* window = this->domWindow()) |
2190 window->willDetachDocumentFromFrame(); | 2200 window->willDetachDocumentFromFrame(); |
2191 | 2201 |
2192 m_lifecycle.advanceTo(DocumentLifecycle::Stopping); | 2202 m_lifecycle.advanceTo(DocumentLifecycle::Stopping); |
2193 | 2203 |
2194 if (page()) | 2204 if (page()) |
2195 page()->documentDetached(this); | 2205 page()->documentDetached(this); |
(...skipping 3626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5822 #ifndef NDEBUG | 5832 #ifndef NDEBUG |
5823 using namespace blink; | 5833 using namespace blink; |
5824 void showLiveDocumentInstances() | 5834 void showLiveDocumentInstances() |
5825 { | 5835 { |
5826 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 5836 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
5827 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5837 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5828 for (Document* document : set) | 5838 for (Document* document : set) |
5829 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5839 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
5830 } | 5840 } |
5831 #endif | 5841 #endif |
OLD | NEW |