Index: third_party/WebKit/Source/core/css/CSSStyleSheet.cpp |
diff --git a/third_party/WebKit/Source/core/css/CSSStyleSheet.cpp b/third_party/WebKit/Source/core/css/CSSStyleSheet.cpp |
index d715f78fbc66c0be0b8b01c01389ff72722d8af6..bd4773f8e3088ca945b3e988e3a68d266b40e041 100644 |
--- a/third_party/WebKit/Source/core/css/CSSStyleSheet.cpp |
+++ b/third_party/WebKit/Source/core/css/CSSStyleSheet.cpp |
@@ -135,6 +135,15 @@ CSSStyleSheet::~CSSStyleSheet() |
{ |
} |
+#if ENABLE(ASSERT) |
+ |
+static bool isStyleElement(const Node* node) |
+{ |
+ return node && (isHTMLStyleElement(node) || isSVGStyleElement(node)); |
+} |
+ |
+#endif // ENABLE(ASSERT) |
+ |
void CSSStyleSheet::willMutateRules() |
{ |
// If we are the only client it is safe to mutate. |
@@ -146,7 +155,8 @@ void CSSStyleSheet::willMutateRules() |
return; |
} |
// Only cacheable stylesheets should have multiple clients. |
- ASSERT(m_contents->isCacheable()); |
+ ASSERT((isStyleElement(ownerNode()) && m_contents->isCacheableForStyleElement()) |
+ || m_contents->isCacheableForResource()); |
// Copy-on-write. |
m_contents->unregisterClient(this); |