Chromium Code Reviews| Index: third_party/WebKit/Source/core/html/HTMLLinkElement.cpp |
| diff --git a/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp b/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp |
| index a27a6472c4f8e94e1e0fe0c212804be928e867b0..47953c95c3ce4f91c8f7a463af8a5b5c0714060e 100644 |
| --- a/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp |
| +++ b/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp |
| @@ -434,19 +434,21 @@ void LinkStyle::setCSSStyleSheet( |
| ResourceIntegrityDisposition disposition = |
| cachedStyleSheet->integrityDisposition(); |
| - DCHECK(disposition != ResourceIntegrityDisposition::NotChecked || |
| - !cachedStyleSheet->sheetText().isNull()); |
| - |
| if (disposition == ResourceIntegrityDisposition::NotChecked && |
| !cachedStyleSheet->loadFailedOrCanceled()) { |
| - DCHECK(cachedStyleSheet->resourceBuffer()); |
| - if (SubresourceIntegrity::CheckSubresourceIntegrity( |
| - *m_owner, cachedStyleSheet->resourceBuffer()->data(), |
| - cachedStyleSheet->resourceBuffer()->size(), KURL(baseURL, href), |
| - *cachedStyleSheet)) |
| - disposition = ResourceIntegrityDisposition::Passed; |
| - else |
| - disposition = ResourceIntegrityDisposition::Failed; |
| + bool checkResult; |
| + if (cachedStyleSheet->resourceBuffer()) { |
|
jww
2016/10/14 17:42:11
nit: This could be simplified by having a const ch
kouhei (in TOK)
2016/10/17 01:23:38
Done.
|
| + checkResult = SubresourceIntegrity::CheckSubresourceIntegrity( |
| + *m_owner, cachedStyleSheet->resourceBuffer()->data(), |
| + cachedStyleSheet->resourceBuffer()->size(), KURL(baseURL, href), |
| + *cachedStyleSheet); |
| + } else { |
| + // If resourceBuffer is nullptr, the resource content-size was 0. |
| + checkResult = SubresourceIntegrity::CheckSubresourceIntegrity( |
| + *m_owner, nullptr, 0, KURL(baseURL, href), *cachedStyleSheet); |
| + } |
| + disposition = checkResult ? ResourceIntegrityDisposition::Passed |
| + : ResourceIntegrityDisposition::Failed; |
| // TODO(kouhei): Remove this const_cast crbug.com/653502 |
| const_cast<CSSStyleSheetResource*>(cachedStyleSheet) |