OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/html/LinkStyle.h" | 5 #include "core/html/LinkStyle.h" |
6 | 6 |
7 #include "core/css/StyleSheetContents.h" | 7 #include "core/css/StyleSheetContents.h" |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 #include "core/frame/LocalFrameClient.h" | 9 #include "core/frame/LocalFrameClient.h" |
10 #include "core/frame/SubresourceIntegrity.h" | 10 #include "core/frame/SubresourceIntegrity.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 // cachedStyleSheet->resourceBuffer() can be nullptr on load success. | 83 // cachedStyleSheet->resourceBuffer() can be nullptr on load success. |
84 // If response size == 0. | 84 // If response size == 0. |
85 const char* data = nullptr; | 85 const char* data = nullptr; |
86 size_t size = 0; | 86 size_t size = 0; |
87 if (cachedStyleSheet->resourceBuffer()) { | 87 if (cachedStyleSheet->resourceBuffer()) { |
88 data = cachedStyleSheet->resourceBuffer()->data(); | 88 data = cachedStyleSheet->resourceBuffer()->data(); |
89 size = cachedStyleSheet->resourceBuffer()->size(); | 89 size = cachedStyleSheet->resourceBuffer()->size(); |
90 } | 90 } |
91 checkResult = SubresourceIntegrity::CheckSubresourceIntegrity( | 91 checkResult = SubresourceIntegrity::CheckSubresourceIntegrity( |
92 *m_owner, data, size, KURL(baseURL, href), *cachedStyleSheet); | 92 m_owner->fastGetAttribute(HTMLNames::integrityAttr), |
| 93 m_owner->document(), data, size, KURL(baseURL, href), |
| 94 *cachedStyleSheet); |
93 disposition = checkResult ? ResourceIntegrityDisposition::Passed | 95 disposition = checkResult ? ResourceIntegrityDisposition::Passed |
94 : ResourceIntegrityDisposition::Failed; | 96 : ResourceIntegrityDisposition::Failed; |
95 | 97 |
96 // TODO(kouhei): Remove this const_cast crbug.com/653502 | 98 // TODO(kouhei): Remove this const_cast crbug.com/653502 |
97 const_cast<CSSStyleSheetResource*>(cachedStyleSheet) | 99 const_cast<CSSStyleSheetResource*>(cachedStyleSheet) |
98 ->setIntegrityDisposition(disposition); | 100 ->setIntegrityDisposition(disposition); |
99 } | 101 } |
100 | 102 |
101 if (disposition == ResourceIntegrityDisposition::Failed) { | 103 if (disposition == ResourceIntegrityDisposition::Failed) { |
102 m_loading = false; | 104 m_loading = false; |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 removePendingSheet(); | 417 removePendingSheet(); |
416 } | 418 } |
417 | 419 |
418 DEFINE_TRACE(LinkStyle) { | 420 DEFINE_TRACE(LinkStyle) { |
419 visitor->trace(m_sheet); | 421 visitor->trace(m_sheet); |
420 LinkResource::trace(visitor); | 422 LinkResource::trace(visitor); |
421 ResourceOwner<StyleSheetResource>::trace(visitor); | 423 ResourceOwner<StyleSheetResource>::trace(visitor); |
422 } | 424 } |
423 | 425 |
424 } // namespace blink | 426 } // namespace blink |
OLD | NEW |