Title: [288517] branches/safari-613-branch
Revision
288517
Author
[email protected]
Date
2022-01-24 17:56:06 -0800 (Mon, 24 Jan 2022)

Log Message

Cherry-pick r288264. rdar://problem/87745419

    Align our qualified name validation with the specification
    https://bugs.webkit.org/show_bug.cgi?id=201699

    Reviewed by Geoffrey Garen.

    LayoutTests/imported/w3c:

    * web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt:
    * web-platform-tests/dom/nodes/Document-createElementNS-expected.txt:
    Rebaseline WPT tests now that more checks are passing.

    Source/WebCore:

    Align our qualified name validation with the latest specification:
    - https://dom.spec.whatwg.org/#validate
    - https://www.w3.org/TR/xml/#NT-NameStartChar

    No new tests, rebaselined existing tests.

    * dom/Document.cpp:
    (WebCore::isValidNameStart):
    (WebCore::isValidNamePart):

    LayoutTests:

    * dom/xhtml/level3/core/canonicalform06-expected.txt:
    * dom/xhtml/level3/core/infoset06-expected.txt:
    * dom/xhtml/level3/core/infoset07-expected.txt:
    * dom/xhtml/level3/core/wellformed01-expected.txt:
    * dom/xhtml/level3/core/wellformed02-expected.txt:
    * dom/xhtml/level3/core/wellformed03-expected.txt:
    * dom/xhtml/level3/core/wellformed04-expected.txt:
    Rebaseline outdated imported tests.

    * fast/dom/DOMImplementation/createDocument-namespace-err-expected.txt:
    * fast/dom/DOMImplementation/createDocument-namespace-err.html:
    * fast/dom/Document/createAttributeNS-namespace-err-expected.txt:
    * fast/dom/Document/createAttributeNS-namespace-err.html:
    * fast/dom/Document/createElement-invalid-names-expected.txt:
    * fast/dom/Document/createElement-invalid-names.html:
    * fast/dom/Document/createElementNS-namespace-err-expected.txt:
    * fast/dom/Document/createElementNS-namespace-err.html:
    * fast/dom/Element/setAttributeNS-namespace-err-expected.txt:
    * fast/dom/Element/setAttributeNS-namespace-err.html:
    * fast/dom/dataset-expected.txt:
    * fast/dom/dataset-xhtml-expected.txt:
    * fast/dom/dataset-xhtml.xhtml:
    * fast/dom/dataset.html:
    Update and rebaseline outdated WebKit tests.

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

