Changeset 204221 in webkit
- Timestamp:
- Aug 5, 2016 11:28:24 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r204220 r204221 1 2016-08-05 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 [ES6] Add ScriptElement::determineScriptType 4 https://bugs.webkit.org/show_bug.cgi?id=149576 5 6 Reviewed by Ryosuke Niwa. 7 8 Change ScriptElement::isScriptTypeSupported to ScriptElement::determineScriptType. 9 And introduce ScriptType, which is either "classic" or "module". 10 And support "module" type in ScriptElement[1, 2]. 11 But this patch does not contain any module tag support code. 12 This will be implemented in the subsequent patch. 13 14 [1]: https://html.spec.whatwg.org/multipage/webappapis.html#integration-with-the-javascript-module-system 15 [2]: https://html.spec.whatwg.org/multipage/scripting.html#attr-script-type 16 17 * dom/ScriptElement.cpp: 18 (WebCore::ScriptElement::determineScriptType): 19 (WebCore::ScriptElement::prepareScript): 20 (WebCore::ScriptElement::isScriptTypeSupported): Deleted. 21 * dom/ScriptElement.h: 22 1 23 2016-08-05 Jonathan Bedard <jbedard@apple.com> 2 24 -
trunk/Source/WebCore/dom/ScriptElement.cpp
r204014 r204221 146 146 } 147 147 148 bool ScriptElement::isScriptTypeSupported(LegacyTypeSupport supportLegacyTypes) const148 Optional<ScriptElement::ScriptType> ScriptElement::determineScriptType(LegacyTypeSupport supportLegacyTypes) const 149 149 { 150 150 // FIXME: isLegacySupportedJavaScriptLanguage() is not valid HTML5. It is used here to maintain backwards compatibility with existing layout tests. The specific violations are: … … 155 155 if (type.isEmpty()) { 156 156 if (language.isEmpty()) 157 return true; // Assume text/javascript.157 return ScriptType::Classic; // Assume text/javascript. 158 158 if (MIMETypeRegistry::isSupportedJavaScriptMIMEType("text/" + language)) 159 return true;159 return ScriptType::Classic; 160 160 if (isLegacySupportedJavaScriptLanguage(language)) 161 return true;162 return false;161 return ScriptType::Classic; 162 return Nullopt; 163 163 } 164 164 if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(type.stripWhiteSpace())) 165 return true;165 return ScriptType::Classic; 166 166 if (supportLegacyTypes == AllowLegacyTypeInTypeAttribute && isLegacySupportedJavaScriptLanguage(type)) 167 return true; 168 return false; 167 return ScriptType::Classic; 168 #if ENABLE(ES6_MODULES) 169 // https://html.spec.whatwg.org/multipage/scripting.html#attr-script-type 170 // Setting the attribute to an ASCII case-insensitive match for the string "module" means that the script is a module script. 171 if (equalLettersIgnoringASCIICase(type, "module")) 172 return ScriptType::Module; 173 #endif 174 return Nullopt; 169 175 } 170 176 … … 192 198 return false; 193 199 194 if (! isScriptTypeSupported(supportLegacyTypes))200 if (!determineScriptType(supportLegacyTypes)) 195 201 return false; 196 202 -
trunk/Source/WebCore/dom/ScriptElement.h
r200340 r204221 54 54 virtual void dispatchLoadEvent() = 0; 55 55 void dispatchErrorEvent(); 56 bool isScriptTypeSupported(LegacyTypeSupport) const;57 56 58 57 bool haveFiredLoadEvent() const { return m_haveFiredLoad; } … … 78 77 79 78 private: 79 // https://html.spec.whatwg.org/multipage/scripting.html#concept-script-type 80 enum class ScriptType { Classic, Module }; 81 Optional<ScriptType> determineScriptType(LegacyTypeSupport) const; 80 82 bool ignoresLoadRequest() const; 81 83 bool isScriptForEventSupported() const;
Note: See TracChangeset
for help on using the changeset viewer.