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

Changeset 243782 in webkit


Ignore:
Timestamp:
Apr 2, 2019, 6:55:38 PM (7 years ago)
Author:
Chris Dumez
Message:

HTML Parser: Remove conditional parsing of <noembed> content
https://bugs.webkit.org/show_bug.cgi?id=196514

Reviewed by Geoffrey Garen.

LayoutTests/imported/w3c:

Resync WPT after https://github.com/web-platform-tests/wpt/pull/15471 to gain
test coverage. Both Gecko and Blink are passing the new check, only WebKit was
failing.

  • web-platform-tests/domparsing/DOMParser-parseFromString-html-expected.txt:
  • web-platform-tests/domparsing/DOMParser-parseFromString-html.html:

Source/WebCore:

Our HTML Parser has raw text handling for <noembed> content only if plugins are runnable.
However, the HTML specification doesn't ask such behavior [1], and it doesn't match to
our HTML serializer. We should always handle it as raw text.

Blink already made this change in https://chromium-review.googlesource.com/c/1477556.

[1] https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments:noembed

No new tests, updated existing test.

  • html/parser/HTMLParserOptions.cpp:

(WebCore::HTMLParserOptions::HTMLParserOptions):

  • html/parser/HTMLParserOptions.h:
  • html/parser/HTMLTokenizer.cpp:

(WebCore::HTMLTokenizer::updateStateFor):

  • html/parser/HTMLTreeBuilder.cpp:

(WebCore::HTMLTreeBuilder::processStartTagForInBody):

Location:
trunk
Files:
8 edited

Legend:

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

    r243765 r243782  
     12019-04-02  Chris Dumez  <cdumez@apple.com>
     2
     3        HTML Parser: Remove conditional parsing of <noembed> content
     4        https://bugs.webkit.org/show_bug.cgi?id=196514
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Resync WPT after https://github.com/web-platform-tests/wpt/pull/15471 to gain
     9        test coverage. Both Gecko and Blink are passing the new check, only WebKit was
     10        failing.
     11
     12        * web-platform-tests/domparsing/DOMParser-parseFromString-html-expected.txt:
     13        * web-platform-tests/domparsing/DOMParser-parseFromString-html.html:
     14
    1152019-04-02  Chris Dumez  <cdumez@apple.com>
    216
  • trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-html-expected.txt

    r216046 r243782  
    99PASS Location value
    1010PASS DOMParser parses HTML tag soup with no problems
     11PASS DOMParser should handle the content of <noembed> as raw text
    1112PASS DOMParser throws on an invalid enum value
    1213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-html.html

    r216354 r243782  
    6868
    6969test(function() {
     70   const doc = new DOMParser().parseFromString('<noembed>&lt;a&gt;</noembed>', 'text/html');
     71   assert_equals(doc.querySelector('noembed').textContent, '&lt;a&gt;');
     72}, 'DOMParser should handle the content of <noembed> as raw text');
     73
     74test(function() {
    7075    assert_throws(new TypeError(), function() {
    7176        new DOMParser().parseFromString("", "text/foo-this-is-invalid");
  • trunk/Source/WebCore/ChangeLog

    r243765 r243782  
     12019-04-02  Chris Dumez  <cdumez@apple.com>
     2
     3        HTML Parser: Remove conditional parsing of <noembed> content
     4        https://bugs.webkit.org/show_bug.cgi?id=196514
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Our HTML Parser has raw text handling for <noembed> content only if plugins are runnable.
     9        However, the HTML specification doesn't ask such behavior [1], and it doesn't match to
     10        our HTML serializer. We should always handle it as raw text.
     11
     12        Blink already made this change in https://chromium-review.googlesource.com/c/1477556.
     13
     14        [1] https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments:noembed
     15
     16        No new tests, updated existing test.
     17
     18        * html/parser/HTMLParserOptions.cpp:
     19        (WebCore::HTMLParserOptions::HTMLParserOptions):
     20        * html/parser/HTMLParserOptions.h:
     21        * html/parser/HTMLTokenizer.cpp:
     22        (WebCore::HTMLTokenizer::updateStateFor):
     23        * html/parser/HTMLTreeBuilder.cpp:
     24        (WebCore::HTMLTreeBuilder::processStartTagForInBody):
     25
    1262019-04-02  Chris Dumez  <cdumez@apple.com>
    227
  • trunk/Source/WebCore/html/parser/HTMLParserOptions.cpp

    r223644 r243782  
    3838HTMLParserOptions::HTMLParserOptions()
    3939    : scriptEnabled(false)
    40     , pluginsEnabled(false)
    4140    , usePreHTML5ParserQuirks(false)
    4241    , maximumDOMTreeDepth(Settings::defaultMaximumHTMLParserDOMTreeDepth)
     
    4847    RefPtr<Frame> frame = document.frame();
    4948    scriptEnabled = frame && frame->script().canExecuteScripts(NotAboutToExecuteScript);
    50     pluginsEnabled = frame && frame->loader().subframeLoader().allowPlugins();
    5149
    5250    usePreHTML5ParserQuirks = document.settings().usePreHTML5ParserQuirks();
  • trunk/Source/WebCore/html/parser/HTMLParserOptions.h

    r208179 r243782  
    3636
    3737    bool scriptEnabled;
    38     bool pluginsEnabled;
    3938    bool usePreHTML5ParserQuirks;
    4039    unsigned maximumDOMTreeDepth;
  • trunk/Source/WebCore/html/parser/HTMLTokenizer.cpp

    r240641 r243782  
    14171417        || tagName == iframeTag
    14181418        || tagName == xmpTag
    1419         || (tagName == noembedTag && m_options.pluginsEnabled)
     1419        || (tagName == noembedTag)
    14201420        || tagName == noframesTag
    14211421        || (tagName == noscriptTag && m_options.scriptEnabled))
  • trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp

    r237266 r243782  
    788788        return;
    789789    }
    790     if (token.name() == noembedTag && m_options.pluginsEnabled) {
     790    if (token.name() == noembedTag) {
    791791        processGenericRawTextStartTag(WTFMove(token));
    792792        return;
Note: See TracChangeset for help on using the changeset viewer.