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

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

Issue 771493002: Insert the error message block when stopping parsing and an error occurred Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix svg/custom/missing-xlink.svg Created 5 years, 7 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/dom-parse-parsererror-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, 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 417
418 // doEnd() call above can detach the parser and null out its document. 418 // doEnd() call above can detach the parser and null out its document.
419 // In that case, we just bail out. 419 // In that case, we just bail out.
420 if (isDetached()) 420 if (isDetached())
421 return; 421 return;
422 422
423 // doEnd() could process a script tag, thus pausing parsing. 423 // doEnd() could process a script tag, thus pausing parsing.
424 if (m_parserPaused) 424 if (m_parserPaused)
425 return; 425 return;
426 426
427 if (m_sawError) { 427 // stopParsing() calls insertErrorMessageBlock() if there was a parsing
428 // error. Avoid showing the error message block twice.
429 if (m_sawError && !isStopped()) {
428 insertErrorMessageBlock(); 430 insertErrorMessageBlock();
429 } else { 431 } else {
430 exitText(); 432 exitText();
431 document()->styleResolverChanged(); 433 document()->styleResolverChanged();
432 } 434 }
433 435
434 if (isParsing()) 436 if (isParsing())
435 prepareToStopParsing(); 437 prepareToStopParsing();
436 document()->setReadyState(Document::Interactive); 438 document()->setReadyState(Document::Interactive);
437 clearCurrentNodeStack(); 439 clearCurrentNodeStack();
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 TextPosition XMLDocumentParser::textPosition() const 1548 TextPosition XMLDocumentParser::textPosition() const
1547 { 1549 {
1548 xmlParserCtxtPtr context = this->context(); 1550 xmlParserCtxtPtr context = this->context();
1549 if (!context) 1551 if (!context)
1550 return TextPosition::minimumPosition(); 1552 return TextPosition::minimumPosition();
1551 return TextPosition(OrdinalNumber::fromOneBasedInt(context->input->line), Or dinalNumber::fromOneBasedInt(context->input->col)); 1553 return TextPosition(OrdinalNumber::fromOneBasedInt(context->input->line), Or dinalNumber::fromOneBasedInt(context->input->col));
1552 } 1554 }
1553 1555
1554 void XMLDocumentParser::stopParsing() 1556 void XMLDocumentParser::stopParsing()
1555 { 1557 {
1558 if (m_sawError)
1559 insertErrorMessageBlock();
1556 DocumentParser::stopParsing(); 1560 DocumentParser::stopParsing();
1557 if (context()) 1561 if (context())
1558 xmlStopParser(context()); 1562 xmlStopParser(context());
1559 } 1563 }
1560 1564
1561 void XMLDocumentParser::resumeParsing() 1565 void XMLDocumentParser::resumeParsing()
1562 { 1566 {
1563 ASSERT(!isDetached()); 1567 ASSERT(!isDetached());
1564 ASSERT(m_parserPaused); 1568 ASSERT(m_parserPaused);
1565 1569
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 sax.initialized = XML_SAX2_MAGIC; 1670 sax.initialized = XML_SAX2_MAGIC;
1667 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1671 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1668 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1672 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1669 parseChunk(parser->context(), parseString); 1673 parseChunk(parser->context(), parseString);
1670 finishParsing(parser->context()); 1674 finishParsing(parser->context());
1671 attrsOK = state.gotAttributes; 1675 attrsOK = state.gotAttributes;
1672 return state.attributes; 1676 return state.attributes;
1673 } 1677 }
1674 1678
1675 } // namespace blink 1679 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/dom-parse-parsererror-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698