Title: [243817] trunk
Revision
243817
Author
[email protected]
Date
2019-04-03 12:13:49 -0700 (Wed, 03 Apr 2019)

Log Message

[XML Parser] Insert the error message block when stopping parsing and an error occurred
https://bugs.webkit.org/show_bug.cgi?id=196546

Reviewed by Alexey Proskuryakov.

LayoutTests/imported/w3c:

Rebaseline WPT test now that all checks are passing. Both Gecko and Blink already passed
these checks.

* web-platform-tests/domparsing/DOMParser-parseFromString-xml-parsererror-expected.txt:

Source/WebCore:

Insert the error message block when stopping parsing and an error occurred. This is based
on the following Blink commit:
- https://chromium.googlesource.com/chromium/src.git/+/565958bc22e2d49fed7af144482c2bf4d416fec5

No new tests, rebaselined existing test.

* xml/parser/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::end):
Avoid showing the error message block twice in some cases. No need to ever call
insertErrorMessageBlock() if we're already stopped since stopParsing() already
takes care of doing this.

* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::stopParsing):
When XMLDocumentParser::stopParsing() is called to stop parsing, call
insertErrorMessageBlock() to insert the <parsererror> element if an error
occurred.

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (243816 => 243817)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-04-03 18:05:03 UTC (rev 243816)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-04-03 19:13:49 UTC (rev 243817)
@@ -1,5 +1,17 @@
 2019-04-03  Chris Dumez  <[email protected]>
 
+        [XML Parser] Insert the error message block when stopping parsing and an error occurred
+        https://bugs.webkit.org/show_bug.cgi?id=196546
+
+        Reviewed by Alexey Proskuryakov.
+
+        Rebaseline WPT test now that all checks are passing. Both Gecko and Blink already passed
+        these checks.
+
+        * web-platform-tests/domparsing/DOMParser-parseFromString-xml-parsererror-expected.txt:
+
+2019-04-03  Chris Dumez  <[email protected]>
+
         Re-sync web-platform-tests/domparsing from upstream
         https://bugs.webkit.org/show_bug.cgi?id=196544
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-parsererror-expected.txt (243816 => 243817)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-parsererror-expected.txt	2019-04-03 18:05:03 UTC (rev 243816)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-parsererror-expected.txt	2019-04-03 19:13:49 UTC (rev 243817)
@@ -1,7 +1,7 @@
 
-FAIL DOMParser: <parsererror> element added on error, <span x:test="testing">1</span> assert_equals: expecting one parsererror expected 1 but got 0
+PASS DOMParser: <parsererror> element added on error, <span x:test="testing">1</span> 
 PASS DOMParser: <parsererror> element added on error, < span>2</span> 
-FAIL DOMParser: <parsererror> element added on error, <span :test="testing">3</span> assert_equals: expecting one parsererror expected 1 but got 0
+PASS DOMParser: <parsererror> element added on error, <span :test="testing">3</span> 
 PASS DOMParser: <parsererror> element added on error, <span><em>4</span></em> 
 PASS DOMParser: <parsererror> element added on error, <span>5 
 PASS DOMParser: <parsererror> element added on error, 6</span> 
@@ -9,8 +9,8 @@
 PASS DOMParser: <parsererror> element added on error, <span>8</ span> 
 PASS DOMParser: <parsererror> element added on error, <span novalue>9</span> 
 PASS DOMParser: <parsererror> element added on error, <span ="noattr">10</span> 
-FAIL DOMParser: <parsererror> element added on error, <span ::="test">11</span> assert_equals: expecting one parsererror expected 1 but got 0
-FAIL DOMParser: <parsererror> element added on error, <span xmlns:="urn:x-test:test">12</span> assert_equals: expecting one parsererror expected 1 but got 0
+PASS DOMParser: <parsererror> element added on error, <span ::="test">11</span> 
+PASS DOMParser: <parsererror> element added on error, <span xmlns:="urn:x-test:test">12</span> 
 PASS DOMParser: <parsererror> element added on error, <span xmlns:xmlns="">13</span> 
 PASS DOMParser: <parsererror> element added on error, <span data-test=testing>14</span> 
 PASS DOMParser: <parsererror> element added on error, 15<span 

Modified: trunk/Source/WebCore/ChangeLog (243816 => 243817)


--- trunk/Source/WebCore/ChangeLog	2019-04-03 18:05:03 UTC (rev 243816)
+++ trunk/Source/WebCore/ChangeLog	2019-04-03 19:13:49 UTC (rev 243817)
@@ -1,3 +1,28 @@
+2019-04-03  Chris Dumez  <[email protected]>
+
+        [XML Parser] Insert the error message block when stopping parsing and an error occurred
+        https://bugs.webkit.org/show_bug.cgi?id=196546
+
+        Reviewed by Alexey Proskuryakov.
+
+        Insert the error message block when stopping parsing and an error occurred. This is based
+        on the following Blink commit:
+        - https://chromium.googlesource.com/chromium/src.git/+/565958bc22e2d49fed7af144482c2bf4d416fec5
+
+        No new tests, rebaselined existing test.
+
+        * xml/parser/XMLDocumentParser.cpp:
+        (WebCore::XMLDocumentParser::end):
+        Avoid showing the error message block twice in some cases. No need to ever call
+        insertErrorMessageBlock() if we're already stopped since stopParsing() already
+        takes care of doing this.
+
+        * xml/parser/XMLDocumentParserLibxml2.cpp:
+        (WebCore::XMLDocumentParser::stopParsing):
+        When XMLDocumentParser::stopParsing() is called to stop parsing, call
+        insertErrorMessageBlock() to insert the <parsererror> element if an error
+        occurred.
+
 2019-04-03  Youenn Fablet  <[email protected]>
 
         Clear WorkerCacheStorageConnection callbacks on WorkerGlobalScope termination

Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp (243816 => 243817)


--- trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp	2019-04-03 18:05:03 UTC (rev 243816)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp	2019-04-03 19:13:49 UTC (rev 243817)
@@ -189,7 +189,7 @@
     if (m_parserPaused)
         return;
 
-    if (m_sawError) {
+    if (m_sawError && !isStopped()) {
         insertErrorMessageBlock();
         if (isDetached()) // Inserting an error message may have ran arbitrary scripts.
             return;

Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp (243816 => 243817)


--- trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp	2019-04-03 18:05:03 UTC (rev 243816)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp	2019-04-03 19:13:49 UTC (rev 243817)
@@ -1387,6 +1387,9 @@
 
 void XMLDocumentParser::stopParsing()
 {
+    if (m_sawError)
+        insertErrorMessageBlock();
+
     DocumentParser::stopParsing();
     if (context())
         xmlStopParser(context());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to