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..7b5cfd145bd2136c74b40fc4c2ef13be5512615f 100644 |
| --- a/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp |
| +++ b/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp |
| @@ -434,19 +434,22 @@ 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; |
| + |
| + // cachedStyleSheet->resourceBuffer() can be nullptr on load success. |
| + // If response size == 0. |
| + const char* data = nullptr; |
| + size_t size = 0; |
| + if (cachedStyleSheet->resourceBuffer()) { |
| + data = cachedStyleSheet->resourceBuffer()->data(); |
| + size = cachedStyleSheet->resourceBuffer()->size(); |
| + } |
| + checkResult = SubresourceIntegrity::CheckSubresourceIntegrity( |
|
yhirano
2016/10/17 02:10:32
How about defining |checkResult| here?
|
| + *m_owner, data, size, KURL(baseURL, href), *cachedStyleSheet); |
| + disposition = checkResult ? ResourceIntegrityDisposition::Passed |
| + : ResourceIntegrityDisposition::Failed; |
| // TODO(kouhei): Remove this const_cast crbug.com/653502 |
| const_cast<CSSStyleSheetResource*>(cachedStyleSheet) |