Title: [243782] trunk
Revision
243782
Author
[email protected]
Date
2019-04-02 18:55:38 -0700 (Tue, 02 Apr 2019)

Log 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):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (243781 => 243782)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-04-03 00:44:42 UTC (rev 243781)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-04-03 01:55:38 UTC (rev 243782)
@@ -1,5 +1,19 @@
 2019-04-02  Chris Dumez  <[email protected]>
 
+        HTML Parser: Remove conditional parsing of <noembed> content
+        https://bugs.webkit.org/show_bug.cgi?id=196514
+
+        Reviewed by Geoffrey Garen.
+
+        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:
+
+2019-04-02  Chris Dumez  <[email protected]>
+
         XMLHttpRequestUpload's loadstart event not correct initialized
         https://bugs.webkit.org/show_bug.cgi?id=196174
         <rdar://problem/49191412>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-html-expected.txt (243781 => 243782)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-html-expected.txt	2019-04-03 00:44:42 UTC (rev 243781)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-html-expected.txt	2019-04-03 01:55:38 UTC (rev 243782)
@@ -8,5 +8,6 @@
 PASS baseURI value 
 PASS Location value 
 PASS DOMParser parses HTML tag soup with no problems 
+PASS DOMParser should handle the content of <noembed> as raw text 
 PASS DOMParser throws on an invalid enum value 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-html.html (243781 => 243782)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-html.html	2019-04-03 00:44:42 UTC (rev 243781)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-html.html	2019-04-03 01:55:38 UTC (rev 243782)
@@ -67,6 +67,11 @@
 }, "DOMParser parses HTML tag soup with no problems");
 
 test(function() {
+   const doc = new DOMParser().parseFromString('<noembed>&lt;a&gt;</noembed>', 'text/html');
+   assert_equals(doc.querySelector('noembed').textContent, '&lt;a&gt;');
+}, 'DOMParser should handle the content of <noembed> as raw text');
+
+test(function() {
     assert_throws(new TypeError(), function() {
         new DOMParser().parseFromString("", "text/foo-this-is-invalid");
     })

Modified: trunk/Source/WebCore/ChangeLog (243781 => 243782)


--- trunk/Source/WebCore/ChangeLog	2019-04-03 00:44:42 UTC (rev 243781)
+++ trunk/Source/WebCore/ChangeLog	2019-04-03 01:55:38 UTC (rev 243782)
@@ -1,5 +1,30 @@
 2019-04-02  Chris Dumez  <[email protected]>
 
+        HTML Parser: Remove conditional parsing of <noembed> content
+        https://bugs.webkit.org/show_bug.cgi?id=196514
+
+        Reviewed by Geoffrey Garen.
+
+        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):
+
+2019-04-02  Chris Dumez  <[email protected]>
+
         XMLHttpRequestUpload's loadstart event not correct initialized
         https://bugs.webkit.org/show_bug.cgi?id=196174
         <rdar://problem/49191412>

Modified: trunk/Source/WebCore/html/parser/HTMLParserOptions.cpp (243781 => 243782)


--- trunk/Source/WebCore/html/parser/HTMLParserOptions.cpp	2019-04-03 00:44:42 UTC (rev 243781)
+++ trunk/Source/WebCore/html/parser/HTMLParserOptions.cpp	2019-04-03 01:55:38 UTC (rev 243782)
@@ -37,7 +37,6 @@
 
 HTMLParserOptions::HTMLParserOptions()
     : scriptEnabled(false)
-    , pluginsEnabled(false)
     , usePreHTML5ParserQuirks(false)
     , maximumDOMTreeDepth(Settings::defaultMaximumHTMLParserDOMTreeDepth)
 {
@@ -47,7 +46,6 @@
 {
     RefPtr<Frame> frame = document.frame();
     scriptEnabled = frame && frame->script().canExecuteScripts(NotAboutToExecuteScript);
-    pluginsEnabled = frame && frame->loader().subframeLoader().allowPlugins();
 
     usePreHTML5ParserQuirks = document.settings().usePreHTML5ParserQuirks();
     maximumDOMTreeDepth = document.settings().maximumHTMLParserDOMTreeDepth();

Modified: trunk/Source/WebCore/html/parser/HTMLParserOptions.h (243781 => 243782)


--- trunk/Source/WebCore/html/parser/HTMLParserOptions.h	2019-04-03 00:44:42 UTC (rev 243781)
+++ trunk/Source/WebCore/html/parser/HTMLParserOptions.h	2019-04-03 01:55:38 UTC (rev 243782)
@@ -35,7 +35,6 @@
     explicit HTMLParserOptions(Document&);
 
     bool scriptEnabled;
-    bool pluginsEnabled;
     bool usePreHTML5ParserQuirks;
     unsigned maximumDOMTreeDepth;
 };

Modified: trunk/Source/WebCore/html/parser/HTMLTokenizer.cpp (243781 => 243782)


--- trunk/Source/WebCore/html/parser/HTMLTokenizer.cpp	2019-04-03 00:44:42 UTC (rev 243781)
+++ trunk/Source/WebCore/html/parser/HTMLTokenizer.cpp	2019-04-03 01:55:38 UTC (rev 243782)
@@ -1416,7 +1416,7 @@
     else if (tagName == styleTag
         || tagName == iframeTag
         || tagName == xmpTag
-        || (tagName == noembedTag && m_options.pluginsEnabled)
+        || (tagName == noembedTag)
         || tagName == noframesTag
         || (tagName == noscriptTag && m_options.scriptEnabled))
         m_state = RAWTEXTState;

Modified: trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp (243781 => 243782)


--- trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp	2019-04-03 00:44:42 UTC (rev 243781)
+++ trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp	2019-04-03 01:55:38 UTC (rev 243782)
@@ -787,7 +787,7 @@
         processGenericRawTextStartTag(WTFMove(token));
         return;
     }
-    if (token.name() == noembedTag && m_options.pluginsEnabled) {
+    if (token.name() == noembedTag) {
         processGenericRawTextStartTag(WTFMove(token));
         return;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to