Changeset 13381 in webkit


Ignore:
Timestamp:
Mar 18, 2006 9:47:01 PM (18 years ago)
Author:
darin
Message:

LayoutTests:

Reviewed by Darin.

  • fast/js/exception-linenums-in-html-3-expected.txt: Added.
  • fast/js/exception-linenums-in-html-3.html: Added.

Identical to fast/js/exception-linenums-in-html-1.html except that it contains
an unclosed <style> tag, which causes the code path for Bug 6314 to be tested.

  • fast/js/missing-style-end-tag-js-expected.txt: Added.
  • fast/js/missing-style-end-tag-js.html: Added.

While developing a fix for Bug 6314, a state variable (scriptCodeSize) was not
reset in the tokenizer causing the next <script></script> tags to contain the
entire contents of the document after the open <title> tag. This test case
tests for that condition.

  • fast/tokenizer/missing-style-end-tag-1-expected.checksum: Added.
  • fast/tokenizer/missing-style-end-tag-1-expected.png: Added.
  • fast/tokenizer/missing-style-end-tag-1-expected.txt: Added.
  • fast/tokenizer/missing-style-end-tag-1.html: Added.
  • fast/tokenizer/missing-style-end-tag-2-expected.checksum: Added.
  • fast/tokenizer/missing-style-end-tag-2-expected.png: Added.
  • fast/tokenizer/missing-style-end-tag-2-expected.txt: Added.
  • fast/tokenizer/missing-style-end-tag-2.html: Added.

The first test case contains an unclosed <style> tag in <head>, while the
second test case contains an unclosed <style> tag in <body>. These two test
cases result in different code paths being taken.

WebCore:

Reviewed by Darin.

Test: fast/js/exception-linenums-in-html-3.html
Test: fast/js/missing-style-end-tag-js.html
Test: fast/tokenizer/missing-style-end-tag-1.html
Test: fast/tokenizer/missing-style-end-tag-2.html

  • khtml/html/htmlparser.cpp: (WebCore::HTMLParser::handleError): Add check for missing </style> tag and handle this condition if identified.
  • khtml/html/htmltokenizer.cpp: (WebCore::HTMLTokenizer::parseTag): If parseSpecial() consumes the rest of the document looking for a </style> tag, reset the state of the tokenizer and retokenize with no special handling for <style>. The parser will handle the missing </style> tag in HTMLParser::handleError().
Location:
trunk
Files:
12 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r13379 r13381  
     12006-03-18  David Kilzer  <ddkilzer@kilzer.net>
     2
     3        Reviewed by Darin.
     4
     5        - Tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=6314
     6        Unclosed <style> element in <head> makes page completely blank
     7
     8        * fast/js/exception-linenums-in-html-3-expected.txt: Added.
     9        * fast/js/exception-linenums-in-html-3.html: Added.
     10
     11        Identical to fast/js/exception-linenums-in-html-1.html except that it contains
     12        an unclosed <style> tag, which causes the code path for Bug 6314 to be tested.
     13
     14        * fast/js/missing-style-end-tag-js-expected.txt: Added.
     15        * fast/js/missing-style-end-tag-js.html: Added.
     16
     17        While developing a fix for Bug 6314, a state variable (scriptCodeSize) was not
     18        reset in the tokenizer causing the next <script></script> tags to contain the
     19        entire contents of the document after the open <title> tag.  This test case
     20        tests for that condition.
     21
     22        * fast/tokenizer/missing-style-end-tag-1-expected.checksum: Added.
     23        * fast/tokenizer/missing-style-end-tag-1-expected.png: Added.
     24        * fast/tokenizer/missing-style-end-tag-1-expected.txt: Added.
     25        * fast/tokenizer/missing-style-end-tag-1.html: Added.
     26        * fast/tokenizer/missing-style-end-tag-2-expected.checksum: Added.
     27        * fast/tokenizer/missing-style-end-tag-2-expected.png: Added.
     28        * fast/tokenizer/missing-style-end-tag-2-expected.txt: Added.
     29        * fast/tokenizer/missing-style-end-tag-2.html: Added.
     30
     31        The first test case contains an unclosed <style> tag in <head>, while the
     32        second test case contains an unclosed <style> tag in <body>.  These two test
     33        cases result in different code paths being taken.
     34
    1352006-03-18  Alexey Proskuryakov  <ap@nypop.com>
    236
  • trunk/WebCore/ChangeLog

    r13380 r13381  
    1 2006-03-15  Rob Buis  <buis@kde.org>
     12006-03-18  David Kilzer  <ddkilzer@kilzer.net>
     2
     3        Reviewed by Darin.
     4
     5        - Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=6314
     6        Unclosed <style> element in <head> makes page completely blank
     7
     8        Test: fast/js/exception-linenums-in-html-3.html
     9        Test: fast/js/missing-style-end-tag-js.html
     10        Test: fast/tokenizer/missing-style-end-tag-1.html
     11        Test: fast/tokenizer/missing-style-end-tag-2.html
     12
     13        * khtml/html/htmlparser.cpp:
     14        (WebCore::HTMLParser::handleError): Add check for missing </style> tag and handle
     15        this condition if identified.
     16        * khtml/html/htmltokenizer.cpp:
     17        (WebCore::HTMLTokenizer::parseTag): If parseSpecial() consumes the rest of the
     18        document looking for a </style> tag, reset the state of the tokenizer and
     19        retokenize with no special handling for <style>.  The parser will handle the
     20        missing </style> tag in HTMLParser::handleError().
     21
     222006-03-18  Rob Buis  <buis@kde.org>
    223
    324        Reviewed by Darin.
  • trunk/WebCore/khtml/html/htmlparser.cpp

    r13262 r13381  
    469469            }
    470470        } else if (h->hasLocalName(addressTag) || h->hasLocalName(dlTag) || h->hasLocalName(dtTag)
    471                    || h->hasLocalName(fontTag) || h->hasLocalName(titleTag)) {
     471                   || h->hasLocalName(fontTag) || h->hasLocalName(styleTag) || h->hasLocalName(titleTag)) {
    472472            popBlock(currentTagName);
    473473            handled = true;
  • trunk/WebCore/khtml/html/htmltokenizer.cpp

    r13369 r13381  
    12531253                    searchStopper = styleEnd;
    12541254                    searchStopperLen = 7;
     1255                    State savedState = state;
     1256                    SegmentedString savedSrc = src;
     1257                    long savedLineno = lineno;
    12551258                    state.setInStyle(true);
    12561259                    state = parseSpecial(src, state);
     1260                    if (state.inStyle() && src.isEmpty()) {
     1261                        // We just ate the rest of the document as the style #text node!
     1262                        // Reset the state then retokenize without special style handling.
     1263                        // Let the html parser clean up the missing </style> tag.
     1264                        state = savedState;
     1265                        src = savedSrc;
     1266                        lineno = savedLineno;
     1267                        scriptCodeSize = 0;
     1268                    }
    12571269                }
    12581270            } else if (tagName == textareaTag) {
Note: See TracChangeset for help on using the changeset viewer.