OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010. Adam Barth. All rights reserved. | 2 * Copyright (C) 2010. Adam Barth. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 204 } |
205 | 205 |
206 void DocumentWriter::end() | 206 void DocumentWriter::end() |
207 { | 207 { |
208 m_frame->loader()->didEndDocument(); | 208 m_frame->loader()->didEndDocument(); |
209 endIfNotLoadingMainResource(); | 209 endIfNotLoadingMainResource(); |
210 } | 210 } |
211 | 211 |
212 void DocumentWriter::endIfNotLoadingMainResource() | 212 void DocumentWriter::endIfNotLoadingMainResource() |
213 { | 213 { |
| 214 // FIXME: This isn't really the check we should be doing. We should re-work |
| 215 // how we end parsing to match the model in HTML5. |
214 if (m_frame->loader()->isLoadingMainResource() || !m_frame->page() || !m_fra
me->document()) | 216 if (m_frame->loader()->isLoadingMainResource() || !m_frame->page() || !m_fra
me->document()) |
215 return; | 217 return; |
216 | 218 |
217 // http://bugs.webkit.org/show_bug.cgi?id=10854 | 219 // http://bugs.webkit.org/show_bug.cgi?id=10854 |
218 // The frame's last ref may be removed and it can be deleted by checkComplet
ed(), | 220 // The frame's last ref may be removed and it can be deleted by checkComplet
ed(), |
219 // so we'll add a protective refcount | 221 // so we'll add a protective refcount |
220 RefPtr<Frame> protector(m_frame); | 222 RefPtr<Frame> protector(m_frame); |
221 | 223 |
| 224 if (!m_parser) |
| 225 return; |
222 // FIXME: m_parser->finish() should imply m_parser->flush(). | 226 // FIXME: m_parser->finish() should imply m_parser->flush(). |
223 m_parser->flush(this); | 227 m_parser->flush(this); |
224 if (!m_parser) | 228 if (!m_parser) |
225 return; | 229 return; |
226 m_parser->finish(); | 230 m_parser->finish(); |
227 m_parser = 0; | 231 m_parser = 0; |
228 } | 232 } |
229 | 233 |
230 String DocumentWriter::encoding() const | 234 String DocumentWriter::encoding() const |
231 { | 235 { |
(...skipping 22 matching lines...) Expand all Loading... |
254 return m_frame->document()->url().isEmpty() ? m_encoding : encoding(); | 258 return m_frame->document()->url().isEmpty() ? m_encoding : encoding(); |
255 } | 259 } |
256 | 260 |
257 void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation() | 261 void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation() |
258 { | 262 { |
259 ASSERT(!m_parser->isStopped()); | 263 ASSERT(!m_parser->isStopped()); |
260 m_parser->setDocumentWasLoadedAsPartOfNavigation(); | 264 m_parser->setDocumentWasLoadedAsPartOfNavigation(); |
261 } | 265 } |
262 | 266 |
263 } // namespace WebCore | 267 } // namespace WebCore |
OLD | NEW |