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

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

Issue 2824583002: Implement <script nomodule> (Closed)
Patch Set: Move script_type declaration 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 35e29537ea9ae8671e7364444d4f164221e8824b..6fb2ab939f8d779993049e9efcbc5bb988abf7b8 100644
--- a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
+++ b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
@@ -215,6 +215,11 @@ bool ScriptLoader::IsValidScriptTypeAndLanguage(
return false;
}
+bool ScriptLoader::BlockForNoModule(ScriptType script_type, bool nomodule) {
+ return nomodule && script_type == ScriptType::kClassic &&
+ RuntimeEnabledFeatures::moduleScriptsEnabled();
+}
+
bool ScriptLoader::IsScriptTypeSupported(LegacyTypeSupport support_legacy_types,
ScriptType& out_script_type) const {
return IsValidScriptTypeAndLanguage(element_->TypeAttributeValue(),
@@ -296,7 +301,8 @@ bool ScriptLoader::PrepareScript(const TextPosition& script_start_position,
// 11. "If the script element has a nomodule content attribute
// and the script's type is "classic", then abort these steps.
// The script is not executed."
- // TODO(japhet): Implement this step.
+ if (BlockForNoModule(script_type_, element_->NomoduleAttributeValue()))
+ return false;
// 13.
if (!IsScriptForEventSupported())
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptLoader.h ('k') | third_party/WebKit/Source/core/html/HTMLAttributeNames.json5 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698