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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 } | 511 } |
512 | 512 |
513 // See the comment in ScriptLoader.cpp about why this check is necessary | 513 // See the comment in ScriptLoader.cpp about why this check is necessary |
514 // here. https://crbug.com/500701. | 514 // here. https://crbug.com/500701. |
515 if (!cachedStyleSheet->errorOccurred() && !SubresourceIntegrity::CheckSubres
ourceIntegrity(*m_owner, cachedStyleSheet->sheetText(), KURL(baseURL, href), *ca
chedStyleSheet)) { | 515 if (!cachedStyleSheet->errorOccurred() && !SubresourceIntegrity::CheckSubres
ourceIntegrity(*m_owner, cachedStyleSheet->sheetText(), KURL(baseURL, href), *ca
chedStyleSheet)) { |
516 m_loading = false; | 516 m_loading = false; |
517 removePendingSheet(); | 517 removePendingSheet(); |
518 notifyLoadedSheetAndAllCriticalSubresources(Node::ErrorOccurredLoadingSu
bresource); | 518 notifyLoadedSheetAndAllCriticalSubresources(Node::ErrorOccurredLoadingSu
bresource); |
519 return; | 519 return; |
520 } | 520 } |
521 | 521 // While the stylesheet is asynchronously loading, the owner can be moved un
der |
| 522 // shadow tree. In that case, cancel any processing on the loaded content. |
| 523 if (m_owner->isInShadowTree()) { |
| 524 m_loading = false; |
| 525 removePendingSheet(); |
| 526 if (m_sheet) |
| 527 clearSheet(); |
| 528 return; |
| 529 } |
522 // Completing the sheet load may cause scripts to execute. | 530 // Completing the sheet load may cause scripts to execute. |
523 RefPtrWillBeRawPtr<Node> protector(m_owner.get()); | 531 RefPtrWillBeRawPtr<Node> protector(m_owner.get()); |
524 | 532 |
525 CSSParserContext parserContext(m_owner->document(), 0, baseURL, charset); | 533 CSSParserContext parserContext(m_owner->document(), 0, baseURL, charset); |
526 | 534 |
527 if (RefPtrWillBeRawPtr<StyleSheetContents> restoredSheet = const_cast<CSSSty
leSheetResource*>(cachedStyleSheet)->restoreParsedStyleSheet(parserContext)) { | 535 if (RefPtrWillBeRawPtr<StyleSheetContents> restoredSheet = const_cast<CSSSty
leSheetResource*>(cachedStyleSheet)->restoreParsedStyleSheet(parserContext)) { |
528 ASSERT(restoredSheet->isCacheable()); | 536 ASSERT(restoredSheet->isCacheable()); |
529 ASSERT(!restoredSheet->isLoading()); | 537 ASSERT(!restoredSheet->isLoading()); |
530 | 538 |
531 if (m_sheet) | 539 if (m_sheet) |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 removePendingSheet(); | 778 removePendingSheet(); |
771 } | 779 } |
772 | 780 |
773 DEFINE_TRACE(LinkStyle) | 781 DEFINE_TRACE(LinkStyle) |
774 { | 782 { |
775 visitor->trace(m_sheet); | 783 visitor->trace(m_sheet); |
776 LinkResource::trace(visitor); | 784 LinkResource::trace(visitor); |
777 } | 785 } |
778 | 786 |
779 } // namespace blink | 787 } // namespace blink |
OLD | NEW |