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

Side by Side Diff: third_party/WebKit/Source/core/dom/ScriptLoader.cpp

Issue 1807293004: Add runtime flag for <script type="module"> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 6 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org>
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // - Allowing a different set of languages for language= and type=. language = supports Javascript 1.1 and 1.4-1.6, but type= does not. 168 // - Allowing a different set of languages for language= and type=. language = supports Javascript 1.1 and 1.4-1.6, but type= does not.
169 169
170 String type = client()->typeAttributeValue(); 170 String type = client()->typeAttributeValue();
171 String language = client()->languageAttributeValue(); 171 String language = client()->languageAttributeValue();
172 if (type.isEmpty() && language.isEmpty()) 172 if (type.isEmpty() && language.isEmpty())
173 return true; // Assume text/javascript. 173 return true; // Assume text/javascript.
174 if (type.isEmpty()) { 174 if (type.isEmpty()) {
175 type = "text/" + language.lower(); 175 type = "text/" + language.lower();
176 if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(type) || isLegacySup portedJavaScriptLanguage(language)) 176 if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(type) || isLegacySup portedJavaScriptLanguage(language))
177 return true; 177 return true;
178 } else if (RuntimeEnabledFeatures::moduleScriptsEnabled() && type == "module ") {
179 return true;
178 } else if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(type.stripWhiteSp ace()) || (supportLegacyTypes == AllowLegacyTypeInTypeAttribute && isLegacySuppo rtedJavaScriptLanguage(type))) { 180 } else if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(type.stripWhiteSp ace()) || (supportLegacyTypes == AllowLegacyTypeInTypeAttribute && isLegacySuppo rtedJavaScriptLanguage(type))) {
179 return true; 181 return true;
180 } 182 }
181 183
182 return false; 184 return false;
183 } 185 }
184 186
185 // http://dev.w3.org/html5/spec/Overview.html#prepare-a-script 187 // http://dev.w3.org/html5/spec/Overview.html#prepare-a-script
186 bool ScriptLoader::prepareScript(const TextPosition& scriptStartPosition, Legacy TypeSupport supportLegacyTypes) 188 bool ScriptLoader::prepareScript(const TextPosition& scriptStartPosition, Legacy TypeSupport supportLegacyTypes)
187 { 189 {
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 if (isHTMLScriptLoader(element)) 515 if (isHTMLScriptLoader(element))
514 return toHTMLScriptElement(element)->loader(); 516 return toHTMLScriptElement(element)->loader();
515 517
516 if (isSVGScriptLoader(element)) 518 if (isSVGScriptLoader(element))
517 return toSVGScriptElement(element)->loader(); 519 return toSVGScriptElement(element)->loader();
518 520
519 return 0; 521 return 0;
520 } 522 }
521 523
522 } // namespace blink 524 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698