Index: third_party/WebKit/Source/core/dom/ScriptLoader.cpp |
diff --git a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp |
index 77cc040f3400f0f5af8bc9f49e42ae0b41fe73e9..2d88ea70e80e02637399b2b291e3f557a40ef673 100644 |
--- a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp |
+++ b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp |
@@ -159,7 +159,16 @@ void ScriptLoader::DispatchLoadEvent() { |
bool ScriptLoader::IsValidScriptTypeAndLanguage( |
const String& type, |
const String& language, |
+ bool nomodule, |
LegacyTypeSupport support_legacy_types) { |
+ if (RuntimeEnabledFeatures::moduleScriptsEnabled()) { |
+ if (type == "module") |
+ return true; |
+ // https://html.spec.whatwg.org/#prepare-a-script, Step 11. |
hiroshige
2017/04/15 00:45:09
IsValidScriptTypeAndLanguage() is called as Step 6
Nate Chapin
2017/04/19 20:28:27
Added ScriptLoader::BlockForNoModule()
|
+ if (nomodule) |
+ return false; |
+ } |
+ |
// FIXME: isLegacySupportedJavaScriptLanguage() is not valid HTML5. It is used |
// here to maintain backwards compatibility with existing layout tests. The |
// specific violations are: |
@@ -172,9 +181,6 @@ bool ScriptLoader::IsValidScriptTypeAndLanguage( |
MIMETypeRegistry::IsSupportedJavaScriptMIMEType("text/" + |
language) || |
MIMETypeRegistry::IsLegacySupportedJavaScriptLanguage(language); |
- } else if (RuntimeEnabledFeatures::moduleScriptsEnabled() && |
- type == "module") { |
- return true; |
} else if (MIMETypeRegistry::IsSupportedJavaScriptMIMEType( |
type.StripWhiteSpace()) || |
(support_legacy_types == kAllowLegacyTypeInTypeAttribute && |
@@ -187,9 +193,9 @@ bool ScriptLoader::IsValidScriptTypeAndLanguage( |
bool ScriptLoader::IsScriptTypeSupported( |
LegacyTypeSupport support_legacy_types) const { |
- return IsValidScriptTypeAndLanguage(element_->TypeAttributeValue(), |
- element_->LanguageAttributeValue(), |
- support_legacy_types); |
+ return IsValidScriptTypeAndLanguage( |
+ element_->TypeAttributeValue(), element_->LanguageAttributeValue(), |
+ element_->NomoduleAttributeValue(), support_legacy_types); |
} |
// https://html.spec.whatwg.org/#prepare-a-script |