Index: Source/WebCore/loader/DocumentWriter.cpp |
=================================================================== |
--- Source/WebCore/loader/DocumentWriter.cpp (revision 94124) |
+++ Source/WebCore/loader/DocumentWriter.cpp (working copy) |
@@ -106,12 +106,17 @@ |
return DOMImplementation::createDocument(m_mimeType, m_frame, url, m_frame->inViewSourceMode()); |
} |
-void DocumentWriter::begin(const KURL& url, bool dispatch, SecurityOrigin* origin) |
+void DocumentWriter::begin(const KURL& urlReference, bool dispatch, SecurityOrigin* origin) |
{ |
// We need to take a reference to the security origin because |clear| |
// might destroy the document that owns it. |
RefPtr<SecurityOrigin> forcedSecurityOrigin = origin; |
+ // We grab a local copy of the URL because it's easy for callers to supply |
+ // a URL that will be deallocated during the execution of this function. |
+ // For example, see <https://bugs.webkit.org/show_bug.cgi?id=66360>. |
+ KURL url = urlReference; |
+ |
// Create a new document before clearing the frame, because it may need to |
// inherit an aliased security context. |
RefPtr<Document> document = createDocument(url); |