[WPT] dom/nodes/Document-createCDATASection-xhtml.xhtml fails due to missing exceptio...
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Jun 2020 18:35:39 +0000 (18:35 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Jun 2020 18:35:39 +0000 (18:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=213167

Reviewed by Yusuke Suzuki.

LayoutTests/imported/w3c:

* web-platform-tests/dom/nodes/Document-createCDATASection-xhtml-expected.txt:
Update results to show we are now passing all subtests.

Source/WebCore:

Tested by existing (formerly failing) test: imported/w3c/web-platform-tests/dom/nodes/Document-createCDATASection-xhtml.xhtml

Throw an "InvalidCharacterError" DOMException if the data passed to createCDATASection
contains the string "]]>" as specified by https://dom.spec.whatwg.org/#dom-document-createcdatasection

* dom/Document.cpp:
(WebCore::Document::createCDATASection):

LayoutTests:

* dom/xhtml/level3/core/documentnormalizedocument07-expected.txt:
* dom/xhtml/level3/core/documentnormalizedocument08-expected.txt:
* dom/xhtml/level3/core/handleerror01-expected.txt:
* dom/xhtml/level3/core/splitcdatasections01-expected.txt:
Update expected results with new error now being thrown.

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

LayoutTests/ChangeLog
LayoutTests/dom/xhtml/level3/core/documentnormalizedocument07-expected.txt
LayoutTests/dom/xhtml/level3/core/documentnormalizedocument08-expected.txt
LayoutTests/dom/xhtml/level3/core/handleerror01-expected.txt
LayoutTests/dom/xhtml/level3/core/splitcdatasections01-expected.txt
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-createCDATASection-xhtml-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp

index 161d90d..88b1efe 100644 (file)
@@ -1,3 +1,16 @@
+2020-06-13  Sam Weinig  <weinig@apple.com>
+
+        [WPT] dom/nodes/Document-createCDATASection-xhtml.xhtml fails due to missing exception in Document.createCDATASection()
+        https://bugs.webkit.org/show_bug.cgi?id=213167
+
+        Reviewed by Yusuke Suzuki.
+
+        * dom/xhtml/level3/core/documentnormalizedocument07-expected.txt:
+        * dom/xhtml/level3/core/documentnormalizedocument08-expected.txt:
+        * dom/xhtml/level3/core/handleerror01-expected.txt:
+        * dom/xhtml/level3/core/splitcdatasections01-expected.txt:
+        Update expected results with new error now being thrown.
+
 2020-06-12  Simon Fraser  <simon.fraser@apple.com>
 
         REGRESSION(r261985): Unable to respond to large comments on Bugzilla with always-on scrollbars
index 8cda272..c129546 100644 (file)
@@ -1,3 +1,3 @@
 Test   http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentnormalizedocument07
 Status error
-Message        Line 143: TypeError
+Message        Line 139: InvalidCharacterError
index 228909a..f0bc430 100644 (file)
@@ -1,3 +1,3 @@
 Test   http://www.w3.org/2001/DOM-Test-Suite/level3/core/documentnormalizedocument08
 Status error
-Message        Line 124: TypeError
+Message        Line 116: InvalidCharacterError
index 2b41cac..a6f116d 100644 (file)
@@ -1,3 +1,3 @@
 Test   http://www.w3.org/2001/DOM-Test-Suite/level3/core/handleerror01
 Status error
-Message        Line 150: TypeError
+Message        Line 144: InvalidCharacterError
index 52e3aca..25405c8 100644 (file)
@@ -1,3 +1,3 @@
 Test   http://www.w3.org/2001/DOM-Test-Suite/level3/core/splitcdatasections01
 Status error
-Message        Line 115: TypeError
+Message        Line 111: InvalidCharacterError
index b9eaf38..0128c61 100644 (file)
@@ -1,3 +1,13 @@
+2020-06-13  Sam Weinig  <weinig@apple.com>
+
+        [WPT] dom/nodes/Document-createCDATASection-xhtml.xhtml fails due to missing exception in Document.createCDATASection()
+        https://bugs.webkit.org/show_bug.cgi?id=213167
+
+        Reviewed by Yusuke Suzuki.
+
+        * web-platform-tests/dom/nodes/Document-createCDATASection-xhtml-expected.txt:
+        Update results to show we are now passing all subtests.
+
 2020-06-12  Tetsuharu Ohzeki  <tetsuharu.ohzeki@gmail.com>
 
         Change FileReader.error to DOMException from obsoleted FileError
index d95c8ff..e3da112 100644 (file)
@@ -5,5 +5,5 @@ PASS createCDATASection("a-")
 PASS createCDATASection("-b") 
 PASS createCDATASection(null) 
 PASS createCDATASection(undefined) 
-FAIL Creating a CDATA section containing the string "]]>" must throw assert_throws_dom: function "() => document.createCDATASection(" ]" + "]>  ")" did not throw
+PASS Creating a CDATA section containing the string "]]>" must throw 
 
index d0b1596..64f6d2e 100644 (file)
@@ -1,3 +1,18 @@
+2020-06-13  Sam Weinig  <weinig@apple.com>
+
+        [WPT] dom/nodes/Document-createCDATASection-xhtml.xhtml fails due to missing exception in Document.createCDATASection()
+        https://bugs.webkit.org/show_bug.cgi?id=213167
+
+        Reviewed by Yusuke Suzuki.
+
+        Tested by existing (formerly failing) test: imported/w3c/web-platform-tests/dom/nodes/Document-createCDATASection-xhtml.xhtml
+
+        Throw an "InvalidCharacterError" DOMException if the data passed to createCDATASection
+        contains the string "]]>" as specified by https://dom.spec.whatwg.org/#dom-document-createcdatasection
+
+        * dom/Document.cpp:
+        (WebCore::Document::createCDATASection):
+
 2020-06-13  Michael Catanzaro  <mcatanzaro@gnome.org>
 
         Obsolete comment in FontCustomPlatformDataFreeType.cpp
index ac92e68..f8ed647 100644 (file)
@@ -1027,6 +1027,10 @@ ExceptionOr<Ref<CDATASection>> Document::createCDATASection(const String& data)
 {
     if (isHTMLDocument())
         return Exception { NotSupportedError };
+
+    if (data.contains("]]>"))
+        return Exception { InvalidCharacterError };
+
     return CDATASection::create(*this, data);
 }