This was recently added to the spec in https://github.com/whatwg/html/commit/9275d955dcd604e959cfcc672e0c234b1b8c00db . It applies to the top-level fetch only. Spec: https://html.spec.whatwg.org/#prepare-a-script step 18 and step 22.6. Test: http://w3c-test.org/html/semantics/scripting-1/the-script-element/module/integrity.html
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/73949801487c40aebb7e204e33de7b6eca41b64e commit 73949801487c40aebb7e204e33de7b6eca41b64e Author: Hiroshige Hayashizaki <hiroshige@chromium.org> Date: Fri Oct 27 17:59:54 2017 Support multiple ConsoleMessages in ModuleScriptFetcher This is preparation for [1], because [1] will add possibly multiple subresource-integrity-related messages there. [1] https://chromium-review.googlesource.com/c/chromium/src/+/738221 This CL also stops nullifying |error_messages| in DocumentModuleScriptFetcher::NotifyFinished() in success cases and uses const reference for |error_messages|, because https://chromium-review.googlesource.com/c/chromium/src/+/738221 will cause console messages even in success cases (related to subresource integrity checks). Bug: 771486 , 772100 Change-Id: I2f719883142e652cb68ea13ddc0dd654c1e7b42f Reviewed-on: https://chromium-review.googlesource.com/738789 Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org> Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org> Cr-Commit-Position: refs/heads/master@{#512232} [modify] https://crrev.com/73949801487c40aebb7e204e33de7b6eca41b64e/third_party/WebKit/Source/core/loader/modulescript/DocumentModuleScriptFetcher.cpp [modify] https://crrev.com/73949801487c40aebb7e204e33de7b6eca41b64e/third_party/WebKit/Source/core/loader/modulescript/DocumentModuleScriptFetcher.h [modify] https://crrev.com/73949801487c40aebb7e204e33de7b6eca41b64e/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptFetcher.cpp [modify] https://crrev.com/73949801487c40aebb7e204e33de7b6eca41b64e/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptFetcher.h [modify] https://crrev.com/73949801487c40aebb7e204e33de7b6eca41b64e/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoader.cpp [modify] https://crrev.com/73949801487c40aebb7e204e33de7b6eca41b64e/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoader.h [modify] https://crrev.com/73949801487c40aebb7e204e33de7b6eca41b64e/third_party/WebKit/Source/core/loader/modulescript/WorkletModuleScriptFetcher.cpp [modify] https://crrev.com/73949801487c40aebb7e204e33de7b6eca41b64e/third_party/WebKit/Source/core/loader/modulescript/WorkletModuleScriptFetcher.h [modify] https://crrev.com/73949801487c40aebb7e204e33de7b6eca41b64e/third_party/WebKit/Source/core/workers/WorkletModuleResponsesMap.cpp
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/17090875f3106056a0d1cb897066ead3573c03f8 commit 17090875f3106056a0d1cb897066ead3573c03f8 Author: Hiroshige Hayashizaki <hiroshige@chromium.org> Date: Tue Oct 31 00:13:40 2017 Add IntegrityMetadataSet to ScriptFetchOptions This CL - introduces integrity-related members to ScriptFetchOptions, - sets them in PrepareScript(), WorkletGlobalScope.cpp and DynamicModuleResolver.cpp as specced, and - uses them for classic scripts, in ClassicPendingScript::Fetch(). For module scripts, the integrity-related members are not used, and are sometimes set incorrectly. This will be fixed in a subsequent CL. Bug: 771486 , 772100 Change-Id: I0983bc6ad02b73472d67bf1b2ce169d2d71c5be3 Reviewed-on: https://chromium-review.googlesource.com/736721 Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org> Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Reviewed-by: Yutaka Hirano <yhirano@chromium.org> Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org> Cr-Commit-Position: refs/heads/master@{#512685} [modify] https://crrev.com/17090875f3106056a0d1cb897066ead3573c03f8/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp [modify] https://crrev.com/17090875f3106056a0d1cb897066ead3573c03f8/third_party/WebKit/Source/core/dom/ClassicPendingScript.h [modify] https://crrev.com/17090875f3106056a0d1cb897066ead3573c03f8/third_party/WebKit/Source/core/dom/DynamicModuleResolver.cpp [modify] https://crrev.com/17090875f3106056a0d1cb897066ead3573c03f8/third_party/WebKit/Source/core/dom/ScriptLoader.cpp [modify] https://crrev.com/17090875f3106056a0d1cb897066ead3573c03f8/third_party/WebKit/Source/core/dom/ScriptLoader.h [modify] https://crrev.com/17090875f3106056a0d1cb897066ead3573c03f8/third_party/WebKit/Source/core/workers/WorkletGlobalScope.cpp [modify] https://crrev.com/17090875f3106056a0d1cb897066ead3573c03f8/third_party/WebKit/Source/platform/loader/fetch/ScriptFetchOptions.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/214d16835a233ef1e01bcf54412803cc3593ce8e commit 214d16835a233ef1e01bcf54412803cc3593ce8e Author: Hiroshige Hayashizaki <hiroshige@chromium.org> Date: Tue Oct 31 01:50:26 2017 Support integrity attribute for module scripts This CL enables subresource integrity check for module scripts, by - Clearing ScriptFetchOptions' integrity for descendant module scripts in ModuleTreeLinker.cpp, as specced, - Setting FetchParameters' integrity according to ScriptFetchOptions in ModuleScriptLoader::Fetch(), and - Checking the integrity check result in WasModuleLoadSuccessful() and reports console messages if any. For this, SubresourceIntegrityHelper::GetConsoleMessages() is introduced. Bug: 771486 , 772100 Change-Id: I3f01fd018dad625de9440fe4ab7e1d9ee7feb5ab Reviewed-on: https://chromium-review.googlesource.com/738221 Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org> Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org> Cr-Commit-Position: refs/heads/master@{#512705} [delete] https://crrev.com/c7cb3e9057a8420d0f54db86dc581bc33b94e4c9/third_party/WebKit/LayoutTests/external/wpt/html/semantics/scripting-1/the-script-element/module/integrity-expected.txt [modify] https://crrev.com/214d16835a233ef1e01bcf54412803cc3593ce8e/third_party/WebKit/Source/core/loader/SubresourceIntegrityHelper.cpp [modify] https://crrev.com/214d16835a233ef1e01bcf54412803cc3593ce8e/third_party/WebKit/Source/core/loader/SubresourceIntegrityHelper.h [modify] https://crrev.com/214d16835a233ef1e01bcf54412803cc3593ce8e/third_party/WebKit/Source/core/loader/modulescript/DocumentModuleScriptFetcher.cpp [modify] https://crrev.com/214d16835a233ef1e01bcf54412803cc3593ce8e/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoader.cpp [modify] https://crrev.com/214d16835a233ef1e01bcf54412803cc3593ce8e/third_party/WebKit/Source/core/loader/modulescript/ModuleTreeLinker.cpp
Comment 1 by hirosh...@chromium.org
, Oct 25 2017Owner: hirosh...@chromium.org
Status: Started (was: Untriaged)