Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1130)

Unified Diff: third_party/WebKit/Source/core/css/CSSStyleSheet.cpp

Issue 1961173003: Corrected assert for cacheable stylesheets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698