Modified Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/ChangeLog (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/ChangeLog	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/ChangeLog	2022-01-25 01:56:06 UTC (rev 288517)
@@ -1,5 +1,94 @@
 2022-01-24  Alan Coon  <[email protected]>
 
+        Cherry-pick r288264. rdar://problem/87745419
+
+    Align our qualified name validation with the specification
+    https://bugs.webkit.org/show_bug.cgi?id=201699
+    
+    Reviewed by Geoffrey Garen.
+    
+    LayoutTests/imported/w3c:
+    
+    * web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt:
+    * web-platform-tests/dom/nodes/Document-createElementNS-expected.txt:
+    Rebaseline WPT tests now that more checks are passing.
+    
+    Source/WebCore:
+    
+    Align our qualified name validation with the latest specification:
+    - https://dom.spec.whatwg.org/#validate
+    - https://www.w3.org/TR/xml/#NT-NameStartChar
+    
+    No new tests, rebaselined existing tests.
+    
+    * dom/Document.cpp:
+    (WebCore::isValidNameStart):
+    (WebCore::isValidNamePart):
+    
+    LayoutTests:
+    
+    * dom/xhtml/level3/core/canonicalform06-expected.txt:
+    * dom/xhtml/level3/core/infoset06-expected.txt:
+    * dom/xhtml/level3/core/infoset07-expected.txt:
+    * dom/xhtml/level3/core/wellformed01-expected.txt:
+    * dom/xhtml/level3/core/wellformed02-expected.txt:
+    * dom/xhtml/level3/core/wellformed03-expected.txt:
+    * dom/xhtml/level3/core/wellformed04-expected.txt:
+    Rebaseline outdated imported tests.
+    
+    * fast/dom/DOMImplementation/createDocument-namespace-err-expected.txt:
+    * fast/dom/DOMImplementation/createDocument-namespace-err.html:
+    * fast/dom/Document/createAttributeNS-namespace-err-expected.txt:
+    * fast/dom/Document/createAttributeNS-namespace-err.html:
+    * fast/dom/Document/createElement-invalid-names-expected.txt:
+    * fast/dom/Document/createElement-invalid-names.html:
+    * fast/dom/Document/createElementNS-namespace-err-expected.txt:
+    * fast/dom/Document/createElementNS-namespace-err.html:
+    * fast/dom/Element/setAttributeNS-namespace-err-expected.txt:
+    * fast/dom/Element/setAttributeNS-namespace-err.html:
+    * fast/dom/dataset-expected.txt:
+    * fast/dom/dataset-xhtml-expected.txt:
+    * fast/dom/dataset-xhtml.xhtml:
+    * fast/dom/dataset.html:
+    Update and rebaseline outdated WebKit tests.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288264 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-19  Chris Dumez  <[email protected]>
+
+            Align our qualified name validation with the specification
+            https://bugs.webkit.org/show_bug.cgi?id=201699
+
+            Reviewed by Geoffrey Garen.
+
+            * dom/xhtml/level3/core/canonicalform06-expected.txt:
+            * dom/xhtml/level3/core/infoset06-expected.txt:
+            * dom/xhtml/level3/core/infoset07-expected.txt:
+            * dom/xhtml/level3/core/wellformed01-expected.txt:
+            * dom/xhtml/level3/core/wellformed02-expected.txt:
+            * dom/xhtml/level3/core/wellformed03-expected.txt:
+            * dom/xhtml/level3/core/wellformed04-expected.txt:
+            Rebaseline outdated imported tests.
+
+            * fast/dom/DOMImplementation/createDocument-namespace-err-expected.txt:
+            * fast/dom/DOMImplementation/createDocument-namespace-err.html:
+            * fast/dom/Document/createAttributeNS-namespace-err-expected.txt:
+            * fast/dom/Document/createAttributeNS-namespace-err.html:
+            * fast/dom/Document/createElement-invalid-names-expected.txt:
+            * fast/dom/Document/createElement-invalid-names.html:
+            * fast/dom/Document/createElementNS-namespace-err-expected.txt:
+            * fast/dom/Document/createElementNS-namespace-err.html:
+            * fast/dom/Element/setAttributeNS-namespace-err-expected.txt:
+            * fast/dom/Element/setAttributeNS-namespace-err.html:
+            * fast/dom/dataset-expected.txt:
+            * fast/dom/dataset-xhtml-expected.txt:
+            * fast/dom/dataset-xhtml.xhtml:
+            * fast/dom/dataset.html:
+            Update and rebaseline outdated WebKit tests.
+
+2022-01-24  Alan Coon  <[email protected]>
+
         Cherry-pick r288245. rdar://problem/85878291
 
     Limit the deprecated CSSOMPrimitiveValue to formerly standardized unit types

Modified: branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/canonicalform06-expected.txt (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/canonicalform06-expected.txt	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/canonicalform06-expected.txt	2022-01-25 01:56:06 UTC (rev 288517)
@@ -1,2 +1,3 @@
 Test	http://www.w3.org/2001/DOM-Test-Suite/level3/core/canonicalform06
-Status	Success
+Status	failure
+Message	xml10InvalidName: assertTrue failed

Modified: branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/infoset06-expected.txt (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/infoset06-expected.txt	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/infoset06-expected.txt	2022-01-25 01:56:06 UTC (rev 288517)
@@ -1,2 +1,3 @@
 Test	http://www.w3.org/2001/DOM-Test-Suite/level3/core/infoset06
-Status	Success
+Status	failure
+Message	xml10InvalidName: assertTrue failed

Modified: branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/infoset07-expected.txt (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/infoset07-expected.txt	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/infoset07-expected.txt	2022-01-25 01:56:06 UTC (rev 288517)
@@ -1,2 +1,3 @@
 Test	http://www.w3.org/2001/DOM-Test-Suite/level3/core/infoset07
-Status	Success
+Status	failure
+Message	xml10InvalidName: assertTrue failed

Modified: branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/wellformed01-expected.txt (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/wellformed01-expected.txt	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/wellformed01-expected.txt	2022-01-25 01:56:06 UTC (rev 288517)
@@ -1,2 +1,3 @@
 Test	http://www.w3.org/2001/DOM-Test-Suite/level3/core/wellformed01
-Status	Success
+Status	failure
+Message	xml10InvalidName: assertTrue failed

Modified: branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/wellformed02-expected.txt (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/wellformed02-expected.txt	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/wellformed02-expected.txt	2022-01-25 01:56:06 UTC (rev 288517)
@@ -1,2 +1,3 @@
 Test	http://www.w3.org/2001/DOM-Test-Suite/level3/core/wellformed02
-Status	Success
+Status	failure
+Message	xml10InvalidName: assertTrue failed

Modified: branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/wellformed03-expected.txt (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/wellformed03-expected.txt	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/wellformed03-expected.txt	2022-01-25 01:56:06 UTC (rev 288517)
@@ -1,2 +1,3 @@
 Test	http://www.w3.org/2001/DOM-Test-Suite/level3/core/wellformed03
-Status	Success
+Status	failure
+Message	xml10InvalidName: assertTrue failed

Modified: branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/wellformed04-expected.txt (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/wellformed04-expected.txt	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/dom/xhtml/level3/core/wellformed04-expected.txt	2022-01-25 01:56:06 UTC (rev 288517)
@@ -1,2 +1,3 @@
 Test	http://www.w3.org/2001/DOM-Test-Suite/level3/core/wellformed04
-Status	Success
+Status	failure
+Message	xml10InvalidName: assertTrue failed

Modified: branches/safari-613-branch/LayoutTests/fast/dom/DOMImplementation/createDocument-namespace-err-expected.txt (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/fast/dom/DOMImplementation/createDocument-namespace-err-expected.txt	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/fast/dom/DOMImplementation/createDocument-namespace-err-expected.txt	2022-01-25 01:56:06 UTC (rev 288517)
@@ -35,8 +35,8 @@
 PASS createDocument("http://example.com/", "a:0", null); valid XML name, not a valid QName; threw INVALID_CHARACTER_ERR
 PASS createDocument("http://example.com/", "0:a", null); 0 at start makes it not a valid XML name; threw INVALID_CHARACTER_ERR
 PASS createDocument("http://example.com/", "a:_", null)
-PASS createDocument("http://example.com/", "a:ெ", null); non-ASCII character after colon is CombiningChar, which is NCNameChar but not (Letter | "_") so invalid at start of NCName (but still a valid XML name, hence not INVALID_CHARACTER_ERR); threw INVALID_CHARACTER_ERR
-PASS createDocument("http://example.com/", "ெ:a", null); non-ASCII character after colon is CombiningChar, which is NCNameChar but not (Letter | "_") so invalid at start of NCName (Gecko chooses to throw NAMESPACE_ERR here, but either is valid as this is both an invalid XML name and an invalid QName); threw INVALID_CHARACTER_ERR
+PASS createDocument("http://example.com/", "a:;", null); non-ASCII character after colon is CombiningChar, which is NCNameChar but not (Letter | "_") so invalid at start of NCName (but still a valid XML name, hence not INVALID_CHARACTER_ERR); threw INVALID_CHARACTER_ERR
+PASS createDocument("http://example.com/", ";:a", null); non-ASCII character after colon is CombiningChar, which is NCNameChar but not (Letter | "_") so invalid at start of NCName (Gecko chooses to throw NAMESPACE_ERR here, but either is valid as this is both an invalid XML name and an invalid QName); threw INVALID_CHARACTER_ERR
 PASS createDocument("http://example.com/", "a:aெ", null)
 PASS createDocument("http://example.com/", "aெ:a", null)
 PASS createDocument("http://example.com/", "xml:test", null); binding xml prefix wrong; threw NAMESPACE_ERR

Modified: branches/safari-613-branch/LayoutTests/fast/dom/DOMImplementation/createDocument-namespace-err.html (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/fast/dom/DOMImplementation/createDocument-namespace-err.html	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/fast/dom/DOMImplementation/createDocument-namespace-err.html	2022-01-25 01:56:06 UTC (rev 288517)
@@ -78,11 +78,11 @@
    { args: ["http://example.com/", "a:0"], code: 5, message: "valid XML name, not a valid QName" },
    { args: ["http://example.com/", "0:a"], code: 5, message: "0 at start makes it not a valid XML name" },
    { args: ["http://example.com/", "a:_"] },
-   { args: ["http://example.com/", "a:\u0BC6"], code: 5,
+   { args: ["http://example.com/", "a:\u037E"], code: 5,
      message: "non-ASCII character after colon is CombiningChar, which is " +
               "NCNameChar but not (Letter | \"_\") so invalid at start of " +
               "NCName (but still a valid XML name, hence not INVALID_CHARACTER_ERR)" },
-   { args: ["http://example.com/", "\u0BC6:a"], code: 5,
+   { args: ["http://example.com/", "\u037E:a"], code: 5,
      message: "non-ASCII character after colon is CombiningChar, which is " +
               "NCNameChar but not (Letter | \"_\") so invalid at start of " +
               "NCName (Gecko chooses to throw NAMESPACE_ERR here, but either is valid " +

Modified: branches/safari-613-branch/LayoutTests/fast/dom/Document/createAttributeNS-namespace-err-expected.txt (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/fast/dom/Document/createAttributeNS-namespace-err-expected.txt	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/fast/dom/Document/createAttributeNS-namespace-err-expected.txt	2022-01-25 01:56:06 UTC (rev 288517)
@@ -35,8 +35,8 @@
 PASS createAttributeNS("http://example.com/", "a:0"); valid XML name, not a valid QName; threw INVALID_CHARACTER_ERR
 PASS createAttributeNS("http://example.com/", "0:a"); 0 at start makes it not a valid XML name; threw INVALID_CHARACTER_ERR
 PASS createAttributeNS("http://example.com/", "a:_")
-FAIL createAttributeNS("http://example.com/", "a:ெ"); non-ASCII character after colon is CombiningChar, which is NCNameChar but not (Letter | "_") so invalid at start of NCName (but still a valid XML name, hence not INVALID_CHARACTER_ERR); expected NAMESPACE_ERR, threw INVALID_CHARACTER_ERR
-PASS createAttributeNS("http://example.com/", "ெ:a"); non-ASCII character after colon is CombiningChar, which is NCNameChar but not (Letter | "_") so invalid at start of NCName (Gecko chooses to throw NAMESPACE_ERR here, but either is valid as this is both an invalid XML name and an invalid QName); threw INVALID_CHARACTER_ERR
+FAIL createAttributeNS("http://example.com/", "a:;"); non-ASCII character after colon is CombiningChar, which is NCNameChar but not (Letter | "_") so invalid at start of NCName (but still a valid XML name, hence not INVALID_CHARACTER_ERR); expected NAMESPACE_ERR, threw INVALID_CHARACTER_ERR
+PASS createAttributeNS("http://example.com/", ";:a"); non-ASCII character after colon is CombiningChar, which is NCNameChar but not (Letter | "_") so invalid at start of NCName (Gecko chooses to throw NAMESPACE_ERR here, but either is valid as this is both an invalid XML name and an invalid QName); threw INVALID_CHARACTER_ERR
 PASS createAttributeNS("http://example.com/", "a:aெ")
 PASS createAttributeNS("http://example.com/", "aெ:a")
 PASS createAttributeNS("http://example.com/", "xml:test"); binding xml prefix wrong; threw NAMESPACE_ERR

Modified: branches/safari-613-branch/LayoutTests/fast/dom/Document/createAttributeNS-namespace-err.html (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/fast/dom/Document/createAttributeNS-namespace-err.html	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/fast/dom/Document/createAttributeNS-namespace-err.html	2022-01-25 01:56:06 UTC (rev 288517)
@@ -72,11 +72,11 @@
    { args: ["http://example.com/", "a:0"], code: 5, message: "valid XML name, not a valid QName" },
    { args: ["http://example.com/", "0:a"], code: 5, message: "0 at start makes it not a valid XML name" },
    { args: ["http://example.com/", "a:_"] },
-   { args: ["http://example.com/", "a:\u0BC6"], code: 14,
+   { args: ["http://example.com/", "a:\u037E"], code: 14,
      message: "non-ASCII character after colon is CombiningChar, which is " +
               "NCNameChar but not (Letter | \"_\") so invalid at start of " +
               "NCName (but still a valid XML name, hence not INVALID_CHARACTER_ERR)" },
-   { args: ["http://example.com/", "\u0BC6:a"], code: 5,
+   { args: ["http://example.com/", "\u037E:a"], code: 5,
      message: "non-ASCII character after colon is CombiningChar, which is " +
               "NCNameChar but not (Letter | \"_\") so invalid at start of " +
               "NCName (Gecko chooses to throw NAMESPACE_ERR here, but either is valid " +

Modified: branches/safari-613-branch/LayoutTests/fast/dom/Document/createElement-invalid-names-expected.txt (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/fast/dom/Document/createElement-invalid-names-expected.txt	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/fast/dom/Document/createElement-invalid-names-expected.txt	2022-01-25 01:56:06 UTC (rev 288517)
@@ -8,13 +8,9 @@
 PASS document.createElement('-Ascii') threw exception InvalidCharacterError: The string contains invalid characters..
 PASS document.createElement(' ascii') threw exception InvalidCharacterError: The string contains invalid characters..
 PASS document.createElement('	ascii') threw exception InvalidCharacterError: The string contains invalid characters..
-PASS document.createElement('֑sc.ii') threw exception InvalidCharacterError: The string contains invalid characters..
-PASS document.createElement('⃣scii') threw exception InvalidCharacterError: The string contains invalid characters..
-PASS document.createElement('िascii') threw exception InvalidCharacterError: The string contains invalid characters..
-PASS document.createElement('ʳascii') threw exception InvalidCharacterError: The string contains invalid characters..
+PASS document.createElement(';ascii') threw exception InvalidCharacterError: The string contains invalid characters..
 PASS document.createElement('asc i') threw exception InvalidCharacterError: The string contains invalid characters..
 PASS document.createElement('asc	i') threw exception InvalidCharacterError: The string contains invalid characters..
-PASS document.createElement('asciiⅦ') threw exception InvalidCharacterError: The string contains invalid characters..
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: branches/safari-613-branch/LayoutTests/fast/dom/Document/createElement-invalid-names.html (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/fast/dom/Document/createElement-invalid-names.html	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/fast/dom/Document/createElement-invalid-names.html	2022-01-25 01:56:06 UTC (rev 288517)
@@ -15,14 +15,10 @@
                 '-Ascii',
                 ' ascii',
                 '	ascii',
-                '֑sc.ii',
-                '⃣scii',
-                'िascii',
-                'ʳascii',
+                '\u037Eascii',
                 // Invalid other char
                 'asc i',
                 'asc	i',
-                'asciiⅦ'
                 ];
 
 for (var i in nameList)

Modified: branches/safari-613-branch/LayoutTests/fast/dom/Document/createElementNS-namespace-err-expected.txt (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/fast/dom/Document/createElementNS-namespace-err-expected.txt	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/fast/dom/Document/createElementNS-namespace-err-expected.txt	2022-01-25 01:56:06 UTC (rev 288517)
@@ -36,8 +36,8 @@
 PASS createElementNS("http://example.com/", "a:0"); valid XML name, not a valid QName; threw INVALID_CHARACTER_ERR
 PASS createElementNS("http://example.com/", "0:a"); 0 at start makes it not a valid XML name; threw INVALID_CHARACTER_ERR
 PASS createElementNS("http://example.com/", "a:_")
-FAIL createElementNS("http://example.com/", "a:ெ"); non-ASCII character after colon is CombiningChar, which is NCNameChar but not (Letter | "_") so invalid at start of NCName (but still a valid XML name, hence not INVALID_CHARACTER_ERR); expected NAMESPACE_ERR, threw INVALID_CHARACTER_ERR
-PASS createElementNS("http://example.com/", "ெ:a"); non-ASCII character after colon is CombiningChar, which is NCNameChar but not (Letter | "_") so invalid at start of NCName (Gecko chooses to throw NAMESPACE_ERR here, but either is valid as this is both an invalid XML name and an invalid QName); threw INVALID_CHARACTER_ERR
+FAIL createElementNS("http://example.com/", "a:;"); non-ASCII character after colon is CombiningChar, which is NCNameChar but not (Letter | "_") so invalid at start of NCName (but still a valid XML name, hence not INVALID_CHARACTER_ERR); expected NAMESPACE_ERR, threw INVALID_CHARACTER_ERR
+PASS createElementNS("http://example.com/", ";:a"); non-ASCII character after colon is CombiningChar, which is NCNameChar but not (Letter | "_") so invalid at start of NCName (Gecko chooses to throw NAMESPACE_ERR here, but either is valid as this is both an invalid XML name and an invalid QName); threw INVALID_CHARACTER_ERR
 PASS createElementNS("http://example.com/", "a:aெ")
 PASS createElementNS("http://example.com/", "aெ:a")
 PASS createElementNS("http://example.com/", "xml:test"); binding xml prefix wrong; threw NAMESPACE_ERR
@@ -66,7 +66,7 @@
 PASS createElement("0:a"); 0 at start makes it not a valid XML name; threw INVALID_CHARACTER_ERR
 PASS createElement("a:_")
 PASS createElement("a:ெ"); non-ASCII character after colon is CombiningChar, which is valid in pre-namespace XML
-PASS createElement("ெ:a"); not a valid start character; threw INVALID_CHARACTER_ERR
+PASS createElement(";:a"); not a valid start character; threw INVALID_CHARACTER_ERR
 PASS createElement("a:aெ")
 PASS createElement("aெ:a")
 PASS createElement("xml:test")
@@ -95,7 +95,7 @@
 PASS createElement("0:a"); 0 at start makes it not a valid XML name; threw INVALID_CHARACTER_ERR
 PASS createElement("a:_")
 PASS createElement("a:ெ"); non-ASCII character after colon is CombiningChar, which is valid in pre-namespace XML
-PASS createElement("ெ:a"); not a valid start character; threw INVALID_CHARACTER_ERR
+PASS createElement(";:a"); not a valid start character; threw INVALID_CHARACTER_ERR
 PASS createElement("a:aெ")
 PASS createElement("aெ:a")
 PASS createElement("xml:test")
@@ -124,7 +124,7 @@
 PASS createElement("0:a"); 0 at start makes it not a valid XML name; threw INVALID_CHARACTER_ERR
 PASS createElement("a:_")
 PASS createElement("a:ெ"); non-ASCII character after colon is CombiningChar, which is valid in pre-namespace XML
-PASS createElement("ெ:a"); not a valid start character; threw INVALID_CHARACTER_ERR
+PASS createElement(";:a"); not a valid start character; threw INVALID_CHARACTER_ERR
 PASS createElement("a:aெ")
 PASS createElement("aெ:a")
 PASS createElement("xml:test")

Modified: branches/safari-613-branch/LayoutTests/fast/dom/Document/createElementNS-namespace-err.html (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/fast/dom/Document/createElementNS-namespace-err.html	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/fast/dom/Document/createElementNS-namespace-err.html	2022-01-25 01:56:06 UTC (rev 288517)
@@ -72,11 +72,11 @@
    { args: ["http://example.com/", "a:0"], code: 5, message: "valid XML name, not a valid QName" },
    { args: ["http://example.com/", "0:a"], code: 5, message: "0 at start makes it not a valid XML name" },
    { args: ["http://example.com/", "a:_"] },
-   { args: ["http://example.com/", "a:\u0BC6"], code: 14,
+   { args: ["http://example.com/", "a:\u037E"], code: 14,
      message: "non-ASCII character after colon is CombiningChar, which is " +
               "NCNameChar but not (Letter | \"_\") so invalid at start of " +
               "NCName (but still a valid XML name, hence not INVALID_CHARACTER_ERR)" },
-   { args: ["http://example.com/", "\u0BC6:a"], code: 5,
+   { args: ["http://example.com/", "\u037E:a"], code: 5,
      message: "non-ASCII character after colon is CombiningChar, which is " +
               "NCNameChar but not (Letter | \"_\") so invalid at start of " +
               "NCName (Gecko chooses to throw NAMESPACE_ERR here, but either is valid " +
@@ -114,7 +114,7 @@
    { args: ["a:\u0BC6"],
      message: "non-ASCII character after colon is CombiningChar, which is " +
               "valid in pre-namespace XML" },
-   { args: ["\u0BC6:a"], code: 5, message: "not a valid start character" },
+   { args: ["\u037E:a"], code: 5, message: "not a valid start character" },
    { args: ["a:a\u0BC6"] },
    { args: ["a\u0BC6:a"] },
    { args: ["xml:test"] },

Modified: branches/safari-613-branch/LayoutTests/fast/dom/Element/setAttributeNS-namespace-err-expected.txt (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/fast/dom/Element/setAttributeNS-namespace-err-expected.txt	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/fast/dom/Element/setAttributeNS-namespace-err-expected.txt	2022-01-25 01:56:06 UTC (rev 288517)
@@ -36,8 +36,8 @@
 PASS element.setAttributeNS("http://example.com/", "a:0", 'value'); valid XML name, not a valid QName; threw INVALID_CHARACTER_ERR
 PASS element.setAttributeNS("http://example.com/", "0:a", 'value'); 0 at start makes it not a valid XML name; threw INVALID_CHARACTER_ERR
 PASS element.setAttributeNS("http://example.com/", "a:_", 'value')
-FAIL element.setAttributeNS("http://example.com/", "a:ெ", 'value'); non-ASCII character after colon is CombiningChar, which is NCNameChar but not (Letter | "_") so invalid at start of NCName (but still a valid XML name, hence not INVALID_CHARACTER_ERR); expected NAMESPACE_ERR, threw INVALID_CHARACTER_ERR
-PASS element.setAttributeNS("http://example.com/", "ெ:a", 'value'); non-ASCII character after colon is CombiningChar, which is NCNameChar but not (Letter | "_") so invalid at start of NCName (Gecko chooses to throw NAMESPACE_ERR here, but either is valid as this is both an invalid XML name and an invalid QName); threw INVALID_CHARACTER_ERR
+FAIL element.setAttributeNS("http://example.com/", "a:;", 'value'); non-ASCII character after colon is CombiningChar, which is NCNameChar but not (Letter | "_") so invalid at start of NCName (but still a valid XML name, hence not INVALID_CHARACTER_ERR); expected NAMESPACE_ERR, threw INVALID_CHARACTER_ERR
+PASS element.setAttributeNS("http://example.com/", ";:a", 'value'); non-ASCII character after colon is CombiningChar, which is NCNameChar but not (Letter | "_") so invalid at start of NCName (Gecko chooses to throw NAMESPACE_ERR here, but either is valid as this is both an invalid XML name and an invalid QName); threw INVALID_CHARACTER_ERR
 PASS element.setAttributeNS("http://example.com/", "a:aெ", 'value')
 PASS element.setAttributeNS("http://example.com/", "aெ:a", 'value')
 PASS element.setAttributeNS("http://example.com/", "xml:test", 'value'); binding xml prefix wrong; threw NAMESPACE_ERR

Modified: branches/safari-613-branch/LayoutTests/fast/dom/Element/setAttributeNS-namespace-err.html (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/fast/dom/Element/setAttributeNS-namespace-err.html	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/fast/dom/Element/setAttributeNS-namespace-err.html	2022-01-25 01:56:06 UTC (rev 288517)
@@ -72,11 +72,11 @@
    { args: ["http://example.com/", "a:0"], code: 5, message: "valid XML name, not a valid QName" },
    { args: ["http://example.com/", "0:a"], code: 5, message: "0 at start makes it not a valid XML name" },
    { args: ["http://example.com/", "a:_"] },
-   { args: ["http://example.com/", "a:\u0BC6"], code: 14,
+   { args: ["http://example.com/", "a:\u037E"], code: 14,
      message: "non-ASCII character after colon is CombiningChar, which is " +
               "NCNameChar but not (Letter | \"_\") so invalid at start of " +
               "NCName (but still a valid XML name, hence not INVALID_CHARACTER_ERR)" },
-   { args: ["http://example.com/", "\u0BC6:a"], code: 5,
+   { args: ["http://example.com/", "\u037E:a"], code: 5,
      message: "non-ASCII character after colon is CombiningChar, which is " +
               "NCNameChar but not (Letter | \"_\") so invalid at start of " +
               "NCName (Gecko chooses to throw NAMESPACE_ERR here, but either is valid " +

Modified: branches/safari-613-branch/LayoutTests/fast/dom/dataset-expected.txt (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/fast/dom/dataset-expected.txt	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/fast/dom/dataset-expected.txt	2022-01-25 01:56:06 UTC (rev 288517)
@@ -26,10 +26,10 @@
 PASS testSet('-Foo', 'data---foo') is true
 PASS testSet('', 'data-') is true
 PASS testSet('à', 'data-à') is true
+PASS testSet('foo豈', 'data-foo豈') is true
 
 PASS testSet('-foo', 'dummy') threw exception SyntaxError: The string did not match the expected pattern..
 PASS testSet('foo ', 'dummy') threw exception InvalidCharacterError: The string contains invalid characters..
-PASS testSet('foo豈', 'dummy') threw exception InvalidCharacterError: The string contains invalid characters..
 
 PASS testDelete('data-foo', 'foo') is true
 PASS testDelete('data-foo-bar', 'fooBar') is true

Modified: branches/safari-613-branch/LayoutTests/fast/dom/dataset-xhtml-expected.txt (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/fast/dom/dataset-xhtml-expected.txt	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/fast/dom/dataset-xhtml-expected.txt	2022-01-25 01:56:06 UTC (rev 288517)
@@ -21,10 +21,10 @@
 PASS testSet('-Foo', 'data---foo') is true
 PASS testSet('', 'data-') is true
 PASS testSet('à', 'data-à') is true
+PASS testSet('foo豈', 'data-foo豈') is true
 
 PASS testSet('-foo', 'dummy') threw exception SyntaxError: The string did not match the expected pattern..
 PASS testSet('foo ', 'dummy') threw exception InvalidCharacterError: The string contains invalid characters..
-PASS testSet('foo豈', 'dummy') threw exception InvalidCharacterError: The string contains invalid characters..
 
 PASS testDelete('data-foo', 'foo') is true
 PASS testDelete('data-foo-bar', 'fooBar') is true

Modified: branches/safari-613-branch/LayoutTests/fast/dom/dataset-xhtml.xhtml (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/fast/dom/dataset-xhtml.xhtml	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/fast/dom/dataset-xhtml.xhtml	2022-01-25 01:56:06 UTC (rev 288517)
@@ -54,11 +54,11 @@
 shouldBeTrue("testSet('-Foo', 'data---foo')");
 shouldBeTrue("testSet('', 'data-')");
 shouldBeTrue("testSet('\xE0', 'data-\xE0')");
+shouldBeTrue("testSet('foo\uF900', 'data-foo\uF900')");
 debug("");
 
 shouldThrowErrorName("testSet('-foo', 'dummy')", "SyntaxError");
 shouldThrowErrorName("testSet('foo\x20', 'dummy')", "InvalidCharacterError");
-shouldThrowErrorName("testSet('foo\uF900', 'dummy')", "InvalidCharacterError");
 debug("");
 
 function testDelete(attr, prop)

Modified: branches/safari-613-branch/LayoutTests/fast/dom/dataset.html (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/fast/dom/dataset.html	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/fast/dom/dataset.html	2022-01-25 01:56:06 UTC (rev 288517)
@@ -57,11 +57,11 @@
 shouldBeTrue("testSet('-Foo', 'data---foo')");
 shouldBeTrue("testSet('', 'data-')");
 shouldBeTrue("testSet('\xE0', 'data-\xE0')");
+shouldBeTrue("testSet('foo\uF900', 'data-foo\uF900')");
 debug("");
 
 shouldThrowErrorName("testSet('-foo', 'dummy')", "SyntaxError");
 shouldThrowErrorName("testSet('foo\x20', 'dummy')", "InvalidCharacterError");
-shouldThrowErrorName("testSet('foo\uF900', 'dummy')", "InvalidCharacterError");
 debug("");
 
 function testDelete(attr, prop)

Modified: branches/safari-613-branch/LayoutTests/imported/w3c/ChangeLog (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/imported/w3c/ChangeLog	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/ChangeLog	2022-01-25 01:56:06 UTC (rev 288517)
@@ -1,5 +1,73 @@
 2022-01-24  Alan Coon  <[email protected]>
 
+        Cherry-pick r288264. rdar://problem/87745419
+
+    Align our qualified name validation with the specification
+    https://bugs.webkit.org/show_bug.cgi?id=201699
+    
+    Reviewed by Geoffrey Garen.
+    
+    LayoutTests/imported/w3c:
+    
+    * web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt:
+    * web-platform-tests/dom/nodes/Document-createElementNS-expected.txt:
+    Rebaseline WPT tests now that more checks are passing.
+    
+    Source/WebCore:
+    
+    Align our qualified name validation with the latest specification:
+    - https://dom.spec.whatwg.org/#validate
+    - https://www.w3.org/TR/xml/#NT-NameStartChar
+    
+    No new tests, rebaselined existing tests.
+    
+    * dom/Document.cpp:
+    (WebCore::isValidNameStart):
+    (WebCore::isValidNamePart):
+    
+    LayoutTests:
+    
+    * dom/xhtml/level3/core/canonicalform06-expected.txt:
+    * dom/xhtml/level3/core/infoset06-expected.txt:
+    * dom/xhtml/level3/core/infoset07-expected.txt:
+    * dom/xhtml/level3/core/wellformed01-expected.txt:
+    * dom/xhtml/level3/core/wellformed02-expected.txt:
+    * dom/xhtml/level3/core/wellformed03-expected.txt:
+    * dom/xhtml/level3/core/wellformed04-expected.txt:
+    Rebaseline outdated imported tests.
+    
+    * fast/dom/DOMImplementation/createDocument-namespace-err-expected.txt:
+    * fast/dom/DOMImplementation/createDocument-namespace-err.html:
+    * fast/dom/Document/createAttributeNS-namespace-err-expected.txt:
+    * fast/dom/Document/createAttributeNS-namespace-err.html:
+    * fast/dom/Document/createElement-invalid-names-expected.txt:
+    * fast/dom/Document/createElement-invalid-names.html:
+    * fast/dom/Document/createElementNS-namespace-err-expected.txt:
+    * fast/dom/Document/createElementNS-namespace-err.html:
+    * fast/dom/Element/setAttributeNS-namespace-err-expected.txt:
+    * fast/dom/Element/setAttributeNS-namespace-err.html:
+    * fast/dom/dataset-expected.txt:
+    * fast/dom/dataset-xhtml-expected.txt:
+    * fast/dom/dataset-xhtml.xhtml:
+    * fast/dom/dataset.html:
+    Update and rebaseline outdated WebKit tests.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288264 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-19  Chris Dumez  <[email protected]>
+
+            Align our qualified name validation with the specification
+            https://bugs.webkit.org/show_bug.cgi?id=201699
+
+            Reviewed by Geoffrey Garen.
+
+            * web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt:
+            * web-platform-tests/dom/nodes/Document-createElementNS-expected.txt:
+            Rebaseline WPT tests now that more checks are passing.
+
+2022-01-24  Alan Coon  <[email protected]>
+
         Cherry-pick r288111. rdar://problem/87699260
 
     [:has() pseudo-class] Disallow nested :has()

Modified: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt	2022-01-25 01:56:06 UTC (rev 288517)
@@ -16,9 +16,9 @@
 PASS createDocument test: null,"foo1",null,null
 PASS createDocument test: metadata for null,"foo1",null
 PASS createDocument test: characterSet aliases for null,"foo1",null
-FAIL createDocument test: null,"ெfoo",null,null The string contains invalid characters.
-FAIL createDocument test: metadata for null,"ெfoo",null The string contains invalid characters.
-FAIL createDocument test: characterSet aliases for null,"ெfoo",null The string contains invalid characters.
+PASS createDocument test: null,"ெfoo",null,null
+PASS createDocument test: metadata for null,"ெfoo",null
+PASS createDocument test: characterSet aliases for null,"ெfoo",null
 PASS createDocument test: null,";foo",null,"INVALID_CHARACTER_ERR"
 PASS createDocument test: null,"}foo",null,"INVALID_CHARACTER_ERR"
 PASS createDocument test: null,"f}oo",null,"INVALID_CHARACTER_ERR"
@@ -112,14 +112,14 @@
 PASS createDocument test: "http://example.com/","a:_",null,null
 PASS createDocument test: metadata for "http://example.com/","a:_",null
 PASS createDocument test: characterSet aliases for "http://example.com/","a:_",null
-FAIL createDocument test: "http://example.com/","a:ெ",null,null The string contains invalid characters.
-FAIL createDocument test: metadata for "http://example.com/","a:ெ",null The string contains invalid characters.
-FAIL createDocument test: characterSet aliases for "http://example.com/","a:ெ",null The string contains invalid characters.
+PASS createDocument test: "http://example.com/","a:ெ",null,null
+PASS createDocument test: metadata for "http://example.com/","a:ெ",null
+PASS createDocument test: characterSet aliases for "http://example.com/","a:ெ",null
 PASS createDocument test: "http://example.com/","a:;",null,"INVALID_CHARACTER_ERR"
 PASS createDocument test: "http://example.com/","a:̀",null,"INVALID_CHARACTER_ERR"
-FAIL createDocument test: "http://example.com/","ெ:a",null,null The string contains invalid characters.
-FAIL createDocument test: metadata for "http://example.com/","ெ:a",null The string contains invalid characters.
-FAIL createDocument test: characterSet aliases for "http://example.com/","ெ:a",null The string contains invalid characters.
+PASS createDocument test: "http://example.com/","ெ:a",null,null
+PASS createDocument test: metadata for "http://example.com/","ெ:a",null
+PASS createDocument test: characterSet aliases for "http://example.com/","ெ:a",null
 PASS createDocument test: "http://example.com/","̀:a",null,"INVALID_CHARACTER_ERR"
 PASS createDocument test: "http://example.com/",";:a",null,"INVALID_CHARACTER_ERR"
 PASS createDocument test: "http://example.com/","a:aெ",null,null

Modified: branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-createElementNS-expected.txt (288516 => 288517)


--- branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-createElementNS-expected.txt	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-createElementNS-expected.txt	2022-01-25 01:56:06 UTC (rev 288517)
@@ -17,9 +17,9 @@
 PASS createElementNS test in HTML document: null,"foo1",null
 PASS createElementNS test in XML document: null,"foo1",null
 PASS createElementNS test in XHTML document: null,"foo1",null
-FAIL createElementNS test in HTML document: null,"ெfoo",null The string contains invalid characters.
-FAIL createElementNS test in XML document: null,"ெfoo",null The string contains invalid characters.
-FAIL createElementNS test in XHTML document: null,"ெfoo",null The string contains invalid characters.
+PASS createElementNS test in HTML document: null,"ெfoo",null
+PASS createElementNS test in XML document: null,"ெfoo",null
+PASS createElementNS test in XHTML document: null,"ெfoo",null
 PASS createElementNS test in HTML document: null,";foo","INVALID_CHARACTER_ERR"
 PASS createElementNS test in XML document: null,";foo","INVALID_CHARACTER_ERR"
 PASS createElementNS test in XHTML document: null,";foo","INVALID_CHARACTER_ERR"
@@ -209,9 +209,9 @@
 PASS createElementNS test in HTML document: "http://example.com/","a:_",null
 PASS createElementNS test in XML document: "http://example.com/","a:_",null
 PASS createElementNS test in XHTML document: "http://example.com/","a:_",null
-FAIL createElementNS test in HTML document: "http://example.com/","a:ெ",null The string contains invalid characters.
-FAIL createElementNS test in XML document: "http://example.com/","a:ெ",null The string contains invalid characters.
-FAIL createElementNS test in XHTML document: "http://example.com/","a:ெ",null The string contains invalid characters.
+PASS createElementNS test in HTML document: "http://example.com/","a:ெ",null
+PASS createElementNS test in XML document: "http://example.com/","a:ெ",null
+PASS createElementNS test in XHTML document: "http://example.com/","a:ெ",null
 PASS createElementNS test in HTML document: "http://example.com/","a:;","INVALID_CHARACTER_ERR"
 PASS createElementNS test in XML document: "http://example.com/","a:;","INVALID_CHARACTER_ERR"
 PASS createElementNS test in XHTML document: "http://example.com/","a:;","INVALID_CHARACTER_ERR"
@@ -218,9 +218,9 @@
 PASS createElementNS test in HTML document: "http://example.com/","a:̀","INVALID_CHARACTER_ERR"
 PASS createElementNS test in XML document: "http://example.com/","a:̀","INVALID_CHARACTER_ERR"
 PASS createElementNS test in XHTML document: "http://example.com/","a:̀","INVALID_CHARACTER_ERR"
-FAIL createElementNS test in HTML document: "http://example.com/","ெ:a",null The string contains invalid characters.
-FAIL createElementNS test in XML document: "http://example.com/","ெ:a",null The string contains invalid characters.
-FAIL createElementNS test in XHTML document: "http://example.com/","ெ:a",null The string contains invalid characters.
+PASS createElementNS test in HTML document: "http://example.com/","ெ:a",null
+PASS createElementNS test in XML document: "http://example.com/","ெ:a",null
+PASS createElementNS test in XHTML document: "http://example.com/","ெ:a",null
 PASS createElementNS test in HTML document: "http://example.com/","̀:a","INVALID_CHARACTER_ERR"
 PASS createElementNS test in XML document: "http://example.com/","̀:a","INVALID_CHARACTER_ERR"
 PASS createElementNS test in XHTML document: "http://example.com/","̀:a","INVALID_CHARACTER_ERR"

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (288516 => 288517)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-01-25 01:56:06 UTC (rev 288517)
@@ -1,5 +1,79 @@
 2022-01-24  Alan Coon  <[email protected]>
 
+        Cherry-pick r288264. rdar://problem/87745419
+
+    Align our qualified name validation with the specification
+    https://bugs.webkit.org/show_bug.cgi?id=201699
+    
+    Reviewed by Geoffrey Garen.
+    
+    LayoutTests/imported/w3c:
+    
+    * web-platform-tests/dom/nodes/DOMImplementation-createDocument-expected.txt:
+    * web-platform-tests/dom/nodes/Document-createElementNS-expected.txt:
+    Rebaseline WPT tests now that more checks are passing.
+    
+    Source/WebCore:
+    
+    Align our qualified name validation with the latest specification:
+    - https://dom.spec.whatwg.org/#validate
+    - https://www.w3.org/TR/xml/#NT-NameStartChar
+    
+    No new tests, rebaselined existing tests.
+    
+    * dom/Document.cpp:
+    (WebCore::isValidNameStart):
+    (WebCore::isValidNamePart):
+    
+    LayoutTests:
+    
+    * dom/xhtml/level3/core/canonicalform06-expected.txt:
+    * dom/xhtml/level3/core/infoset06-expected.txt:
+    * dom/xhtml/level3/core/infoset07-expected.txt:
+    * dom/xhtml/level3/core/wellformed01-expected.txt:
+    * dom/xhtml/level3/core/wellformed02-expected.txt:
+    * dom/xhtml/level3/core/wellformed03-expected.txt:
+    * dom/xhtml/level3/core/wellformed04-expected.txt:
+    Rebaseline outdated imported tests.
+    
+    * fast/dom/DOMImplementation/createDocument-namespace-err-expected.txt:
+    * fast/dom/DOMImplementation/createDocument-namespace-err.html:
+    * fast/dom/Document/createAttributeNS-namespace-err-expected.txt:
+    * fast/dom/Document/createAttributeNS-namespace-err.html:
+    * fast/dom/Document/createElement-invalid-names-expected.txt:
+    * fast/dom/Document/createElement-invalid-names.html:
+    * fast/dom/Document/createElementNS-namespace-err-expected.txt:
+    * fast/dom/Document/createElementNS-namespace-err.html:
+    * fast/dom/Element/setAttributeNS-namespace-err-expected.txt:
+    * fast/dom/Element/setAttributeNS-namespace-err.html:
+    * fast/dom/dataset-expected.txt:
+    * fast/dom/dataset-xhtml-expected.txt:
+    * fast/dom/dataset-xhtml.xhtml:
+    * fast/dom/dataset.html:
+    Update and rebaseline outdated WebKit tests.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288264 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-19  Chris Dumez  <[email protected]>
+
+            Align our qualified name validation with the specification
+            https://bugs.webkit.org/show_bug.cgi?id=201699
+
+            Reviewed by Geoffrey Garen.
+
+            Align our qualified name validation with the latest specification:
+            - https://dom.spec.whatwg.org/#validate
+            - https://www.w3.org/TR/xml/#NT-NameStartChar
+
+            No new tests, rebaselined existing tests.
+
+            * dom/Document.cpp:
+            (WebCore::isValidNameStart):
+            (WebCore::isValidNamePart):
+
+2022-01-24  Alan Coon  <[email protected]>
+
         Cherry-pick r288245. rdar://problem/85878291
 
     Limit the deprecated CSSOMPrimitiveValue to formerly standardized unit types

Modified: branches/safari-613-branch/Source/WebCore/dom/Document.cpp (288516 => 288517)


--- branches/safari-613-branch/Source/WebCore/dom/Document.cpp	2022-01-25 01:55:58 UTC (rev 288516)
+++ branches/safari-613-branch/Source/WebCore/dom/Document.cpp	2022-01-25 01:56:06 UTC (rev 288517)
@@ -397,75 +397,22 @@
 
 static const Seconds intersectionObserversInitialUpdateDelay { 2000_ms };
 
-// DOM Level 2 says (letters added):
-//
-// a) Name start characters must have one of the categories Ll, Lu, Lo, Lt, Nl.
-// b) Name characters other than Name-start characters must have one of the categories Mc, Me, Mn, Lm, or Nd.
-// c) Characters in the compatibility area (i.e. with character code greater than #xF900 and less than #xFFFE) are not allowed in XML names.
-// d) Characters which have a font or compatibility decomposition (i.e. those with a "compatibility formatting tag" in field 5 of the database -- marked by field 5 beginning with a "<") are not allowed.
-// e) The following characters are treated as name-start characters rather than name characters, because the property file classifies them as Alphabetic: [#x02BB-#x02C1], #x0559, #x06E5, #x06E6.
-// f) Characters #x20DD-#x20E0 are excluded (in accordance with Unicode, section 5.14).
-// g) Character #x00B7 is classified as an extender, because the property list so identifies it.
-// h) Character #x0387 is added as a name character, because #x00B7 is its canonical equivalent.
-// i) Characters ':' and '_' are allowed as name-start characters.
-// j) Characters '-' and '.' are allowed as name characters.
-//
-// It also contains complete tables. If we decide it's better, we could include those instead of the following code.
-
+// https://www.w3.org/TR/xml/#NT-NameStartChar
+// NameStartChar       ::=       ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
 static inline bool isValidNameStart(UChar32 c)
 {
-    // rule (e) above
-    if ((c >= 0x02BB && c <= 0x02C1) || c == 0x559 || c == 0x6E5 || c == 0x6E6)
-        return true;
-
-    // rule (i) above
-    if (c == ':' || c == '_')
-        return true;
-
-    // rules (a) and (f) above
-    if (!(U_GET_GC_MASK(c) & (U_GC_LL_MASK | U_GC_LU_MASK | U_GC_LO_MASK | U_GC_LT_MASK | U_GC_NL_MASK)))
-        return false;
-
-    // rule (c) above
-    if (c >= 0xF900 && c < 0xFFFE)
-        return false;
-
-    // rule (d) above
-    int type = u_getIntPropertyValue(c, UCHAR_DECOMPOSITION_TYPE);
-    if (type == U_DT_FONT || type == U_DT_COMPAT)
-        return false;
-
-    return true;
+    return c == ':' || (c >= 'A' && c <= 'Z') || c == '_' || (c >= 'a' && c <= 'z') || (c >= 0x00C0 && c <= 0x00D6)
+        || (c >= 0x00D8 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x02FF) || (c >= 0x0370 && c <= 0x037D) || (c >= 0x037F && c <= 0x1FFF)
+        || (c >= 0x200C && c <= 0x200D) || (c >= 0x2070 && c <= 0x218F) || (c >= 0x2C00 && c <= 0x2FeF) || (c >= 0x3001 && c <= 0xD7FF)
+        || (c >= 0xF900 && c <= 0xFDCF) || (c >= 0xFDF0 && c <= 0xFFFD) || (c >= 0x10000 && c <= 0xEFFFF);
 }
 
+// https://www.w3.org/TR/xml/#NT-NameChar
+// NameChar       ::=       NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
 static inline bool isValidNamePart(UChar32 c)
 {
-    // rules (a), (e), and (i) above
-    if (isValidNameStart(c))
-        return true;
-
-    // rules (g) and (h) above
-    if (c == 0x00B7 || c == 0x0387)
-        return true;
-
-    // rule (j) above
-    if (c == '-' || c == '.')
-        return true;
-
-    // rules (b) and (f) above
-    if (!(U_GET_GC_MASK(c) & (U_GC_M_MASK | U_GC_LM_MASK | U_GC_ND_MASK)))
-        return false;
-
-    // rule (c) above
-    if (c >= 0xF900 && c < 0xFFFE)
-        return false;
-
-    // rule (d) above
-    int type = u_getIntPropertyValue(c, UCHAR_DECOMPOSITION_TYPE);
-    if (type == U_DT_FONT || type == U_DT_COMPAT)
-        return false;
-
-    return true;
+    return isValidNameStart(c) || c == '-' || c == '.' || (c >= '0' && c <= '9') || c == 0x00B7
+        || (c >= 0x0300 && c <= 0x036F) || (c >= 0x203F && c <= 0x2040);
 }
 
 static Widget* widgetForElement(Element* focusedElement)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to