⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243817 in webkit


Ignore:
Timestamp:
Apr 3, 2019, 12:13:49 PM (7 years ago)
Author:
Chris Dumez
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:

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.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r243813 r243817  
     12019-04-03  Chris Dumez  <cdumez@apple.com>
     2
     3        [XML Parser] Insert the error message block when stopping parsing and an error occurred
     4        https://bugs.webkit.org/show_bug.cgi?id=196546
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Rebaseline WPT test now that all checks are passing. Both Gecko and Blink already passed
     9        these checks.
     10
     11        * web-platform-tests/domparsing/DOMParser-parseFromString-xml-parsererror-expected.txt:
     12
    1132019-04-03  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-xml-parsererror-expected.txt

    r243813 r243817  
    11
    2 FAIL DOMParser: <parsererror> element added on error, <span x:test="testing">1</span> assert_equals: expecting one parsererror expected 1 but got 0
     2PASS DOMParser: <parsererror> element added on error, <span x:test="testing">1</span>
    33PASS DOMParser: <parsererror> element added on error, < span>2</span>
    4 FAIL DOMParser: <parsererror> element added on error, <span :test="testing">3</span> assert_equals: expecting one parsererror expected 1 but got 0
     4PASS DOMParser: <parsererror> element added on error, <span :test="testing">3</span>
    55PASS DOMParser: <parsererror> element added on error, <span><em>4</span></em>
    66PASS DOMParser: <parsererror> element added on error, <span>5
     
    1010PASS DOMParser: <parsererror> element added on error, <span novalue>9</span>
    1111PASS DOMParser: <parsererror> element added on error, <span ="noattr">10</span>
    12 FAIL DOMParser: <parsererror> element added on error, <span ::="test">11</span> assert_equals: expecting one parsererror expected 1 but got 0
    13 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
     12PASS DOMParser: <parsererror> element added on error, <span ::="test">11</span>
     13PASS DOMParser: <parsererror> element added on error, <span xmlns:="urn:x-test:test">12</span>
    1414PASS DOMParser: <parsererror> element added on error, <span xmlns:xmlns="">13</span>
    1515PASS DOMParser: <parsererror> element added on error, <span data-test=testing>14</span>
  • trunk/Source/WebCore/ChangeLog

    r243812 r243817  
     12019-04-03  Chris Dumez  <cdumez@apple.com>
     2
     3        [XML Parser] Insert the error message block when stopping parsing and an error occurred
     4        https://bugs.webkit.org/show_bug.cgi?id=196546
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Insert the error message block when stopping parsing and an error occurred. This is based
     9        on the following Blink commit:
     10        - https://chromium.googlesource.com/chromium/src.git/+/565958bc22e2d49fed7af144482c2bf4d416fec5
     11
     12        No new tests, rebaselined existing test.
     13
     14        * xml/parser/XMLDocumentParser.cpp:
     15        (WebCore::XMLDocumentParser::end):
     16        Avoid showing the error message block twice in some cases. No need to ever call
     17        insertErrorMessageBlock() if we're already stopped since stopParsing() already
     18        takes care of doing this.
     19
     20        * xml/parser/XMLDocumentParserLibxml2.cpp:
     21        (WebCore::XMLDocumentParser::stopParsing):
     22        When XMLDocumentParser::stopParsing() is called to stop parsing, call
     23        insertErrorMessageBlock() to insert the <parsererror> element if an error
     24        occurred.
     25
    1262019-04-03  Youenn Fablet  <youenn@apple.com>
    227
  • trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp

    r239535 r243817  
    190190        return;
    191191
    192     if (m_sawError) {
     192    if (m_sawError && !isStopped()) {
    193193        insertErrorMessageBlock();
    194194        if (isDetached()) // Inserting an error message may have ran arbitrary scripts.
  • trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp

    r239569 r243817  
    13881388void XMLDocumentParser::stopParsing()
    13891389{
     1390    if (m_sawError)
     1391        insertErrorMessageBlock();
     1392
    13901393    DocumentParser::stopParsing();
    13911394    if (context())
Note: See TracChangeset for help on using the changeset viewer.