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

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

Issue 725593004: Prevent the load event from firing inside DOMContentLoaded (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Done->FinishedParsing Created 6 years, 1 month 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/FrameLoader.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 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 1479
1480 bool xmlViewerMode = !m_sawError && !m_sawCSS && !m_sawXSLTransform && hasNo StyleInformation(document()); 1480 bool xmlViewerMode = !m_sawError && !m_sawCSS && !m_sawXSLTransform && hasNo StyleInformation(document());
1481 if (xmlViewerMode) { 1481 if (xmlViewerMode) {
1482 const char noStyleMessage[] = "This XML file does not appear to have any style information associated with it. The document tree is shown below."; 1482 const char noStyleMessage[] = "This XML file does not appear to have any style information associated with it. The document tree is shown below.";
1483 document()->setIsViewSource(true); 1483 document()->setIsViewSource(true);
1484 V8Document::PrivateScript::transformDocumentToTreeViewMethod(document()- >frame(), document(), noStyleMessage); 1484 V8Document::PrivateScript::transformDocumentToTreeViewMethod(document()- >frame(), document(), noStyleMessage);
1485 } else if (m_sawXSLTransform) { 1485 } else if (m_sawXSLTransform) {
1486 xmlDocPtr doc = xmlDocPtrForString(document()->fetcher(), m_originalSour ceForTransform.toString(), document()->url().string()); 1486 xmlDocPtr doc = xmlDocPtrForString(document()->fetcher(), m_originalSour ceForTransform.toString(), document()->url().string());
1487 document()->setTransformSource(adoptPtr(new TransformSource(doc))); 1487 document()->setTransformSource(adoptPtr(new TransformSource(doc)));
1488 // Make the document think it's done, so it will apply XSL stylesheets. 1488 // Make the document think it's done, so it will apply XSL stylesheets.
1489 document()->setParsing(false); 1489 document()->setParsingState(Document::FinishedParsing);
1490 document()->styleResolverChanged(); 1490 document()->styleResolverChanged();
1491 1491
1492 // styleResolverChanged() call can detach the parser and null out its 1492 // styleResolverChanged() call can detach the parser and null out its
1493 // document. In that case, we just bail out. 1493 // document. In that case, we just bail out.
1494 if (isDetached()) 1494 if (isDetached())
1495 return; 1495 return;
1496 1496
1497 document()->setParsing(true); 1497 document()->setParsingState(Document::Parsing);
1498 DocumentParser::stopParsing(); 1498 DocumentParser::stopParsing();
1499 } 1499 }
1500 } 1500 }
1501 1501
1502 xmlDocPtr xmlDocPtrForString(ResourceFetcher* fetcher, const String& source, con st String& url) 1502 xmlDocPtr xmlDocPtrForString(ResourceFetcher* fetcher, const String& source, con st String& url)
1503 { 1503 {
1504 if (source.isEmpty()) 1504 if (source.isEmpty())
1505 return 0; 1505 return 0;
1506 // Parse in a single chunk into an xmlDocPtr 1506 // Parse in a single chunk into an xmlDocPtr
1507 // FIXME: Hook up error handlers so that a failure to parse the main 1507 // FIXME: Hook up error handlers so that a failure to parse the main
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 sax.initialized = XML_SAX2_MAGIC; 1644 sax.initialized = XML_SAX2_MAGIC;
1645 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1645 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1646 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1646 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1647 parseChunk(parser->context(), parseString); 1647 parseChunk(parser->context(), parseString);
1648 finishParsing(parser->context()); 1648 finishParsing(parser->context());
1649 attrsOK = state.gotAttributes; 1649 attrsOK = state.gotAttributes;
1650 return state.attributes; 1650 return state.attributes;
1651 } 1651 }
1652 1652
1653 } // namespace blink 1653 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698