| OLD | NEW | 
|---|
| 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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 478     ScriptLoader* scriptLoader = toScriptLoaderIfPossible(e.get()); | 478     ScriptLoader* scriptLoader = toScriptLoaderIfPossible(e.get()); | 
| 479     ASSERT(scriptLoader); | 479     ASSERT(scriptLoader); | 
| 480 | 480 | 
| 481     // JavaScript can detach this parser, make sure it's kept alive even if | 481     // JavaScript can detach this parser, make sure it's kept alive even if | 
| 482     // detached. | 482     // detached. | 
| 483     RefPtrWillBeRawPtr<XMLDocumentParser> protect(this); | 483     RefPtrWillBeRawPtr<XMLDocumentParser> protect(this); | 
| 484 | 484 | 
| 485     if (errorOccurred) { | 485     if (errorOccurred) { | 
| 486         scriptLoader->dispatchErrorEvent(); | 486         scriptLoader->dispatchErrorEvent(); | 
| 487     } else if (!wasCanceled) { | 487     } else if (!wasCanceled) { | 
| 488         scriptLoader->executeScript(sourceCode); | 488         if (!scriptLoader->executeScript(sourceCode)) | 
| 489         scriptLoader->dispatchLoadEvent(); | 489             scriptLoader->dispatchErrorEvent(); | 
|  | 490         else | 
|  | 491             scriptLoader->dispatchLoadEvent(); | 
| 490     } | 492     } | 
| 491 | 493 | 
| 492     m_scriptElement = nullptr; | 494     m_scriptElement = nullptr; | 
| 493 | 495 | 
| 494     if (!isDetached() && !m_requestingScript) | 496     if (!isDetached() && !m_requestingScript) | 
| 495         resumeParsing(); | 497         resumeParsing(); | 
| 496 } | 498 } | 
| 497 | 499 | 
| 498 bool XMLDocumentParser::isWaitingForScripts() const | 500 bool XMLDocumentParser::isWaitingForScripts() const | 
| 499 { | 501 { | 
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1095     } | 1097     } | 
| 1096 | 1098 | 
| 1097     // Don't load external scripts for standalone documents (for now). | 1099     // Don't load external scripts for standalone documents (for now). | 
| 1098     ASSERT(!m_pendingScript); | 1100     ASSERT(!m_pendingScript); | 
| 1099     m_requestingScript = true; | 1101     m_requestingScript = true; | 
| 1100 | 1102 | 
| 1101     if (scriptLoader->prepareScript(m_scriptStartPosition, ScriptLoader::AllowLe
      gacyTypeInTypeAttribute)) { | 1103     if (scriptLoader->prepareScript(m_scriptStartPosition, ScriptLoader::AllowLe
      gacyTypeInTypeAttribute)) { | 
| 1102         // FIXME: Script execution should be shared between | 1104         // FIXME: Script execution should be shared between | 
| 1103         // the libxml2 and Qt XMLDocumentParser implementations. | 1105         // the libxml2 and Qt XMLDocumentParser implementations. | 
| 1104 | 1106 | 
|  | 1107 | 
| 1105         if (scriptLoader->readyToBeParserExecuted()) { | 1108         if (scriptLoader->readyToBeParserExecuted()) { | 
| 1106             scriptLoader->executeScript(ScriptSourceCode(scriptLoader->scriptCon
      tent(), document()->url(), m_scriptStartPosition)); | 1109             if (!scriptLoader->executeScript(ScriptSourceCode(scriptLoader->scri
      ptContent(), document()->url(), m_scriptStartPosition))) { | 
|  | 1110                 scriptLoader->dispatchErrorEvent(); | 
|  | 1111                 return; | 
|  | 1112             } | 
| 1107         } else if (scriptLoader->willBeParserExecuted()) { | 1113         } else if (scriptLoader->willBeParserExecuted()) { | 
| 1108             m_pendingScript = scriptLoader->resource(); | 1114             m_pendingScript = scriptLoader->resource(); | 
| 1109             m_scriptElement = element; | 1115             m_scriptElement = element; | 
| 1110             m_pendingScript->addClient(this); | 1116             m_pendingScript->addClient(this); | 
| 1111 |  | 
| 1112             // m_pendingScript will be 0 if script was already loaded and | 1117             // m_pendingScript will be 0 if script was already loaded and | 
| 1113             // addClient() executed it. | 1118             // addClient() executed it. | 
| 1114             if (m_pendingScript) | 1119             if (m_pendingScript) | 
| 1115                 pauseParsing(); | 1120                 pauseParsing(); | 
| 1116         } else { | 1121         } else { | 
| 1117             m_scriptElement = nullptr; | 1122             m_scriptElement = nullptr; | 
| 1118         } | 1123         } | 
| 1119 | 1124 | 
| 1120         // JavaScript may have detached the parser | 1125         // JavaScript may have detached the parser | 
| 1121         if (isDetached()) | 1126         if (isDetached()) | 
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1661     sax.initialized = XML_SAX2_MAGIC; | 1666     sax.initialized = XML_SAX2_MAGIC; | 
| 1662     RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax,
       &state); | 1667     RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax,
       &state); | 
| 1663     String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; | 1668     String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; | 
| 1664     parseChunk(parser->context(), parseString); | 1669     parseChunk(parser->context(), parseString); | 
| 1665     finishParsing(parser->context()); | 1670     finishParsing(parser->context()); | 
| 1666     attrsOK = state.gotAttributes; | 1671     attrsOK = state.gotAttributes; | 
| 1667     return state.attributes; | 1672     return state.attributes; | 
| 1668 } | 1673 } | 
| 1669 | 1674 | 
| 1670 } // namespace blink | 1675 } // namespace blink | 
| OLD | NEW | 
|---|