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. | 8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * | 10 * |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include <libxml/parser.h> | 29 #include <libxml/parser.h> |
30 #include <libxml/parserInternals.h> | 30 #include <libxml/parserInternals.h> |
31 #include <libxslt/xslt.h> | 31 #include <libxslt/xslt.h> |
32 #include <memory> | 32 #include <memory> |
33 #include "bindings/core/v8/ExceptionState.h" | 33 #include "bindings/core/v8/ExceptionState.h" |
34 #include "bindings/core/v8/ScriptController.h" | 34 #include "bindings/core/v8/ScriptController.h" |
35 #include "bindings/core/v8/ScriptSourceCode.h" | 35 #include "bindings/core/v8/ScriptSourceCode.h" |
36 #include "core/HTMLNames.h" | 36 #include "core/HTMLNames.h" |
37 #include "core/XMLNSNames.h" | 37 #include "core/XMLNSNames.h" |
38 #include "core/dom/CDATASection.h" | 38 #include "core/dom/CDATASection.h" |
| 39 #include "core/dom/ClassicScript.h" |
39 #include "core/dom/Comment.h" | 40 #include "core/dom/Comment.h" |
40 #include "core/dom/Document.h" | 41 #include "core/dom/Document.h" |
41 #include "core/dom/DocumentFragment.h" | 42 #include "core/dom/DocumentFragment.h" |
42 #include "core/dom/DocumentParserTiming.h" | 43 #include "core/dom/DocumentParserTiming.h" |
43 #include "core/dom/DocumentType.h" | 44 #include "core/dom/DocumentType.h" |
44 #include "core/dom/ProcessingInstruction.h" | 45 #include "core/dom/ProcessingInstruction.h" |
45 #include "core/dom/ScriptLoader.h" | 46 #include "core/dom/ScriptLoader.h" |
46 #include "core/dom/StyleEngine.h" | 47 #include "core/dom/StyleEngine.h" |
47 #include "core/dom/TransformSource.h" | 48 #include "core/dom/TransformSource.h" |
48 #include "core/frame/LocalFrame.h" | 49 #include "core/frame/LocalFrame.h" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 if (errorOccurred) { | 455 if (errorOccurred) { |
455 scriptLoader->dispatchErrorEvent(); | 456 scriptLoader->dispatchErrorEvent(); |
456 } else if (!wasCanceled) { | 457 } else if (!wasCanceled) { |
457 if (scriptParserBlockingTime > 0.0) { | 458 if (scriptParserBlockingTime > 0.0) { |
458 DocumentParserTiming::from(*document()) | 459 DocumentParserTiming::from(*document()) |
459 .recordParserBlockedOnScriptLoadDuration( | 460 .recordParserBlockedOnScriptLoadDuration( |
460 monotonicallyIncreasingTime() - scriptParserBlockingTime, | 461 monotonicallyIncreasingTime() - scriptParserBlockingTime, |
461 scriptLoader->wasCreatedDuringDocumentWrite()); | 462 scriptLoader->wasCreatedDuringDocumentWrite()); |
462 } | 463 } |
463 | 464 |
464 if (!scriptLoader->executeScript(sourceCode)) | 465 if (!scriptLoader->executeScript(ClassicScript::create(sourceCode))) |
465 scriptLoader->dispatchErrorEvent(); | 466 scriptLoader->dispatchErrorEvent(); |
466 else | 467 else |
467 scriptLoader->dispatchLoadEvent(); | 468 scriptLoader->dispatchLoadEvent(); |
468 } | 469 } |
469 | 470 |
470 m_scriptElement = nullptr; | 471 m_scriptElement = nullptr; |
471 | 472 |
472 if (!isDetached() && !m_requestingScript) | 473 if (!isDetached() && !m_requestingScript) |
473 resumeParsing(); | 474 resumeParsing(); |
474 } | 475 } |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 DCHECK(!m_pendingScript); | 1108 DCHECK(!m_pendingScript); |
1108 m_requestingScript = true; | 1109 m_requestingScript = true; |
1109 | 1110 |
1110 if (scriptLoader->prepareScript( | 1111 if (scriptLoader->prepareScript( |
1111 m_scriptStartPosition, | 1112 m_scriptStartPosition, |
1112 ScriptLoader::AllowLegacyTypeInTypeAttribute)) { | 1113 ScriptLoader::AllowLegacyTypeInTypeAttribute)) { |
1113 // FIXME: Script execution should be shared between | 1114 // FIXME: Script execution should be shared between |
1114 // the libxml2 and Qt XMLDocumentParser implementations. | 1115 // the libxml2 and Qt XMLDocumentParser implementations. |
1115 | 1116 |
1116 if (scriptLoader->readyToBeParserExecuted()) { | 1117 if (scriptLoader->readyToBeParserExecuted()) { |
1117 if (!scriptLoader->executeScript( | 1118 if (!scriptLoader->executeScript(ClassicScript::create( |
1118 ScriptSourceCode(scriptLoader->scriptContent(), document()->url(), | 1119 ScriptSourceCode(scriptLoader->scriptContent(), document()->url(), |
1119 m_scriptStartPosition))) { | 1120 m_scriptStartPosition)))) { |
1120 scriptLoader->dispatchErrorEvent(); | 1121 scriptLoader->dispatchErrorEvent(); |
1121 return; | 1122 return; |
1122 } | 1123 } |
1123 } else if (scriptLoader->willBeParserExecuted()) { | 1124 } else if (scriptLoader->willBeParserExecuted()) { |
1124 m_pendingScript = scriptLoader->resource(); | 1125 m_pendingScript = scriptLoader->resource(); |
1125 DCHECK_EQ(m_parserBlockingPendingScriptLoadStartTime, 0.0); | 1126 DCHECK_EQ(m_parserBlockingPendingScriptLoadStartTime, 0.0); |
1126 m_parserBlockingPendingScriptLoadStartTime = | 1127 m_parserBlockingPendingScriptLoadStartTime = |
1127 monotonicallyIncreasingTime(); | 1128 monotonicallyIncreasingTime(); |
1128 m_scriptElement = element; | 1129 m_scriptElement = element; |
1129 m_pendingScript->addClient(this); | 1130 m_pendingScript->addClient(this); |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1711 RefPtr<XMLParserContext> parser = | 1712 RefPtr<XMLParserContext> parser = |
1712 XMLParserContext::createStringParser(&sax, &state); | 1713 XMLParserContext::createStringParser(&sax, &state); |
1713 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; | 1714 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; |
1714 parseChunk(parser->context(), parseString); | 1715 parseChunk(parser->context(), parseString); |
1715 finishParsing(parser->context()); | 1716 finishParsing(parser->context()); |
1716 attrsOK = state.gotAttributes; | 1717 attrsOK = state.gotAttributes; |
1717 return state.attributes; | 1718 return state.attributes; |
1718 } | 1719 } |
1719 | 1720 |
1720 } // namespace blink | 1721 } // namespace blink |
OLD | NEW |