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

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

Issue 2806523002: Move isLegacySupportedJavaScriptLanguage() to MIMETypeRegistry (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/network/mime/MIMETypeRegistry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 db640d8cb2dd13c97de3526463b65376dd7acc9a..bc799e4a33cd6ec9f015367f66920607c0f986f2 100644
--- a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
+++ b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp
@@ -147,31 +147,6 @@ void ScriptLoader::detachPendingScript() {
m_pendingScript = nullptr;
}
-static bool isLegacySupportedJavaScriptLanguage(const String& language) {
- // Mozilla 1.8 accepts javascript1.0 - javascript1.7, but WinIE 7 accepts only
- // javascript1.1 - javascript1.3.
- // Mozilla 1.8 and WinIE 7 both accept javascript and livescript.
- // WinIE 7 accepts ecmascript and jscript, but Mozilla 1.8 doesn't.
- // Neither Mozilla 1.8 nor WinIE 7 accept leading or trailing whitespace.
- // We want to accept all the values that either of these browsers accept, but
- // not other values.
-
- // FIXME: This function is not HTML5 compliant. These belong in the MIME
- // registry as "text/javascript<version>" entries.
- return equalIgnoringASCIICase(language, "javascript") ||
- equalIgnoringASCIICase(language, "javascript1.0") ||
- equalIgnoringASCIICase(language, "javascript1.1") ||
- equalIgnoringASCIICase(language, "javascript1.2") ||
- equalIgnoringASCIICase(language, "javascript1.3") ||
- equalIgnoringASCIICase(language, "javascript1.4") ||
- equalIgnoringASCIICase(language, "javascript1.5") ||
- equalIgnoringASCIICase(language, "javascript1.6") ||
- equalIgnoringASCIICase(language, "javascript1.7") ||
- equalIgnoringASCIICase(language, "livescript") ||
- equalIgnoringASCIICase(language, "ecmascript") ||
- equalIgnoringASCIICase(language, "jscript");
-}
-
void ScriptLoader::dispatchErrorEvent() {
m_element->dispatchErrorEvent();
}
@@ -196,14 +171,14 @@ bool ScriptLoader::isValidScriptTypeAndLanguage(
return language.isEmpty() || // assume text/javascript.
MIMETypeRegistry::isSupportedJavaScriptMIMEType("text/" +
language) ||
- isLegacySupportedJavaScriptLanguage(language);
+ MIMETypeRegistry::isLegacySupportedJavaScriptLanguage(language);
} else if (RuntimeEnabledFeatures::moduleScriptsEnabled() &&
type == "module") {
return true;
} else if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(
type.stripWhiteSpace()) ||
(supportLegacyTypes == AllowLegacyTypeInTypeAttribute &&
- isLegacySupportedJavaScriptLanguage(type))) {
+ MIMETypeRegistry::isLegacySupportedJavaScriptLanguage(type))) {
return true;
}
@@ -619,7 +594,8 @@ void ScriptLoader::logScriptMIMEType(LocalFrame* frame,
if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType))
return;
bool isText = mimeType.startsWith("text/", TextCaseASCIIInsensitive);
- if (isText && isLegacySupportedJavaScriptLanguage(mimeType.substring(5)))
+ if (isText && MIMETypeRegistry::isLegacySupportedJavaScriptLanguage(
+ mimeType.substring(5)))
return;
bool isSameOrigin =
m_element->document().getSecurityOrigin()->canRequest(resource->url());
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/network/mime/MIMETypeRegistry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698