-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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@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@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
- Loading branch information
Showing
5 changed files
with
26 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters