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

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

Issue 2781713003: Enable module scripts in ScriptLoader (Closed)
Patch Set: Rebase Created 3 years, 8 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
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 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 script_element_base ? script_element_base->Loader() : nullptr; 1105 script_element_base ? script_element_base->Loader() : nullptr;
1106 if (!script_loader) { 1106 if (!script_loader) {
1107 PopCurrentNode(); 1107 PopCurrentNode();
1108 return; 1108 return;
1109 } 1109 }
1110 1110
1111 // Don't load external scripts for standalone documents (for now). 1111 // Don't load external scripts for standalone documents (for now).
1112 DCHECK(!pending_script_); 1112 DCHECK(!pending_script_);
1113 requesting_script_ = true; 1113 requesting_script_ = true;
1114 1114
1115 if (script_loader->PrepareScript( 1115 bool success = script_loader->PrepareScript(
1116 script_start_position_, 1116 script_start_position_, ScriptLoader::kAllowLegacyTypeInTypeAttribute);
1117 ScriptLoader::kAllowLegacyTypeInTypeAttribute)) { 1117
1118 // XMLDocumentParser does not support module scripts.
1119 // FOXME: (how) should we handle this? Should we fail more gracefully?
1120 CHECK_EQ(script_loader->GetScriptType(), ScriptType::kClassic);
kouhei (in TOK) 2017/04/24 01:24:04 If PrepareScript is ensured to fail in XML documen
hiroshige 2017/04/26 01:09:34 (Probably) no because ScriptLoader doesn't check w
kouhei (in TOK) 2017/04/26 02:05:27 Sorry for the back-and-forth (≧∞≦) Now I think Pre
hiroshige 2017/04/26 19:10:21 Hmm. To do so, I think PrepareScript() should take
1121
1122 if (success) {
1118 // FIXME: Script execution should be shared between 1123 // FIXME: Script execution should be shared between
1119 // the libxml2 and Qt XMLDocumentParser implementations. 1124 // the libxml2 and Qt XMLDocumentParser implementations.
1120 1125
1121 if (script_loader->ReadyToBeParserExecuted()) { 1126 if (script_loader->ReadyToBeParserExecuted()) {
1122 if (!script_loader->ExecuteScript(ClassicScript::Create(ScriptSourceCode( 1127 if (!script_loader->ExecuteScript(ClassicScript::Create(ScriptSourceCode(
1123 script_loader->ScriptContent(), GetDocument()->Url(), 1128 script_loader->ScriptContent(), GetDocument()->Url(),
1124 script_start_position_)))) { 1129 script_start_position_)))) {
1125 script_loader->DispatchErrorEvent(); 1130 script_loader->DispatchErrorEvent();
1126 return; 1131 return;
1127 } 1132 }
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 RefPtr<XMLParserContext> parser = 1724 RefPtr<XMLParserContext> parser =
1720 XMLParserContext::CreateStringParser(&sax, &state); 1725 XMLParserContext::CreateStringParser(&sax, &state);
1721 String parse_string = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1726 String parse_string = "<?xml version=\"1.0\"?><attrs " + string + " />";
1722 ParseChunk(parser->Context(), parse_string); 1727 ParseChunk(parser->Context(), parse_string);
1723 FinishParsing(parser->Context()); 1728 FinishParsing(parser->Context());
1724 attrs_ok = state.got_attributes; 1729 attrs_ok = state.got_attributes;
1725 return state.attributes; 1730 return state.attributes;
1726 } 1731 }
1727 1732
1728 } // namespace blink 1733 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698