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

Unified Diff: third_party/WebKit/Source/core/dom/ScriptLoader.cpp

Issue 2824583002: Implement <script nomodule> (Closed)
Patch Set: Fix a couple of tests I missed 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 side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptLoader.h ('k') | third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698