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

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

Issue 23456031: Prevent crash due to XMLDocumentParser destruction (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase for landing Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 m_originalSourceForTransform.append(source); 343 m_originalSourceForTransform.append(source);
344 344
345 if (isStopped() || m_sawXSLTransform) 345 if (isStopped() || m_sawXSLTransform)
346 return; 346 return;
347 347
348 if (m_parserPaused) { 348 if (m_parserPaused) {
349 m_pendingSrc.append(source); 349 m_pendingSrc.append(source);
350 return; 350 return;
351 } 351 }
352 352
353 // JavaScript can detach the parser. Make sure this is not released
354 // before the end of this method.
355 RefPtr<XMLDocumentParser> protect(this);
356
353 doWrite(source.toString()); 357 doWrite(source.toString());
354 358
355 if (isStopped()) 359 if (isStopped())
356 return; 360 return;
357 361
358 if (document()->frame() && document()->frame()->script()->canExecuteScripts( NotAboutToExecuteScript)) 362 if (document()->frame() && document()->frame()->script()->canExecuteScripts( NotAboutToExecuteScript))
359 ImageLoader::dispatchPendingBeforeLoadEvents(); 363 ImageLoader::dispatchPendingBeforeLoadEvents();
360 } 364 }
361 365
362 void XMLDocumentParser::handleError(XMLErrors::ErrorType type, const char* forma ttedMessage, TextPosition position) 366 void XMLDocumentParser::handleError(XMLErrors::ErrorType type, const char* forma ttedMessage, TextPosition position)
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 sax.initialized = XML_SAX2_MAGIC; 1618 sax.initialized = XML_SAX2_MAGIC;
1615 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1619 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1616 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1620 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1617 parseChunk(parser->context(), parseString); 1621 parseChunk(parser->context(), parseString);
1618 finishParsing(parser->context()); 1622 finishParsing(parser->context());
1619 attrsOK = state.gotAttributes; 1623 attrsOK = state.gotAttributes;
1620 return state.attributes; 1624 return state.attributes;
1621 } 1625 }
1622 1626
1623 } // namespace WebCore 1627 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698