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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 if (error_occurred) { | 456 if (error_occurred) { |
456 script_loader->DispatchErrorEvent(); | 457 script_loader->DispatchErrorEvent(); |
457 } else if (!was_canceled) { | 458 } else if (!was_canceled) { |
458 if (script_parser_blocking_time > 0.0) { | 459 if (script_parser_blocking_time > 0.0) { |
459 DocumentParserTiming::From(*GetDocument()) | 460 DocumentParserTiming::From(*GetDocument()) |
460 .RecordParserBlockedOnScriptLoadDuration( | 461 .RecordParserBlockedOnScriptLoadDuration( |
461 MonotonicallyIncreasingTime() - script_parser_blocking_time, | 462 MonotonicallyIncreasingTime() - script_parser_blocking_time, |
462 script_loader->WasCreatedDuringDocumentWrite()); | 463 script_loader->WasCreatedDuringDocumentWrite()); |
463 } | 464 } |
464 | 465 |
465 if (!script_loader->ExecuteScript(source_code)) | 466 if (!script_loader->ExecuteScript(ClassicScript::Create(source_code))) |
466 script_loader->DispatchErrorEvent(); | 467 script_loader->DispatchErrorEvent(); |
467 else | 468 else |
468 script_loader->DispatchLoadEvent(); | 469 script_loader->DispatchLoadEvent(); |
469 } | 470 } |
470 | 471 |
471 script_element_ = nullptr; | 472 script_element_ = nullptr; |
472 | 473 |
473 if (!IsDetached() && !requesting_script_) | 474 if (!IsDetached() && !requesting_script_) |
474 ResumeParsing(); | 475 ResumeParsing(); |
475 } | 476 } |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 DCHECK(!pending_script_); | 1112 DCHECK(!pending_script_); |
1112 requesting_script_ = true; | 1113 requesting_script_ = true; |
1113 | 1114 |
1114 if (script_loader->PrepareScript( | 1115 if (script_loader->PrepareScript( |
1115 script_start_position_, | 1116 script_start_position_, |
1116 ScriptLoader::kAllowLegacyTypeInTypeAttribute)) { | 1117 ScriptLoader::kAllowLegacyTypeInTypeAttribute)) { |
1117 // FIXME: Script execution should be shared between | 1118 // FIXME: Script execution should be shared between |
1118 // the libxml2 and Qt XMLDocumentParser implementations. | 1119 // the libxml2 and Qt XMLDocumentParser implementations. |
1119 | 1120 |
1120 if (script_loader->ReadyToBeParserExecuted()) { | 1121 if (script_loader->ReadyToBeParserExecuted()) { |
1121 if (!script_loader->ExecuteScript( | 1122 if (!script_loader->ExecuteScript(ClassicScript::Create(ScriptSourceCode( |
1122 ScriptSourceCode(script_loader->ScriptContent(), | 1123 script_loader->ScriptContent(), GetDocument()->Url(), |
1123 GetDocument()->Url(), script_start_position_))) { | 1124 script_start_position_)))) { |
1124 script_loader->DispatchErrorEvent(); | 1125 script_loader->DispatchErrorEvent(); |
1125 return; | 1126 return; |
1126 } | 1127 } |
1127 } else if (script_loader->WillBeParserExecuted()) { | 1128 } else if (script_loader->WillBeParserExecuted()) { |
1128 pending_script_ = script_loader->GetResource(); | 1129 pending_script_ = script_loader->GetResource(); |
1129 DCHECK_EQ(parser_blocking_pending_script_load_start_time_, 0.0); | 1130 DCHECK_EQ(parser_blocking_pending_script_load_start_time_, 0.0); |
1130 parser_blocking_pending_script_load_start_time_ = | 1131 parser_blocking_pending_script_load_start_time_ = |
1131 MonotonicallyIncreasingTime(); | 1132 MonotonicallyIncreasingTime(); |
1132 script_element_ = element; | 1133 script_element_ = element; |
1133 pending_script_->AddClient(this); | 1134 pending_script_->AddClient(this); |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 RefPtr<XMLParserContext> parser = | 1719 RefPtr<XMLParserContext> parser = |
1719 XMLParserContext::CreateStringParser(&sax, &state); | 1720 XMLParserContext::CreateStringParser(&sax, &state); |
1720 String parse_string = "<?xml version=\"1.0\"?><attrs " + string + " />"; | 1721 String parse_string = "<?xml version=\"1.0\"?><attrs " + string + " />"; |
1721 ParseChunk(parser->Context(), parse_string); | 1722 ParseChunk(parser->Context(), parse_string); |
1722 FinishParsing(parser->Context()); | 1723 FinishParsing(parser->Context()); |
1723 attrs_ok = state.got_attributes; | 1724 attrs_ok = state.got_attributes; |
1724 return state.attributes; | 1725 return state.attributes; |
1725 } | 1726 } |
1726 | 1727 |
1727 } // namespace blink | 1728 } // namespace blink |
OLD | NEW |