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

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

Issue 2781713003: Enable module scripts in ScriptLoader (Closed)
Patch Set: Update TestExpectations Created 3 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 | « third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.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. 8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * 10 *
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 445
446 pending_script_->RemoveClient(this); 446 pending_script_->RemoveClient(this);
447 pending_script_ = nullptr; 447 pending_script_ = nullptr;
448 448
449 Element* e = script_element_; 449 Element* e = script_element_;
450 script_element_ = nullptr; 450 script_element_ = nullptr;
451 451
452 ScriptLoader* script_loader = 452 ScriptLoader* script_loader =
453 ScriptElementBase::FromElementIfPossible(e)->Loader(); 453 ScriptElementBase::FromElementIfPossible(e)->Loader();
454 DCHECK(script_loader); 454 DCHECK(script_loader);
455 CHECK_EQ(script_loader->GetScriptType(), ScriptType::kClassic);
455 456
456 if (error_occurred) { 457 if (error_occurred) {
457 script_loader->DispatchErrorEvent(); 458 script_loader->DispatchErrorEvent();
458 } else if (!was_canceled) { 459 } else if (!was_canceled) {
459 if (script_parser_blocking_time > 0.0) { 460 if (script_parser_blocking_time > 0.0) {
460 DocumentParserTiming::From(*GetDocument()) 461 DocumentParserTiming::From(*GetDocument())
461 .RecordParserBlockedOnScriptLoadDuration( 462 .RecordParserBlockedOnScriptLoadDuration(
462 MonotonicallyIncreasingTime() - script_parser_blocking_time, 463 MonotonicallyIncreasingTime() - script_parser_blocking_time,
463 script_loader->WasCreatedDuringDocumentWrite()); 464 script_loader->WasCreatedDuringDocumentWrite());
464 } 465 }
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 script_element_base ? script_element_base->Loader() : nullptr; 1106 script_element_base ? script_element_base->Loader() : nullptr;
1106 if (!script_loader) { 1107 if (!script_loader) {
1107 PopCurrentNode(); 1108 PopCurrentNode();
1108 return; 1109 return;
1109 } 1110 }
1110 1111
1111 // Don't load external scripts for standalone documents (for now). 1112 // Don't load external scripts for standalone documents (for now).
1112 DCHECK(!pending_script_); 1113 DCHECK(!pending_script_);
1113 requesting_script_ = true; 1114 requesting_script_ = true;
1114 1115
1115 if (script_loader->PrepareScript( 1116 bool success = script_loader->PrepareScript(
1116 script_start_position_, 1117 script_start_position_, ScriptLoader::kAllowLegacyTypeInTypeAttribute);
1117 ScriptLoader::kAllowLegacyTypeInTypeAttribute)) { 1118
1119 if (script_loader->GetScriptType() != ScriptType::kClassic) {
1120 // XMLDocumentParser does not support a module script, and thus ignores it.
1121 success = false;
1122 VLOG(0) << "Module scripts in XML documents are not supported.";
1123 }
1124
1125 if (success) {
1118 // FIXME: Script execution should be shared between 1126 // FIXME: Script execution should be shared between
1119 // the libxml2 and Qt XMLDocumentParser implementations. 1127 // the libxml2 and Qt XMLDocumentParser implementations.
1120 1128
1121 if (script_loader->ReadyToBeParserExecuted()) { 1129 if (script_loader->ReadyToBeParserExecuted()) {
1122 if (!script_loader->ExecuteScript(ClassicScript::Create(ScriptSourceCode( 1130 if (!script_loader->ExecuteScript(ClassicScript::Create(ScriptSourceCode(
1123 script_loader->ScriptContent(), GetDocument()->Url(), 1131 script_loader->ScriptContent(), GetDocument()->Url(),
1124 script_start_position_)))) { 1132 script_start_position_)))) {
1125 script_loader->DispatchErrorEvent(); 1133 script_loader->DispatchErrorEvent();
1126 return; 1134 return;
1127 } 1135 }
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 RefPtr<XMLParserContext> parser = 1727 RefPtr<XMLParserContext> parser =
1720 XMLParserContext::CreateStringParser(&sax, &state); 1728 XMLParserContext::CreateStringParser(&sax, &state);
1721 String parse_string = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1729 String parse_string = "<?xml version=\"1.0\"?><attrs " + string + " />";
1722 ParseChunk(parser->Context(), parse_string); 1730 ParseChunk(parser->Context(), parse_string);
1723 FinishParsing(parser->Context()); 1731 FinishParsing(parser->Context());
1724 attrs_ok = state.got_attributes; 1732 attrs_ok = state.got_attributes;
1725 return state.attributes; 1733 return state.attributes;
1726 } 1734 }
1727 1735
1728 } // namespace blink 1736 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698