OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) |
3 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
7 * Copyright (C) 2008 Holger Hans Peter Freyther | 7 * Copyright (C) 2008 Holger Hans Peter Freyther |
8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 187 } |
188 | 188 |
189 void XMLDocumentParser::end() | 189 void XMLDocumentParser::end() |
190 { | 190 { |
191 // XMLDocumentParserLibxml2 will do bad things to the document if doEnd() is
called. | 191 // XMLDocumentParserLibxml2 will do bad things to the document if doEnd() is
called. |
192 // I don't believe XMLDocumentParserQt needs doEnd called in the fragment ca
se. | 192 // I don't believe XMLDocumentParserQt needs doEnd called in the fragment ca
se. |
193 ASSERT(!m_parsingFragment); | 193 ASSERT(!m_parsingFragment); |
194 | 194 |
195 doEnd(); | 195 doEnd(); |
196 | 196 |
| 197 // doEnd() call above can detach the parser and null out its document. |
| 198 // In that case, we just bail out. |
| 199 if (isDetached()) |
| 200 return; |
| 201 |
197 // doEnd() could process a script tag, thus pausing parsing. | 202 // doEnd() could process a script tag, thus pausing parsing. |
198 if (m_parserPaused) | 203 if (m_parserPaused) |
199 return; | 204 return; |
200 | 205 |
201 if (m_sawError) | 206 if (m_sawError) |
202 insertErrorMessageBlock(); | 207 insertErrorMessageBlock(); |
203 else { | 208 else { |
204 exitText(); | 209 exitText(); |
205 document()->styleResolverChanged(RecalcStyleImmediately); | 210 document()->styleResolverChanged(RecalcStyleImmediately); |
206 } | 211 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 306 |
302 RefPtr<XMLDocumentParser> parser = XMLDocumentParser::create(fragment, conte
xtElement, scriptingPermission); | 307 RefPtr<XMLDocumentParser> parser = XMLDocumentParser::create(fragment, conte
xtElement, scriptingPermission); |
303 bool wellFormed = parser->appendFragmentSource(chunk); | 308 bool wellFormed = parser->appendFragmentSource(chunk); |
304 // Do not call finish(). Current finish() and doEnd() implementations touch
the main Document/loader | 309 // Do not call finish(). Current finish() and doEnd() implementations touch
the main Document/loader |
305 // and can cause crashes in the fragment case. | 310 // and can cause crashes in the fragment case. |
306 parser->detach(); // Allows ~DocumentParser to assert it was detached before
destruction. | 311 parser->detach(); // Allows ~DocumentParser to assert it was detached before
destruction. |
307 return wellFormed; // appendFragmentSource()'s wellFormed is more permissive
than wellFormed(). | 312 return wellFormed; // appendFragmentSource()'s wellFormed is more permissive
than wellFormed(). |
308 } | 313 } |
309 | 314 |
310 } // namespace WebCore | 315 } // namespace WebCore |
OLD | NEW |