OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) | 2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) |
3 * Copyright (C) 2001 Peter Kelly (pmk@post.com) | 3 * Copyright (C) 2001 Peter Kelly (pmk@post.com) |
4 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 4 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Lesser General Public | 7 * modify it under the terms of the GNU Lesser General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 if (!result.getString(scriptResult)) | 103 if (!result.getString(scriptResult)) |
104 return true; | 104 return true; |
105 #endif | 105 #endif |
106 | 106 |
107 // FIXME: We should always replace the document, but doing so | 107 // FIXME: We should always replace the document, but doing so |
108 // synchronously can cause crashes: | 108 // synchronously can cause crashes: |
109 // http://bugs.webkit.org/show_bug.cgi?id=16782 | 109 // http://bugs.webkit.org/show_bug.cgi?id=16782 |
110 if (shouldReplaceDocumentIfJavaScriptURL == ReplaceDocumentIfJavaScriptURL)
{ | 110 if (shouldReplaceDocumentIfJavaScriptURL == ReplaceDocumentIfJavaScriptURL)
{ |
111 // We're still in a frame, so there should be a DocumentLoader. | 111 // We're still in a frame, so there should be a DocumentLoader. |
112 ASSERT(m_frame->document()->loader()); | 112 ASSERT(m_frame->document()->loader()); |
113 if (DocumentLoader* loader = m_frame->document()->loader()) | 113 |
| 114 // DocumentWriter::replaceDocument can cause the DocumentLoader to get d
eref'ed and possible destroyed, |
| 115 // so protect it with a RefPtr. |
| 116 if (RefPtr<DocumentLoader> loader = m_frame->document()->loader()) |
114 loader->writer()->replaceDocument(scriptResult); | 117 loader->writer()->replaceDocument(scriptResult); |
115 } | 118 } |
116 return true; | 119 return true; |
117 } | 120 } |
118 | 121 |
119 } // namespace WebCore | 122 } // namespace WebCore |
OLD | NEW |