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

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

Issue 473203002: DocumentParser should flush itself on finish (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: needs finish event when stopped Created 6 years, 4 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 | « Source/core/loader/DocumentWriter.cpp ('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, 2014 Apple Inc. All rights reserved. 3 * Copyright (C) 2005, 2006, 2008, 2014 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 clearCurrentNodeStack(); 434 clearCurrentNodeStack();
435 document()->finishedParsing(); 435 document()->finishedParsing();
436 } 436 }
437 437
438 void XMLDocumentParser::finish() 438 void XMLDocumentParser::finish()
439 { 439 {
440 // FIXME: We should ASSERT(!m_parserStopped) here, since it does not 440 // FIXME: We should ASSERT(!m_parserStopped) here, since it does not
441 // makes sense to call any methods on DocumentParser once it's been stopped. 441 // makes sense to call any methods on DocumentParser once it's been stopped.
442 // However, FrameLoader::stop calls DocumentParser::finish unconditionally. 442 // However, FrameLoader::stop calls DocumentParser::finish unconditionally.
443 443
444 // flush may ending up executing arbitrary script, and possibly detach the p arser.
445 RefPtr<XMLDocumentParser> protect(this);
446 flush();
447 if (isDetached())
448 return;
449
444 if (m_parserPaused) 450 if (m_parserPaused)
445 m_finishCalled = true; 451 m_finishCalled = true;
446 else 452 else
447 end(); 453 end();
448 } 454 }
449 455
450 void XMLDocumentParser::insertErrorMessageBlock() 456 void XMLDocumentParser::insertErrorMessageBlock()
451 { 457 {
452 m_xmlErrors.insertErrorMessageBlock(); 458 m_xmlErrors.insertErrorMessageBlock();
453 } 459 }
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 sax.initialized = XML_SAX2_MAGIC; 1634 sax.initialized = XML_SAX2_MAGIC;
1629 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1635 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1630 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1636 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1631 parseChunk(parser->context(), parseString); 1637 parseChunk(parser->context(), parseString);
1632 finishParsing(parser->context()); 1638 finishParsing(parser->context());
1633 attrsOK = state.gotAttributes; 1639 attrsOK = state.gotAttributes;
1634 return state.attributes; 1640 return state.attributes;
1635 } 1641 }
1636 1642
1637 } // namespace blink 1643 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/DocumentWriter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698