const_cast is bad
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/afa48c3ed31f7229c306ce7cda62111be593f719 commit afa48c3ed31f7229c306ce7cda62111be593f719 Author: kouhei <kouhei@chromium.org> Date: Thu Oct 13 03:04:01 2016 CSSStyleSheetResource should cache decoded text instead of raw bytes Before this CL, CSSStyleSheetResource kept undecoded text alive, and decoded text whenever it was requested. After this CL, the decoded text is kept alive as cache. It discards undecoded text when the whole sheet text is loaded to avoid unnecessary memory usage. As a side-effect, CSSStyleSheetResource::sheetText is no longer const, as it may cache m_decodedSheetText. BUG= 642722 , 653502 Review-Url: https://codereview.chromium.org/2290983003 Cr-Commit-Position: refs/heads/master@{#424941} [add] https://crrev.com/afa48c3ed31f7229c306ce7cda62111be593f719/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/resources/mark-result-red.css [add] https://crrev.com/afa48c3ed31f7229c306ce7cda62111be593f719/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/resources/mark-result2-blue.css [add] https://crrev.com/afa48c3ed31f7229c306ce7cda62111be593f719/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-load-css-after-failed-integrity.html [modify] https://crrev.com/afa48c3ed31f7229c306ce7cda62111be593f719/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp [modify] https://crrev.com/afa48c3ed31f7229c306ce7cda62111be593f719/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.h [modify] https://crrev.com/afa48c3ed31f7229c306ce7cda62111be593f719/third_party/WebKit/Source/core/fetch/Resource.cpp [modify] https://crrev.com/afa48c3ed31f7229c306ce7cda62111be593f719/third_party/WebKit/Source/core/fetch/Resource.h [modify] https://crrev.com/afa48c3ed31f7229c306ce7cda62111be593f719/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp [modify] https://crrev.com/afa48c3ed31f7229c306ce7cda62111be593f719/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/3305344cb14705b1c8cb802cfd65e49d375aff85 commit 3305344cb14705b1c8cb802cfd65e49d375aff85 Author: Hiroshige Hayashizaki <hiroshige@chromium.org> Date: Wed Aug 02 22:14:28 2017 Move SubresourceIntegrity calls to Resource This CL moves SubresourceIntegrity calls to Resource, just before CheckNotify(), where Resource::Data() is always available. This makes - SubresourceIntegrity always checked if integrity metadata is set, and - SubresourceIntegrity and ResourceIntegrityDisposition control not depend on ResourceClients (ClassicPendingScript and LinkStyle). This removes Resource::SetIntegrityDisposition(), and and unblocks https://chromium-review.googlesource.com/c/562859/. This CL also makes Resource cache SubresourceIntegrity::ReportInfo in Resource, and thus outputs SRI console error messages and update UseCounters for every classic script and stylesheet that shares a Resource, not only for the first use ( Issue 585267 ). Bug: 746115 , 701943 , 585267 , 653502 Change-Id: I03e7c22319980bd297cb5d9fb58589966a0b2f71 Reviewed-on: https://chromium-review.googlesource.com/576950 Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Reviewed-by: Mike West <mkwst@chromium.org> Reviewed-by: Daniel Vogelheim <vogelheim@chromium.org> Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org> Cr-Commit-Position: refs/heads/master@{#491526} [modify] https://crrev.com/3305344cb14705b1c8cb802cfd65e49d375aff85/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/clear-integrity-attribute-expected.txt [modify] https://crrev.com/3305344cb14705b1c8cb802cfd65e49d375aff85/third_party/WebKit/LayoutTests/http/tests/security/subresourceIntegrity/shared-with-xhtml-expected.txt [modify] https://crrev.com/3305344cb14705b1c8cb802cfd65e49d375aff85/third_party/WebKit/Source/core/dom/ClassicPendingScript.cpp [modify] https://crrev.com/3305344cb14705b1c8cb802cfd65e49d375aff85/third_party/WebKit/Source/core/html/LinkStyle.cpp [modify] https://crrev.com/3305344cb14705b1c8cb802cfd65e49d375aff85/third_party/WebKit/Source/core/loader/resource/ScriptResource.cpp [modify] https://crrev.com/3305344cb14705b1c8cb802cfd65e49d375aff85/third_party/WebKit/Source/core/loader/resource/ScriptResource.h [modify] https://crrev.com/3305344cb14705b1c8cb802cfd65e49d375aff85/third_party/WebKit/Source/platform/loader/SubresourceIntegrity.cpp [modify] https://crrev.com/3305344cb14705b1c8cb802cfd65e49d375aff85/third_party/WebKit/Source/platform/loader/SubresourceIntegrity.h [modify] https://crrev.com/3305344cb14705b1c8cb802cfd65e49d375aff85/third_party/WebKit/Source/platform/loader/fetch/Resource.cpp [modify] https://crrev.com/3305344cb14705b1c8cb802cfd65e49d375aff85/third_party/WebKit/Source/platform/loader/fetch/Resource.h
Comment 1 by bugdroid1@chromium.org
, Oct 13 2016