Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. | 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. |
| 6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) | 6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) |
| 7 * Copyright (C) 2011 Google Inc. All rights reserved. | 7 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 419 m_loading = false; | 419 m_loading = false; |
| 420 removePendingSheet(); | 420 removePendingSheet(); |
| 421 if (m_sheet) | 421 if (m_sheet) |
| 422 clearSheet(); | 422 clearSheet(); |
| 423 return; | 423 return; |
| 424 } | 424 } |
| 425 | 425 |
| 426 // See the comment in PendingScript.cpp about why this check is necessary | 426 // See the comment in PendingScript.cpp about why this check is necessary |
| 427 // here, instead of in the resource fetcher. https://crbug.com/500701. | 427 // here, instead of in the resource fetcher. https://crbug.com/500701. |
| 428 if (!cachedStyleSheet->errorOccurred() && | 428 if (!cachedStyleSheet->errorOccurred() && |
| 429 m_owner->fastHasAttribute(HTMLNames::integrityAttr) && | 429 !m_owner->fastGetAttribute(HTMLNames::integrityAttr).isEmpty() && |
| 430 cachedStyleSheet->resourceBuffer() && | 430 !cachedStyleSheet->integrityMetadata().isEmpty()) { |
| 431 !SubresourceIntegrity::CheckSubresourceIntegrity( | 431 ResourceIntegrityDisposition disposition = |
| 432 *m_owner, cachedStyleSheet->resourceBuffer()->data(), | 432 cachedStyleSheet->integrityDisposition(); |
| 433 cachedStyleSheet->resourceBuffer()->size(), KURL(baseURL, href), | 433 |
| 434 *cachedStyleSheet)) { | 434 if (disposition == ResourceIntegrityDisposition::NotChecked) |
|
Charlie Harrison
2016/10/05 15:24:49
nit: A conditional branch just for a DCHECK isn't
kouhei (in TOK)
2016/10/06 12:02:36
Done.
| |
| 435 m_loading = false; | 435 DCHECK(!cachedStyleSheet->sheetText().isNull()); |
| 436 removePendingSheet(); | 436 |
| 437 notifyLoadedSheetAndAllCriticalSubresources( | 437 if (disposition == ResourceIntegrityDisposition::NotChecked && |
| 438 Node::ErrorOccurredLoadingSubresource); | 438 cachedStyleSheet->resourceBuffer()) { |
| 439 return; | 439 if (SubresourceIntegrity::CheckSubresourceIntegrity( |
| 440 *m_owner, cachedStyleSheet->resourceBuffer()->data(), | |
| 441 cachedStyleSheet->resourceBuffer()->size(), KURL(baseURL, href), | |
| 442 *cachedStyleSheet)) | |
| 443 disposition = ResourceIntegrityDisposition::Passed; | |
| 444 else | |
| 445 disposition = ResourceIntegrityDisposition::Failed; | |
| 446 | |
| 447 const_cast<CSSStyleSheetResource*>(cachedStyleSheet) | |
|
Charlie Harrison
2016/10/05 15:24:48
The const_cast is not ideal, but I can't think of
| |
| 448 ->setIntegrityDisposition(disposition); | |
| 449 } | |
| 450 | |
| 451 if (disposition == ResourceIntegrityDisposition::Failed) { | |
| 452 m_loading = false; | |
| 453 removePendingSheet(); | |
| 454 notifyLoadedSheetAndAllCriticalSubresources( | |
| 455 Node::ErrorOccurredLoadingSubresource); | |
| 456 return; | |
| 457 } | |
| 440 } | 458 } |
| 441 | 459 |
| 442 CSSParserContext parserContext(m_owner->document(), nullptr, baseURL, | 460 CSSParserContext parserContext(m_owner->document(), nullptr, baseURL, |
| 443 charset); | 461 charset); |
| 444 | 462 |
| 445 DEFINE_STATIC_LOCAL(EnumerationHistogram, restoredCachedStyleSheetHistogram, | 463 DEFINE_STATIC_LOCAL(EnumerationHistogram, restoredCachedStyleSheetHistogram, |
| 446 ("Blink.RestoredCachedStyleSheet", 2)); | 464 ("Blink.RestoredCachedStyleSheet", 2)); |
| 447 DEFINE_STATIC_LOCAL( | 465 DEFINE_STATIC_LOCAL( |
| 448 EnumerationHistogram, restoredCachedStyleSheet2Histogram, | 466 EnumerationHistogram, restoredCachedStyleSheet2Histogram, |
| 449 ("Blink.RestoredCachedStyleSheet2", StyleSheetCacheStatusCount)); | 467 ("Blink.RestoredCachedStyleSheet2", StyleSheetCacheStatusCount)); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 734 removePendingSheet(); | 752 removePendingSheet(); |
| 735 } | 753 } |
| 736 | 754 |
| 737 DEFINE_TRACE(LinkStyle) { | 755 DEFINE_TRACE(LinkStyle) { |
| 738 visitor->trace(m_sheet); | 756 visitor->trace(m_sheet); |
| 739 LinkResource::trace(visitor); | 757 LinkResource::trace(visitor); |
| 740 ResourceOwner<StyleSheetResource>::trace(visitor); | 758 ResourceOwner<StyleSheetResource>::trace(visitor); |
| 741 } | 759 } |
| 742 | 760 |
| 743 } // namespace blink | 761 } // namespace blink |
| OLD | NEW |