diff options
| author | adamk <adamk@chromium.org> | 2016-03-18 13:55:38 -0700 |
|---|---|---|
| committer | Commit bot <commit-bot@chromium.org> | 2016-03-18 20:57:19 +0000 |
| commit | 7e4a661dd6f79f847d878be5651d8e7bd662a7f4 (patch) | |
| tree | 92724268c309d8f989a8021bac6a27daad750b70 | |
| parent | b08bdf233f2c04e6567908e106998daecbe51317 (diff) | |
| download | chromium_src-7e4a661dd6f79f847d878be5651d8e7bd662a7f4.zip chromium_src-7e4a661dd6f79f847d878be5651d8e7bd662a7f4.tar.gz chromium_src-7e4a661dd6f79f847d878be5651d8e7bd662a7f4.tar.bz2 | |
Add runtime flag for <script type="module">
Also exercise it in a very basic way in ScriptLoader (at the moment,
<script type="module"> is treated the same as <script>).
See intent-to-implement:
https://groups.google.com/a/chromium.org/d/msg/blink-dev/uba6pMr-jec/tXdg6YYPBAAJ
BUG=594639
Review URL: https://codereview.chromium.org/1807293004
Cr-Commit-Position: refs/heads/master@{#382083}
4 files changed, 25 insertions, 0 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLScriptElement/module-script-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/HTMLScriptElement/module-script-expected.txt new file mode 100644 index 0000000..dfd9e5b --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLScriptElement/module-script-expected.txt @@ -0,0 +1,11 @@ +Test basic module execution. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +Module scripts should be executed... +...and should ignore any 'language' attribute +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLScriptElement/module-script.html b/third_party/WebKit/LayoutTests/fast/dom/HTMLScriptElement/module-script.html new file mode 100644 index 0000000..959ffaa --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLScriptElement/module-script.html @@ -0,0 +1,11 @@ +<script src="../../../resources/js-test.js"></script> +<script> +description("Test basic module execution."); +</script> +<script type="module"> +debug("Module scripts should be executed..."); +</script> +<script type="module" language="nonsense"> +debug("...and should ignore any 'language' attribute"); +</script> + diff --git a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp index b33f34f..7197892 100644 --- a/third_party/WebKit/Source/core/dom/ScriptLoader.cpp +++ b/third_party/WebKit/Source/core/dom/ScriptLoader.cpp @@ -175,6 +175,8 @@ bool ScriptLoader::isScriptTypeSupported(LegacyTypeSupport supportLegacyTypes) c type = "text/" + language.lower(); if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(type) || isLegacySupportedJavaScriptLanguage(language)) return true; + } else if (RuntimeEnabledFeatures::moduleScriptsEnabled() && type == "module") { + return true; } else if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(type.stripWhiteSpace()) || (supportLegacyTypes == AllowLegacyTypeInTypeAttribute && isLegacySupportedJavaScriptLanguage(type))) { return true; } diff --git a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in index b7c2bcf..2f54c21 100644 --- a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in +++ b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in @@ -121,6 +121,7 @@ MediaSourceExperimental status=experimental MediaStreamSpeech status=experimental MemoryInfoInWorkers status=experimental MobileLayoutTheme +ModuleScripts status=test NavigatorConnect status=experimental NavigatorContentUtils WebNFC status=experimental |
