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

Unified Diff: third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.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/html/parser/HTMLPreloadScanner.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
index ac9f57685fa59c327e5caace1e1f3f26a9554334..afbd37486b3cc38d4e9b356f3454e707d2db2dc4 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
@@ -144,6 +144,7 @@ class TokenPreloadScanner::StartTagScanner {
link_is_import_(false),
matched_(true),
input_is_image_(false),
+ nomodule_attribute_value_(false),
source_size_(0),
source_size_set_(false),
defer_(FetchParameters::kNoDefer),
@@ -289,6 +290,8 @@ class TokenPreloadScanner::StartTagScanner {
type_attribute_value_ = attribute_value;
else if (Match(attribute_name, languageAttr))
language_attribute_value_ = attribute_value;
+ else if (Match(attribute_name, nomoduleAttr))
+ nomodule_attribute_value_ = true;
}
template <typename NameType>
@@ -521,12 +524,17 @@ class TokenPreloadScanner::StartTagScanner {
return ShouldPreloadLink(type);
if (Match(tag_impl_, inputTag) && !input_is_image_)
return false;
- ScriptType script_type = ScriptType::kClassic;
- if (Match(tag_impl_, scriptTag) &&
- !ScriptLoader::IsValidScriptTypeAndLanguage(
- type_attribute_value_, language_attribute_value_,
- ScriptLoader::kAllowLegacyTypeInTypeAttribute, script_type)) {
- return false;
+ if (Match(tag_impl_, scriptTag)) {
+ ScriptType script_type = ScriptType::kClassic;
+ if (!ScriptLoader::IsValidScriptTypeAndLanguage(
+ type_attribute_value_, language_attribute_value_,
+ ScriptLoader::kAllowLegacyTypeInTypeAttribute, script_type)) {
+ return false;
+ }
+ if (ScriptLoader::BlockForNoModule(script_type,
+ nomodule_attribute_value_)) {
+ return false;
+ }
}
return true;
}
@@ -556,6 +564,7 @@ class TokenPreloadScanner::StartTagScanner {
String as_attribute_value_;
String type_attribute_value_;
String language_attribute_value_;
+ bool nomodule_attribute_value_;
float source_size_;
bool source_size_set_;
FetchParameters::DeferOption defer_;
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLScriptElement.idl ('k') | third_party/WebKit/Source/core/svg/SVGScriptElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698