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

Side by Side Diff: Source/WebCore/dom/XMLDocumentParserLibxml2.cpp

Issue 7064010: Merge 87098 - 2011-05-23 James Simonsen <simonjam@chromium.org> (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/742/
Patch Set: Created 9 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 | « no previous file | Source/WebCore/dom/XMLDocumentParserQt.cpp » ('j') | 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, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> 9 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
10 * 10 *
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 void XMLDocumentParser::endElementNs() 840 void XMLDocumentParser::endElementNs()
841 { 841 {
842 if (isStopped()) 842 if (isStopped())
843 return; 843 return;
844 844
845 if (m_parserPaused) { 845 if (m_parserPaused) {
846 m_pendingCallbacks->appendEndElementNSCallback(); 846 m_pendingCallbacks->appendEndElementNSCallback();
847 return; 847 return;
848 } 848 }
849 849
850 // JavaScript can detach the parser. Make sure this is not released
851 // before the end of this method.
852 RefPtr<XMLDocumentParser> protect(this);
853
850 exitText(); 854 exitText();
851 855
852 Node* n = m_currentNode; 856 RefPtr<ContainerNode> n = m_currentNode;
853 n->finishParsingChildren(); 857 n->finishParsingChildren();
854 858
855 if (m_scriptingPermission == FragmentScriptingNotAllowed && n->isElementNode () && toScriptElement(static_cast<Element*>(n))) { 859 if (m_scriptingPermission == FragmentScriptingNotAllowed && n->isElementNode () && toScriptElement(static_cast<Element*>(n.get()))) {
856 popCurrentNode(); 860 popCurrentNode();
857 ExceptionCode ec; 861 ExceptionCode ec;
858 n->remove(ec); 862 n->remove(ec);
859 return; 863 return;
860 } 864 }
861 865
862 if (!n->isElementNode() || !m_view) { 866 if (!n->isElementNode() || !m_view) {
863 popCurrentNode(); 867 popCurrentNode();
864 return; 868 return;
865 } 869 }
866 870
867 Element* element = static_cast<Element*>(n); 871 Element* element = static_cast<Element*>(n.get());
868 872
869 // The element's parent may have already been removed from document. 873 // The element's parent may have already been removed from document.
870 // Parsing continues in this case, but scripts aren't executed. 874 // Parsing continues in this case, but scripts aren't executed.
871 if (!element->inDocument()) { 875 if (!element->inDocument()) {
872 popCurrentNode(); 876 popCurrentNode();
873 return; 877 return;
874 } 878 }
875 879
876 ScriptElement* scriptElement = toScriptElement(element); 880 ScriptElement* scriptElement = toScriptElement(element);
877 if (!scriptElement) { 881 if (!scriptElement) {
878 popCurrentNode(); 882 popCurrentNode();
879 return; 883 return;
880 } 884 }
881 885
882 // Don't load external scripts for standalone documents (for now). 886 // Don't load external scripts for standalone documents (for now).
883 ASSERT(!m_pendingScript); 887 ASSERT(!m_pendingScript);
884 m_requestingScript = true; 888 m_requestingScript = true;
885 889
886 bool successfullyPrepared = scriptElement->prepareScript(m_scriptStartPositi on, ScriptElement::AllowLegacyTypeInTypeAttribute); 890 bool successfullyPrepared = scriptElement->prepareScript(m_scriptStartPositi on, ScriptElement::AllowLegacyTypeInTypeAttribute);
887 if (!successfullyPrepared) { 891 if (!successfullyPrepared) {
888 #if ENABLE(XHTMLMP) 892 #if ENABLE(XHTMLMP)
889 if (!scriptElement->isScriptTypeSupported(ScriptElement::AllowLegacyType InTypeAttribute)) 893 if (!scriptElement->isScriptTypeSupported(ScriptElement::AllowLegacyType InTypeAttribute))
890 document()->setShouldProcessNoscriptElement(true); 894 document()->setShouldProcessNoscriptElement(true);
891 #endif 895 #endif
892 } else { 896 } else {
893 // FIXME: Script execution should be shared between 897 // FIXME: Script execution should be shared between
894 // the libxml2 and Qt XMLDocumentParser implementations. 898 // the libxml2 and Qt XMLDocumentParser implementations.
895 899
896 // JavaScript can detach the parser. Make sure this is not released
897 // before the end of this method.
898 RefPtr<XMLDocumentParser> protect(this);
899
900 if (scriptElement->readyToBeParserExecuted()) 900 if (scriptElement->readyToBeParserExecuted())
901 scriptElement->executeScript(ScriptSourceCode(scriptElement->scriptC ontent(), document()->url(), m_scriptStartPosition)); 901 scriptElement->executeScript(ScriptSourceCode(scriptElement->scriptC ontent(), document()->url(), m_scriptStartPosition));
902 else if (scriptElement->willBeParserExecuted()) { 902 else if (scriptElement->willBeParserExecuted()) {
903 m_pendingScript = scriptElement->cachedScript(); 903 m_pendingScript = scriptElement->cachedScript();
904 m_scriptElement = element; 904 m_scriptElement = element;
905 m_pendingScript->addClient(this); 905 m_pendingScript->addClient(this);
906 906
907 // m_pendingScript will be 0 if script was already loaded and addCli ent() executed it. 907 // m_pendingScript will be 0 if script was already loaded and addCli ent() executed it.
908 if (m_pendingScript) 908 if (m_pendingScript)
909 pauseParsing(); 909 pauseParsing();
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 sax.startElementNs = attributesStartElementNsHandler; 1515 sax.startElementNs = attributesStartElementNsHandler;
1516 sax.initialized = XML_SAX2_MAGIC; 1516 sax.initialized = XML_SAX2_MAGIC;
1517 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1517 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1518 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1518 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1519 xmlParseChunk(parser->context(), reinterpret_cast<const char*>(parseString.c haracters()), parseString.length() * sizeof(UChar), 1); 1519 xmlParseChunk(parser->context(), reinterpret_cast<const char*>(parseString.c haracters()), parseString.length() * sizeof(UChar), 1);
1520 attrsOK = state.gotAttributes; 1520 attrsOK = state.gotAttributes;
1521 return state.attributes; 1521 return state.attributes;
1522 } 1522 }
1523 1523
1524 } 1524 }
OLDNEW
« no previous file with comments | « no previous file | Source/WebCore/dom/XMLDocumentParserQt.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698