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

Unified Diff: Source/core/dom/Document.cpp

Issue 19962002: Protect documents from deletion when their onload removes them (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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
« no previous file with comments | « LayoutTests/loader/resources/empty.xml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 7b3cad2457145569d99998134c088e7d094c029f..5eb23cb0321c5429cb7a822f45e48207cf7055a6 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -4062,6 +4062,11 @@ void Document::finishedParsing()
if (!m_documentTiming.domContentLoadedEventEnd)
m_documentTiming.domContentLoadedEventEnd = monotonicallyIncreasingTime();
+ // The loader's finishedParsing() method may invoke script that causes this object to
+ // be dereferenced (when this document is in an iframe and the onload causes the iframe's src to change).
+ // Keep it alive until we are done.
+ RefPtr<Document> protect(this);
abarth-chromium 2013/07/22 18:06:24 Why doesn't this issue occur with HTML documents?
+
if (RefPtr<Frame> f = frame()) {
// FrameLoader::finishedParsing() might end up calling Document::implicitClose() if all
// resource loads are complete. HTMLObjectElements can start loading their resources from
« no previous file with comments | « LayoutTests/loader/resources/empty.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698