Changeset 249866 in webkit


Ignore:
Timestamp:
Sep 13, 2019 6:57:35 PM (5 years ago)
Author:
Joseph Pecoraro
Message:

Web Inspector: HTML Formatting: Handle infinite loop for incomplete script data
https://bugs.webkit.org/show_bug.cgi?id=201769

Reviewed by Devin Rousso.

Source/WebInspectorUI:

  • UserInterface/Workers/Formatter/HTMLParser.js:

(HTMLParser):
Handle EOF in the script data's loop.
Better handle EOF at the end of text data.

LayoutTests:

  • inspector/formatting/formatting-html-expected.txt:
  • inspector/formatting/formatting-html.html:
  • inspector/formatting/resources/html-tests/eof-7-expected.html: Added.
  • inspector/formatting/resources/html-tests/eof-7.html: Added.
  • inspector/formatting/resources/html-tests/eof-8-expected.html: Added.
  • inspector/formatting/resources/html-tests/eof-8.html: Added.
  • inspector/formatting/resources/html-tests/eof-9-expected.html: Added.
  • inspector/formatting/resources/html-tests/eof-9.html: Added.
Location:
trunk
Files:
6 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r249860 r249866  
     12019-09-13  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: HTML Formatting: Handle infinite loop for incomplete script data
     4        https://bugs.webkit.org/show_bug.cgi?id=201769
     5
     6        Reviewed by Devin Rousso.
     7
     8        * inspector/formatting/formatting-html-expected.txt:
     9        * inspector/formatting/formatting-html.html:
     10        * inspector/formatting/resources/html-tests/eof-7-expected.html: Added.
     11        * inspector/formatting/resources/html-tests/eof-7.html: Added.
     12        * inspector/formatting/resources/html-tests/eof-8-expected.html: Added.
     13        * inspector/formatting/resources/html-tests/eof-8.html: Added.
     14        * inspector/formatting/resources/html-tests/eof-9-expected.html: Added.
     15        * inspector/formatting/resources/html-tests/eof-9.html: Added.
     16
    1172019-09-13  Russell Epstein  <repstein@apple.com>
    218
  • trunk/LayoutTests/inspector/formatting/formatting-html-expected.txt

    r249831 r249866  
    1515PASS: eof-5.html
    1616PASS: eof-6.html
     17PASS: eof-7.html
     18PASS: eof-8.html
     19PASS: eof-9.html
    1720PASS: inline-script.html
    1821PASS: inline-style.html
  • trunk/LayoutTests/inspector/formatting/formatting-html.html

    r249831 r249866  
    2121        "resources/html-tests/eof-5.html",
    2222        "resources/html-tests/eof-6.html",
     23        "resources/html-tests/eof-7.html",
     24        "resources/html-tests/eof-8.html",
     25        "resources/html-tests/eof-9.html",
    2326        "resources/html-tests/inline-script.html",
    2427        "resources/html-tests/inline-style.html",
  • trunk/Source/WebInspectorUI/ChangeLog

    r249863 r249866  
     12019-09-13  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: HTML Formatting: Handle infinite loop for incomplete script data
     4        https://bugs.webkit.org/show_bug.cgi?id=201769
     5
     6        Reviewed by Devin Rousso.
     7
     8        * UserInterface/Workers/Formatter/HTMLParser.js:
     9        (HTMLParser):
     10        Handle EOF in the script data's loop.
     11        Better handle EOF at the end of text data.
     12
    1132019-09-13  Joseph Pecoraro  <pecoraro@apple.com>
    214
  • trunk/Source/WebInspectorUI/UserInterface/Workers/Formatter/HTMLParser.js

    r249831 r249866  
    178178        if (text)
    179179            this._push({type: HTMLParser.NodeType.Text, data: text, pos: startPos});
    180         this._handleEOF(this._pos - 1);
     180
     181        if (this._isEOF() && this._data.endsWith("<"))
     182            this._handleEOF(this._pos - 1);
    181183    }
    182184
     
    194196                break;
    195197            }
     198            if (this._handleEOF(startPos))
     199                return;
    196200            scriptText += "<";
    197201        }
     
    434438    {
    435439        if (!this._isEOF())
    436             return;
     440            return false;
    437441
    438442        // End of document. Treat everything from the last position as error text.
    439443        this._push({type: HTMLParser.NodeType.ErrorText, data: this._data.substring(lastPosition), pos: lastPosition});
     444        return true;
    440445    }
    441446
Note: See TracChangeset for help on using the changeset viewer.