Index: Source/core/dom/ProcessingInstruction.cpp |
diff --git a/Source/core/dom/ProcessingInstruction.cpp b/Source/core/dom/ProcessingInstruction.cpp |
index 59df65c9773d09395286a316cbb85d838c773867..a7d93d495715b45fc2e94075b9ebeb526a9d1213 100644 |
--- a/Source/core/dom/ProcessingInstruction.cpp |
+++ b/Source/core/dom/ProcessingInstruction.cpp |
@@ -59,8 +59,15 @@ ProcessingInstruction::~ProcessingInstruction() |
if (m_sheet) |
m_sheet->clearOwnerNode(); |
- if (inDocument()) |
- document().styleEngine()->removeStyleSheetCandidateNode(this); |
+ // FIXME: ProcessingInstruction should not be in document here. |
+ // However, if we add ASSERT(!inDocument()), fast/xsl/xslt-entity.xml |
+ // crashes. We need to investigate ProcessingInstruction lifetime. |
+ if (inDocument()) { |
+ if (m_isCSS) |
+ document().styleEngine()->removeStyleSheetCandidateNode(this); |
+ else if (m_isXSL) |
+ document().styleEngine()->removeXSLStyleSheet(this); |
+ } |
#endif |
} |
@@ -242,11 +249,11 @@ Node::InsertionNotificationRequest ProcessingInstruction::insertedInto(Container |
String href; |
String charset; |
- // To make it possible for us to see isXSL in |
- // StyleEngine::addStyleSheetCandidateNode, split checkStyleSheet |
- // into two methods, checkStyleSheet and process. |
bool isValid = checkStyleSheet(href, charset); |
- document().styleEngine()->addStyleSheetCandidateNode(this, m_createdByParser); |
+ if (m_isCSS) |
+ document().styleEngine()->addStyleSheetCandidateNode(this, m_createdByParser); |
+ else if (m_isXSL) |
+ document().styleEngine()->addXSLStyleSheet(this, m_createdByParser); |
if (isValid) |
process(href, charset); |
return InsertionDone; |
@@ -258,7 +265,10 @@ void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint) |
if (!insertionPoint->inDocument()) |
return; |
- document().styleEngine()->removeStyleSheetCandidateNode(this); |
+ if (m_isCSS) |
+ document().styleEngine()->removeStyleSheetCandidateNode(this); |
+ else if (m_isXSL) |
+ document().styleEngine()->removeXSLStyleSheet(this); |
RefPtrWillBeRawPtr<StyleSheet> removedSheet = m_sheet; |