Reviewed by John Sullivan.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Sep 2005 22:41:37 +0000 (22:41 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Sep 2005 22:41:37 +0000 (22:41 +0000)
        - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4493
          add qualifiedName checking for empty string

        * khtml/xml/dom_docimpl.cpp:
        (qualifiedNameIsValid): Added.
        (qualifiedNameIsMalformed): Added.
        (DOMImplementationImpl::createDocumentType): Added checks and exceptions using above functions.
        (DOMImplementationImpl::createDocument): Ditto.

        * layout-tests/dom/html/level2/core/createDocument08-expected.txt: Updated to expect success.
        * layout-tests/dom/html/level2/core/createDocumentType04-expected.txt: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@10472 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/dom/html/level2/core/createDocument08-expected.txt
LayoutTests/dom/html/level2/core/createDocumentType04-expected.txt
WebCore/ChangeLog-2005-12-19
WebCore/khtml/xml/dom_docimpl.cpp

index 8548903581f767d432e10cf6ae4812bad1f7c3c7..9eb9d1b418540bbc3dfb65a5f418a955c1fd2f66 100644 (file)
@@ -1,3 +1,2 @@
-Test:  http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument08      
-Status:        failure
-Detail:        throw_INVALID_CHARACTER_ERR: assertTrue failed
+Test:  http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument08
+Status:        Success
index d6f6df4cb767c462ae6d1557011ecc1613098d82..048d1ca8db651e22d45876a6ac1d855d988e3f49 100644 (file)
@@ -1,3 +1,2 @@
-Test:  http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocumentType04  
-Status:        failure
-Detail:        throw_INVALID_CHARACTER_ERR: assertTrue failed
+Test:  http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocumentType04
+Status:        Success
index c9baf349785f51344188bb75237499bddc910101..40f812a6bad126358fbd4cbc5b5aeeea75ca637e 100644 (file)
@@ -1,3 +1,19 @@
+2005-09-05  Darin Adler  <darin@apple.com>
+
+        Reviewed by John Sullivan.
+
+        - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4493
+          add qualifiedName checking for empty string
+
+        * khtml/xml/dom_docimpl.cpp:
+        (qualifiedNameIsValid): Added.
+        (qualifiedNameIsMalformed): Added.
+        (DOMImplementationImpl::createDocumentType): Added checks and exceptions using above functions.
+        (DOMImplementationImpl::createDocument): Ditto.
+
+        * layout-tests/dom/html/level2/core/createDocument08-expected.txt: Updated to expect success.
+        * layout-tests/dom/html/level2/core/createDocumentType04-expected.txt: Ditto.
+
 2005-09-05  John Sullivan  <sullivan@apple.com>
 
         Reviewed by Dave Hyatt.
index 2476b7d191eacacc83f25e9471be665f81a19c86..adfc06e7b6bbd8090b4b7f301463dcfe01d3aa17 100644 (file)
@@ -106,6 +106,23 @@ const int cLayoutScheduleThreshold = 250;
 
 DOMImplementationImpl *DOMImplementationImpl::m_instance = 0;
 
+static bool qualifiedNameIsValid(const DOMString &qualifiedName)
+{
+    // Not mentioned in spec: empty qualified names are not valid.
+    if (qualifiedName.isEmpty())
+        return false;
+    // FIXME: Check for illegal characters.
+    // FIXME: Merge/reconcile with DocumentImpl::isValidName.
+    return true;
+}
+
+static bool qualifiedNameIsMalformed(const DOMString &qualifiedName)
+{
+    assert(qualifiedNameIsValid(qualifiedName));
+    // FIXME: Implement this check.
+    return false;
+}
+
 DOMImplementationImpl::DOMImplementationImpl()
 {
 }
@@ -143,21 +160,17 @@ DocumentTypeImpl *DOMImplementationImpl::createDocumentType( const DOMString &qu
         return 0;
     }
 
-#if 0
-    // FIXME: Add these checks (but not in a way that depends on the C++ DOM!)
-
     // INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character.
-    if (!Element::khtmlValidQualifiedName(qualifiedName)) {
+    if (!qualifiedNameIsValid(qualifiedName)) {
         exceptioncode = DOMException::INVALID_CHARACTER_ERR;
         return 0;
     }
 
     // NAMESPACE_ERR: Raised if the qualifiedName is malformed.
-    if (Element::khtmlMalformedQualifiedName(qualifiedName)) {
+    if (qualifiedNameIsMalformed(qualifiedName)) {
         exceptioncode = DOMException::NAMESPACE_ERR;
         return 0;
     }
-#endif
 
     return new DocumentTypeImpl(this,DocumentPtr::nullDocumentPtr(),qualifiedName,publicId,systemId);
 }
@@ -179,14 +192,11 @@ DocumentImpl *DOMImplementationImpl::createDocument( const DOMString &namespaceU
         return 0;
     }
 
-#if 0
-    // FIXME: Add this check (but not in a way that depends on the C++ DOM!)
     // INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character.
-    if (!Element::khtmlValidQualifiedName(qualifiedName)) {
+    if (!qualifiedNameIsValid(qualifiedName)) {
         exceptioncode = DOMException::INVALID_CHARACTER_ERR;
         return 0;
     }
-#endif
 
     // NAMESPACE_ERR:
     // - Raised if the qualifiedName is malformed,
@@ -201,11 +211,7 @@ DocumentImpl *DOMImplementationImpl::createDocument( const DOMString &namespaceU
             colonpos = i;
     }
 
-    if (
-#if 0
-        // FIXME: Add this check (but not in a way that depends on the C++ DOM!)
-        Element::khtmlMalformedQualifiedName(qualifiedName) ||
-#endif
+    if (qualifiedNameIsMalformed(qualifiedName) ||
         (colonpos >= 0 && namespaceURI.isNull()) ||
         (colonpos == 3 && qualifiedName[0] == 'x' && qualifiedName[1] == 'm' && qualifiedName[2] == 'l' &&
          namespaceURI != "http://www.w3.org/XML/1998/namespace")) {