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

Unified Diff: Source/core/xml/XSLStyleSheetLibxslt.cpp

Issue 23103007: Avoid reparsing an XSLT stylesheet after the first failure. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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
« no previous file with comments | « Source/core/xml/XSLStyleSheet.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/XSLStyleSheetLibxslt.cpp
diff --git a/Source/core/xml/XSLStyleSheetLibxslt.cpp b/Source/core/xml/XSLStyleSheetLibxslt.cpp
index 35ea27956ae91891d0222a69bc6fc30e68ad3382..bce87ad937b30aac1161b378b2034832db2e7051 100644
--- a/Source/core/xml/XSLStyleSheetLibxslt.cpp
+++ b/Source/core/xml/XSLStyleSheetLibxslt.cpp
@@ -47,6 +47,7 @@ XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& originalUR
, m_processed(false) // Child sheets get marked as processed when the libxslt engine has finally seen them.
, m_stylesheetDoc(0)
, m_stylesheetDocTaken(false)
+ , m_compilationFailed(false)
, m_parentStyleSheet(parentRule ? parentRule->parentStyleSheet() : 0)
{
}
@@ -60,6 +61,7 @@ XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& originalURL, const
, m_processed(true) // The root sheet starts off processed.
, m_stylesheetDoc(0)
, m_stylesheetDocTaken(false)
+ , m_compilationFailed(false)
, m_parentStyleSheet(0)
{
}
@@ -226,12 +228,19 @@ xsltStylesheetPtr XSLStyleSheet::compileStyleSheet()
if (m_embedded)
return xsltLoadStylesheetPI(document());
+ // Certain libxslt versions are corrupting the xmlDoc on compilation failures -
+ // hence attempting to recompile after a failure is unsafe.
+ if (m_compilationFailed)
+ return 0;
+
// xsltParseStylesheetDoc makes the document part of the stylesheet
// so we have to release our pointer to it.
ASSERT(!m_stylesheetDocTaken);
xsltStylesheetPtr result = xsltParseStylesheetDoc(m_stylesheetDoc);
if (result)
m_stylesheetDocTaken = true;
+ else
+ m_compilationFailed = true;
return result;
}
« no previous file with comments | « Source/core/xml/XSLStyleSheet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698