[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

ap at apple.com ap at apple.com
Wed Dec 22 16:06:39 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit db8f140ed175b47f9badbb98cc164b7b0d2f757c
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Nov 18 19:12:45 2010 +0000

            Reviewed by Anders Carlsson.
    
            https://bugs.webkit.org/show_bug.cgi?id=49694
            Add some comments about XSLStyleSheet owner node
    
            No change in behavior, so no tests.
    
            * dom/ProcessingInstruction.cpp:
            (WebCore::ProcessingInstruction::checkStyleSheet):
            * xml/XSLStyleSheet.h:
            (WebCore::XSLStyleSheet::create):
            (WebCore::XSLStyleSheet::createEmbedded):
            (WebCore::XSLStyleSheet::createForXSLTProcessor):
            * xml/XSLStyleSheetLibxslt.cpp:
            (WebCore::XSLStyleSheet::XSLStyleSheet):
            * xml/XSLTProcessorLibxslt.cpp:
            (WebCore::xsltStylesheetPointer):
            * xml/XSLTProcessorQt.cpp:
            (WebCore::XSLTProcessor::transformToString):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72315 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index cd98c02..7710560 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,4 +1,26 @@
-2010-11-16  Jer Noble  <jer.noble at apple.com>
+2010-11-18  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        https://bugs.webkit.org/show_bug.cgi?id=49694
+        Add some comments about XSLStyleSheet owner node
+
+        No change in behavior, so no tests.
+
+        * dom/ProcessingInstruction.cpp:
+        (WebCore::ProcessingInstruction::checkStyleSheet):
+        * xml/XSLStyleSheet.h:
+        (WebCore::XSLStyleSheet::create):
+        (WebCore::XSLStyleSheet::createEmbedded):
+        (WebCore::XSLStyleSheet::createForXSLTProcessor):
+        * xml/XSLStyleSheetLibxslt.cpp:
+        (WebCore::XSLStyleSheet::XSLStyleSheet):
+        * xml/XSLTProcessorLibxslt.cpp:
+        (WebCore::xsltStylesheetPointer):
+        * xml/XSLTProcessorQt.cpp:
+        (WebCore::XSLTProcessor::transformToString):
+
+2010-11-18  Jer Noble  <jer.noble at apple.com>
 
         Reviewed by Eric Carlson.
 
diff --git a/WebCore/dom/ProcessingInstruction.cpp b/WebCore/dom/ProcessingInstruction.cpp
index 4939c8d..544d789 100644
--- a/WebCore/dom/ProcessingInstruction.cpp
+++ b/WebCore/dom/ProcessingInstruction.cpp
@@ -143,7 +143,7 @@ void ProcessingInstruction::checkStyleSheet()
             // to kick off import/include loads that can hang off some parent sheet.
             if (m_isXSL) {
                 KURL finalURL(ParsedURLString, m_localHref);
-                m_sheet = XSLStyleSheet::createInline(this, finalURL);
+                m_sheet = XSLStyleSheet::createEmbedded(this, finalURL);
                 m_loading = false;
             }
 #endif
diff --git a/WebCore/xml/XSLStyleSheet.h b/WebCore/xml/XSLStyleSheet.h
index acf5ea3..4312771 100644
--- a/WebCore/xml/XSLStyleSheet.h
+++ b/WebCore/xml/XSLStyleSheet.h
@@ -25,6 +25,7 @@
 
 #if ENABLE(XSLT)
 
+#include "ProcessingInstruction.h"
 #include "StyleSheet.h"
 
 #if !USE(QXMLQUERY)
@@ -36,8 +37,6 @@
 
 namespace WebCore {
 
-class CachedResourceLoader;
-class Document;
 class XSLImportRule;
     
 class XSLStyleSheet : public StyleSheet {
@@ -48,15 +47,22 @@ public:
         return adoptRef(new XSLStyleSheet(parentImport, originalURL, finalURL));
     }
 #endif
-    static PassRefPtr<XSLStyleSheet> create(Node* parentNode, const String& originalURL, const KURL& finalURL)
+    static PassRefPtr<XSLStyleSheet> create(ProcessingInstruction* parentNode, const String& originalURL, const KURL& finalURL)
     {
         return adoptRef(new XSLStyleSheet(parentNode, originalURL, finalURL, false));
     }
-    static PassRefPtr<XSLStyleSheet> createInline(Node* parentNode, const KURL& finalURL)
+    static PassRefPtr<XSLStyleSheet> createEmbedded(ProcessingInstruction* parentNode, const KURL& finalURL)
     {
         return adoptRef(new XSLStyleSheet(parentNode, finalURL.string(), finalURL, true));
     }
 
+    // Taking an arbitrary node is unsafe, because owner node pointer can become stale.
+    // XSLTProcessor ensures that the stylesheet doesn't outlive its parent, in part by not exposing it to JavaScript.
+    static PassRefPtr<XSLStyleSheet> createForXSLTProcessor(Node* parentNode, const String& originalURL, const KURL& finalURL)
+    {
+        return adoptRef(new XSLStyleSheet(parentNode, originalURL, finalURL, false));
+    }
+
     virtual ~XSLStyleSheet();
     
     virtual bool isXSLStyleSheet() const { return true; }
diff --git a/WebCore/xml/XSLTProcessorLibxslt.cpp b/WebCore/xml/XSLTProcessorLibxslt.cpp
index 469cb64..af2987f 100644
--- a/WebCore/xml/XSLTProcessorLibxslt.cpp
+++ b/WebCore/xml/XSLTProcessorLibxslt.cpp
@@ -224,9 +224,12 @@ static void freeXsltParamArray(const char** params)
 static xsltStylesheetPtr xsltStylesheetPointer(RefPtr<XSLStyleSheet>& cachedStylesheet, Node* stylesheetRootNode)
 {
     if (!cachedStylesheet && stylesheetRootNode) {
-        cachedStylesheet = XSLStyleSheet::create(stylesheetRootNode->parentNode() ? stylesheetRootNode->parentNode() : stylesheetRootNode,
+        cachedStylesheet = XSLStyleSheet::createForXSLTProcessor(stylesheetRootNode->parentNode() ? stylesheetRootNode->parentNode() : stylesheetRootNode,
             stylesheetRootNode->document()->url().string(),
             stylesheetRootNode->document()->url()); // FIXME: Should we use baseURL here?
+
+        // According to Mozilla documentation, the node must be a Document node, an xsl:stylesheet or xsl:transform element.
+        // But we just use text content regardless of node type.
         cachedStylesheet->parseString(createMarkup(stylesheetRootNode));
     }
 
diff --git a/WebCore/xml/XSLTProcessorQt.cpp b/WebCore/xml/XSLTProcessorQt.cpp
index 29dbacf..cbb8b39 100644
--- a/WebCore/xml/XSLTProcessorQt.cpp
+++ b/WebCore/xml/XSLTProcessorQt.cpp
@@ -119,9 +119,12 @@ bool XSLTProcessor::transformToString(Node* sourceNode, String&, String& resultS
     RefPtr<XSLStyleSheet> stylesheet = m_stylesheet;
     if (!stylesheet && m_stylesheetRootNode) {
         Node* node = m_stylesheetRootNode.get();
-        stylesheet = XSLStyleSheet::create(node->parent() ? node->parent() : node,
+        stylesheet = XSLStyleSheet::createForXSLTProcessor(node->parent() ? node->parent() : node,
             node->document()->url().string(),
             node->document()->url()); // FIXME: Should we use baseURL here?
+
+        // According to Mozilla documentation, the node must be a Document node, an xsl:stylesheet or xsl:transform element.
+        // But we just use text content regardless of node type.
         stylesheet->parseString(createMarkup(node));
     }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list