[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:05:14 UTC 2010


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

            Reviewed by Darin Adler.
    
            https://bugs.webkit.org/show_bug.cgi?id=49700
            XSLTProcessor.importNode is only tested with document nodes, and hits an assertion
    
            Test: fast/xsl/import-non-document-node.xhtml
    
            * css/CSSStyleSheet.cpp:
            (WebCore::isAcceptableCSSStyleSheetParent):
            (WebCore::CSSStyleSheet::CSSStyleSheet):
            * css/StyleSheet.cpp:
            (WebCore::StyleSheet::StyleSheet):
            Moved the assertion - hopefully, it's valid for CSS stylesheets.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72301 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index adfbe50..f478d4e 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-11-18  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=49700
+        XSLTProcessor.importNode is only tested with document nodes, and hits an assertion
+
+        Added test coverage - we only tried to import a whole document before.
+
+        * fast/xsl/import-non-document-node-expected.txt: Added.
+        * fast/xsl/import-non-document-node.xhtml: Added.
+
 2010-11-18  Anton Muhin <antonm at chromium.org>
 
         Not reviewed, proper regrouping of suppressions.
diff --git a/LayoutTests/fast/xsl/import-non-document-node-expected.txt b/LayoutTests/fast/xsl/import-non-document-node-expected.txt
new file mode 100644
index 0000000..89fae9b
--- /dev/null
+++ b/LayoutTests/fast/xsl/import-non-document-node-expected.txt
@@ -0,0 +1,3 @@
+Test importing an xsl:stylesheet node as stylesheet for XSLTProcessor.
+
+SUCCESS
diff --git a/LayoutTests/fast/xsl/import-non-document-node.xhtml b/LayoutTests/fast/xsl/import-non-document-node.xhtml
new file mode 100644
index 0000000..14c0f16
--- /dev/null
+++ b/LayoutTests/fast/xsl/import-non-document-node.xhtml
@@ -0,0 +1,40 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<head>
+<title/>
+</head>
+<body>
+<p>Test importing an xsl:stylesheet node as stylesheet for XSLTProcessor.</p>
+<xsl:stylesheet version="1.0">
+
+<xsl:template match="/">
+  <html>
+    <p><xsl:apply-templates/></p>
+  </html>
+</xsl:template>
+
+<xsl:template match="para">
+<xsl:value-of select="."/>
+</xsl:template>
+</xsl:stylesheet>
+
+<para>SUCCESS</para>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+try {
+    var stylesheetElement = document.getElementsByTagNameNS("http://www.w3.org/1999/XSL/Transform", "stylesheet")[0];
+    var paraElement = document.getElementsByTagName("para")[0];
+    var proc = new XSLTProcessor;
+    proc.importStylesheet(stylesheetElement);
+    var transformationResult = proc.transformToDocument(paraElement);
+    document.body.removeChild(stylesheetElement);
+    document.body.removeChild(paraElement);
+
+    document.body.appendChild(document.adoptNode(transformationResult.firstChild));
+} catch (ex) {
+    document.body.appendChild(document.createTextNode(ex));
+}
+</script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 38b79de..993c1d6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-11-18  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=49700
+        XSLTProcessor.importNode is only tested with document nodes, and hits an assertion
+
+        Test: fast/xsl/import-non-document-node.xhtml
+
+        * css/CSSStyleSheet.cpp:
+        (WebCore::isAcceptableCSSStyleSheetParent):
+        (WebCore::CSSStyleSheet::CSSStyleSheet):
+        * css/StyleSheet.cpp:
+        (WebCore::StyleSheet::StyleSheet):
+        Moved the assertion - hopefully, it's valid for CSS stylesheets.
+
 2010-11-18  Charlie Reis  <creis at chromium.org>
 
         Reviewed by Darin Fisher.
diff --git a/WebCore/css/CSSStyleSheet.cpp b/WebCore/css/CSSStyleSheet.cpp
index 9bbcb8b..04df693 100644
--- a/WebCore/css/CSSStyleSheet.cpp
+++ b/WebCore/css/CSSStyleSheet.cpp
@@ -27,13 +27,30 @@
 #include "CSSRuleList.h"
 #include "Document.h"
 #include "ExceptionCode.h"
+#include "HTMLNames.h"
 #include "Node.h"
+#include "SVGNames.h"
 #include "SecurityOrigin.h"
 #include "TextEncoding.h"
 #include <wtf/Deque.h>
 
 namespace WebCore {
 
+#if !ASSERT_DISABLED
+static bool isAcceptableCSSStyleSheetParent(Node* parentNode)
+{
+    // Only these nodes can be parents of StyleSheets, and they need to call clearOwnerNode() when moved out of document.
+    return !parentNode
+        || parentNode->isDocumentNode()
+        || parentNode->hasTagName(HTMLNames::linkTag)
+        || parentNode->hasTagName(HTMLNames::styleTag)
+#if ENABLE(SVG)
+        || parentNode->hasTagName(SVGNames::styleTag)
+#endif    
+        || parentNode->nodeType() == Node::PROCESSING_INSTRUCTION_NODE;
+}
+#endif
+
 CSSStyleSheet::CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const KURL& baseURL, const String& charset)
     : StyleSheet(parentSheet, href, baseURL)
     , m_document(parentSheet ? parentSheet->document() : 0)
@@ -54,6 +71,7 @@ CSSStyleSheet::CSSStyleSheet(Node* parentNode, const String& href, const KURL& b
     , m_isUserStyleSheet(false)
     , m_hasSyntacticallyValidCSSHeader(true)
 {
+    ASSERT(isAcceptableCSSStyleSheetParent(parentNode));
 }
 
 CSSStyleSheet::CSSStyleSheet(CSSRule* ownerRule, const String& href, const KURL& baseURL, const String& charset)
diff --git a/WebCore/css/StyleSheet.cpp b/WebCore/css/StyleSheet.cpp
index 854b63c..0a719d1 100644
--- a/WebCore/css/StyleSheet.cpp
+++ b/WebCore/css/StyleSheet.cpp
@@ -20,29 +20,11 @@
 #include "config.h"
 #include "StyleSheet.h"
 
-#include "HTMLNames.h"
 #include "MediaList.h"
 #include "Node.h"
-#include "SVGNames.h"
 
 namespace WebCore {
 
-#if !ASSERT_DISABLED
-static bool isAcceptableStyleSheetParent(Node* parentNode)
-{
-    // Only these nodes can be parents of StyleSheets, and they need to call clearOwnerNode() when moved out of document.
-    return !parentNode
-        || parentNode->isDocumentNode()
-        || parentNode->hasTagName(HTMLNames::linkTag)
-        || parentNode->hasTagName(HTMLNames::styleTag)
-        || parentNode->nodeType() == Node::PROCESSING_INSTRUCTION_NODE
-#if ENABLE(SVG)
-        || parentNode->hasTagName(SVGNames::styleTag)
-#endif    
-    ;
-}
-#endif
-
 StyleSheet::StyleSheet(StyleSheet* parentSheet, const String& originalURL, const KURL& finalURL)
     : StyleList(parentSheet)
     , m_parentNode(0)
@@ -59,7 +41,6 @@ StyleSheet::StyleSheet(Node* parentNode, const String& originalURL, const KURL&
     , m_finalURL(finalURL)
     , m_disabled(false)
 {
-    ASSERT(isAcceptableStyleSheetParent(parentNode));
 }
 
 StyleSheet::StyleSheet(StyleBase* owner, const String& originalURL, const KURL& finalURL)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list