[webkit-changes] [WebKit/WebKit] 55a286: REGRESSION (STP): Video won't play on bilibili.com
Jean-Yves Avenard
noreply at github.com
Wed Oct 18 03:00:27 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 55a286438b239e94c5a355a1f7510cfa7b4dd033
https://github.com/WebKit/WebKit/commit/55a286438b239e94c5a355a1f7510cfa7b4dd033
Author: Jean-Yves Avenard <jya at apple.com>
Date: 2023-10-18 (Wed, 18 Oct 2023)
Changed paths:
M LayoutTests/fast/dom/document-contentType-DOMParser-expected.txt
M LayoutTests/fast/dom/document-contentType-DOMParser.html
M Source/WebCore/html/parser/HTMLDocumentParserFastPath.cpp
M Source/WebCore/html/parser/HTMLDocumentParserFastPath.h
M Source/WebCore/xml/DOMParser.cpp
Log Message:
-----------
REGRESSION (STP): Video won't play on bilibili.com
https://bugs.webkit.org/show_bug.cgi?id=263196
rdar://117020123
Reviewed by Chris Dumez.
bilibili injects DOM objects in the tree by calling:
```
var t = (new DOMParser).parseFromString(e, "text/html");
return document.adoptNode(t.body.firstChild)
```
Per spec, when parsing HTML to create a document through DOMParser::parseFromString() [1]
you are to skip the whitespace tokens for the "initial" insertion mode [2].
The trailing spaces however must be kept [3]
This behaviour was regressed by 267202 at main.
On this site, the observable behaviour was that the firstChild became a "#text"
node rather the expected first DIV one.
So we trim the leading whitespaces before calling the fast parser. Which
restore the original behaviour prior 267202 at main
[1] https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#parse-html-from-a-string
[2] https://html.spec.whatwg.org/multipage/parsing.html#the-initial-insertion-mode
[3] https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-afterbody
* LayoutTests/fast/dom/document-contentType-DOMParser-expected.txt:
* LayoutTests/fast/dom/document-contentType-DOMParser.html: Added tests.
* Source/WebCore/html/parser/HTMLDocumentParserFastPath.cpp:
(WebCore::tryFastParsingHTMLFragment):
* Source/WebCore/html/parser/HTMLDocumentParserFastPath.h: Change type to StringView
(WebCore::requires):
* Source/WebCore/xml/DOMParser.cpp:
(WebCore::DOMParser::parseFromString):
Canonical link: https://commits.webkit.org/269457@main
More information about the webkit-changes
mailing list