summaryrefslogtreecommitdiffstats
path: root/WebCore/css/StyleSheet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/css/StyleSheet.cpp')
-rw-r--r--WebCore/css/StyleSheet.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/WebCore/css/StyleSheet.cpp b/WebCore/css/StyleSheet.cpp
index 0a719d1..68a0772 100644
--- a/WebCore/css/StyleSheet.cpp
+++ b/WebCore/css/StyleSheet.cpp
@@ -56,6 +56,14 @@ StyleSheet::~StyleSheet()
{
if (m_media)
m_media->setParent(0);
+
+ // For style rules outside the document, .parentStyleSheet can become null even if the style rule
+ // is still observable from JavaScript. This matches the behavior of .parentNode for nodes, but
+ // it's not ideal because it makes the CSSOM's behavior depend on the timing of garbage collection.
+ for (unsigned i = 0; i < length(); ++i) {
+ ASSERT(item(i)->parent() == this);
+ item(i)->setParent(0);
+ }
}
StyleSheet* StyleSheet::parentStyleSheet() const