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

Side by Side Diff: Source/WebCore/xml/parser/XMLDocumentParser.cpp

Issue 10170018: Merge 113670 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 years, 8 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/fast/dom/text-node-attach-crash-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 if (!m_leafTextNode) 168 if (!m_leafTextNode)
169 return; 169 return;
170 170
171 #if !USE(QXMLSTREAM) 171 #if !USE(QXMLSTREAM)
172 ExceptionCode ec = 0; 172 ExceptionCode ec = 0;
173 m_leafTextNode->appendData(toString(m_bufferedText.data(), m_bufferedText.si ze()), ec); 173 m_leafTextNode->appendData(toString(m_bufferedText.data(), m_bufferedText.si ze()), ec);
174 Vector<xmlChar> empty; 174 Vector<xmlChar> empty;
175 m_bufferedText.swap(empty); 175 m_bufferedText.swap(empty);
176 #endif 176 #endif
177 177
178 if (m_view && !m_leafTextNode->attached()) 178 if (m_view && m_leafTextNode->parentNode() && m_leafTextNode->parentNode()-> attached()
179 && !m_leafTextNode->attached())
179 m_leafTextNode->attach(); 180 m_leafTextNode->attach();
180 181
181 m_leafTextNode = 0; 182 m_leafTextNode = 0;
182 } 183 }
183 184
184 void XMLDocumentParser::detach() 185 void XMLDocumentParser::detach()
185 { 186 {
186 clearCurrentNodeStack(); 187 clearCurrentNodeStack();
187 ScriptableDocumentParser::detach(); 188 ScriptableDocumentParser::detach();
188 } 189 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 303
303 RefPtr<XMLDocumentParser> parser = XMLDocumentParser::create(fragment, conte xtElement, scriptingPermission); 304 RefPtr<XMLDocumentParser> parser = XMLDocumentParser::create(fragment, conte xtElement, scriptingPermission);
304 bool wellFormed = parser->appendFragmentSource(chunk); 305 bool wellFormed = parser->appendFragmentSource(chunk);
305 // Do not call finish(). Current finish() and doEnd() implementations touch the main Document/loader 306 // Do not call finish(). Current finish() and doEnd() implementations touch the main Document/loader
306 // and can cause crashes in the fragment case. 307 // and can cause crashes in the fragment case.
307 parser->detach(); // Allows ~DocumentParser to assert it was detached before destruction. 308 parser->detach(); // Allows ~DocumentParser to assert it was detached before destruction.
308 return wellFormed; // appendFragmentSource()'s wellFormed is more permissive than wellFormed(). 309 return wellFormed; // appendFragmentSource()'s wellFormed is more permissive than wellFormed().
309 } 310 }
310 311
311 } // namespace WebCore 312 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/text-node-attach-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698