Changeset 44608 in webkit


Ignore:
Timestamp:
Jun 11, 2009 11:15:05 AM (15 years ago)
Author:
bfulgham@webkit.org
Message:

2009-06-11 Shinichiro Hamaji <hamaji@chromium.org>

Reviewed by Adam Barth.

https://bugs.webkit.org/show_bug.cgi?id=25512
Handle texts after unfinished special tags (i.e., script, style, textarea,
title, xmp, and iframe) as the text node under the tags in view-source mode.
Before this change, all texts in unfinished special tags cannot be seen even in view-source mode.

Location:
trunk
Files:
4 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r44602 r44608  
     12009-06-11  Shinichiro Hamaji  <hamaji@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=25512
     6        Handle texts after unfinished special tags (i.e., script, style, textarea,
     7        title, xmp, and iframe) as the text node under the tags in view-source mode.
     8        Before this change, all texts in unfinished special tags cannot be seen even in view-source mode.
     9
     10        This was already done only for title. This change allows other special tags to be handled as well.
     11
     12        The test case verifies if the texts in the unfinished special tags are visible in view-source mode. Also, fixed window-shadow-location-using-* tests so that they don't use unfinished iframe anymore.
     13
     14        * fast/dom/Window/Location/window-shadow-location-using-js-object-with-toString-expected.txt:
     15        * fast/dom/Window/Location/window-shadow-location-using-js-object-with-toString.html:
     16        * fast/dom/Window/Location/window-shadow-location-using-string-expected.txt:
     17        * fast/dom/Window/Location/window-shadow-location-using-string.html:
     18        * fast/frames/resources/viewsource-frame-unfinished-script.html: Added.
     19        * fast/frames/resources/viewsource-frame-unfinished-textarea.html: Added.
     20        * fast/frames/viewsource-unfinished-tags-expected.txt: Added.
     21        * fast/frames/viewsource-unfinished-tags.html: Added.
     22
    1232009-06-10  Brent Fulgham  <bfulgham@gmail.com>
    224
  • trunk/LayoutTests/fast/dom/Window/Location/window-shadow-location-using-js-object-with-toString-expected.txt

    r42218 r44608  
     1PASS successfullyParsed is true
     2
     3TEST COMPLETE
    14PASS result is 'pass.html'
    25
  • trunk/LayoutTests/fast/dom/Window/Location/window-shadow-location-using-js-object-with-toString.html

    r42218 r44608  
    2323    successfullyParsed = true;
    2424</script>
    25 <iframe onload="frameLoaded()" src="resources/window-shadow-location-using-js-object-with-toString-iframe.html">
     25<iframe onload="frameLoaded()" src="resources/window-shadow-location-using-js-object-with-toString-iframe.html"></iframe>
    2626<script src="../../../js/resources/js-test-post.js"></script>
    2727</body>
  • trunk/LayoutTests/fast/dom/Window/Location/window-shadow-location-using-string-expected.txt

    r42218 r44608  
     1PASS successfullyParsed is true
     2
     3TEST COMPLETE
    14PASS result is 'pass.html'
    25
  • trunk/LayoutTests/fast/dom/Window/Location/window-shadow-location-using-string.html

    r42218 r44608  
    2323    successfullyParsed = true;
    2424</script>
    25 <iframe onload="frameLoaded()" src="resources/window-shadow-location-using-string-iframe.html">
     25<iframe onload="frameLoaded()" src="resources/window-shadow-location-using-string-iframe.html"></iframe>
    2626<script src="../../../js/resources/js-test-post.js"></script>
    2727</body>
  • trunk/WebCore/ChangeLog

    r44605 r44608  
     12009-06-11  Shinichiro Hamaji  <hamaji@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=25512
     6        Handle texts after unfinished special tags (i.e., script, style, textarea,
     7        title, xmp, and iframe) as the text node under the tags in view-source mode.
     8        Before this change, all texts in unfinished special tags cannot be seen even in view-source mode.
     9
     10        This was already done only for title. This change allows other special tags to be handled as well.
     11
     12        Test: fast/frames/viewsource-unfinished-tags.html
     13
     14        * html/HTMLTokenizer.cpp:
     15        (WebCore::HTMLTokenizer::parseNonHTMLText):
     16        (WebCore::HTMLTokenizer::parseTag):
     17        (WebCore::HTMLTokenizer::write):
     18        * html/HTMLTokenizer.h:
     19        (WebCore::HTMLTokenizer::State::inAnyNonHTMLText):
     20
    1212009-06-11  Yongjun Zhang  <yongjun.zhang@nokia.com>
    222
  • trunk/WebCore/html/HTMLTokenizer.cpp

    r43842 r44608  
    317317}
    318318
    319 HTMLTokenizer::State HTMLTokenizer::parseSpecial(SegmentedString& src, State state)
     319HTMLTokenizer::State HTMLTokenizer::parseNonHTMLText(SegmentedString& src, State state)
    320320{
    321321    ASSERT(state.inTextArea() || state.inTitle() || state.inIFrame() || !state.hasEntityState());
     
    14781478            m_cBufferPos = cBufferPos;
    14791479            if (n || inViewSourceMode()) {
     1480                State savedState = state;
     1481                SegmentedString savedSrc = src;
     1482                long savedLineno = m_lineNumber;
    14801483                if ((tagName == preTag || tagName == listingTag) && !inViewSourceMode()) {
    14811484                    if (beginTag)
     
    14901493                        m_searchStopperLength = 8;
    14911494                        state.setInScript(true);
    1492                         state = parseSpecial(src, state);
     1495                        state = parseNonHTMLText(src, state);
    14931496                    } else if (isSelfClosingScript) { // Handle <script src="foo"/>
    14941497                        state.setInScript(true);
     
    15001503                        m_searchStopperLength = 7;
    15011504                        state.setInStyle(true);
    1502                         state = parseSpecial(src, state);
     1505                        state = parseNonHTMLText(src, state);
    15031506                    }
    15041507                } else if (tagName == textareaTag) {
     
    15071510                        m_searchStopperLength = 10;
    15081511                        state.setInTextArea(true);
    1509                         state = parseSpecial(src, state);
     1512                        state = parseNonHTMLText(src, state);
    15101513                    }
    15111514                } else if (tagName == titleTag) {
     
    15131516                        m_searchStopper = titleEnd;
    15141517                        m_searchStopperLength = 7;
    1515                         State savedState = state;
    1516                         SegmentedString savedSrc = src;
    1517                         long savedLineno = m_lineNumber;
    15181518                        state.setInTitle(true);
    1519                         state = parseSpecial(src, state);
    1520                         if (state.inTitle() && src.isEmpty()) {
    1521                             // We just ate the rest of the document as the title #text node!
    1522                             // Reset the state then retokenize without special title handling.
    1523                             // Let the parser clean up the missing </title> tag.
    1524                             // FIXME: This is incorrect, because src.isEmpty() doesn't mean we're
    1525                             // at the end of the document unless m_noMoreData is also true. We need
    1526                             // to detect this case elsewhere, and save the state somewhere other
    1527                             // than a local variable.
    1528                             state = savedState;
    1529                             src = savedSrc;
    1530                             m_lineNumber = savedLineno;
    1531                             m_scriptCodeSize = 0;
    1532                         }
     1519                        state = parseNonHTMLText(src, state);
    15331520                    }
    15341521                } else if (tagName == xmpTag) {
     
    15371524                        m_searchStopperLength = 5;
    15381525                        state.setInXmp(true);
    1539                         state = parseSpecial(src, state);
     1526                        state = parseNonHTMLText(src, state);
    15401527                    }
    15411528                } else if (tagName == iframeTag) {
     
    15441531                        m_searchStopperLength = 8;
    15451532                        state.setInIFrame(true);
    1546                         state = parseSpecial(src, state);
     1533                        state = parseNonHTMLText(src, state);
    15471534                    }
     1535                }
     1536                if (src.isEmpty() && (state.inTitle() || inViewSourceMode()) && !state.inComment() && !(state.inScript() && m_currentScriptTagStartLineNumber)) {
     1537                    // We just ate the rest of the document as the #text node under the special tag!
     1538                    // Reset the state then retokenize without special handling.
     1539                    // Let the parser clean up the missing close tag.
     1540                    // FIXME: This is incorrect, because src.isEmpty() doesn't mean we're
     1541                    // at the end of the document unless m_noMoreData is also true. We need
     1542                    // to detect this case elsewhere, and save the state somewhere other
     1543                    // than a local variable.
     1544                    state = savedState;
     1545                    src = savedSrc;
     1546                    m_lineNumber = savedLineno;
     1547                    m_scriptCodeSize = 0;
    15481548                }
    15491549            }
     
    16621662            else if (state.inPlainText())
    16631663                state = parseText(m_src, state);
    1664             else if (state.inAnySpecial())
    1665                 state = parseSpecial(m_src, state);
     1664            else if (state.inAnyNonHTMLText())
     1665                state = parseNonHTMLText(m_src, state);
    16661666            else if (state.inComment())
    16671667                state = parseComment(m_src, state);
  • trunk/WebCore/html/HTMLTokenizer.h

    r41130 r44608  
    174174    State parseServer(SegmentedString&, State);
    175175    State parseText(SegmentedString&, State);
    176     State parseSpecial(SegmentedString&, State);
     176    State parseNonHTMLText(SegmentedString&, State);
    177177    State parseTag(SegmentedString&, State);
    178178    State parseEntity(SegmentedString&, UChar*& dest, State, unsigned& cBufferPos, bool start, bool parsingTag);
     
    289289        void setForceSynchronous(bool v) { setBit(ForceSynchronous, v); }
    290290
    291         bool inAnySpecial() const { return m_bits & (InScript | InStyle | InXmp | InTextArea | InTitle | InIFrame); }
     291        bool inAnyNonHTMLText() const { return m_bits & (InScript | InStyle | InXmp | InTextArea | InTitle | InIFrame); }
    292292        bool hasTagState() const { return m_bits & TagMask; }
    293293        bool hasEntityState() const { return m_bits & EntityMask; }
Note: See TracChangeset for help on using the changeset viewer.