Bug 244950

Summary: Handling of text documents does not comply with modern HTML spec
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: WebCore Misc.Assignee: Brent Fulgham <bfulgham>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=228832
Bug Depends on:    
Bug Blocks: 228832    

Description Brent Fulgham 2022-09-08 16:12:16 PDT
Given the spec language in https://html.spec.whatwg.org/multipage/browsing-the-web.html#read-text, the setCompatibilityMode code here seems out-of-spec to me:
(7.11.4.3 Set document's mode to "no-quirks".)

From: Source/WebCore/html/parser/TextDocument.cpp:

TextDocument::TextDocument(Frame* frame, const Settings& settings, const URL& url, ScriptExecutionContextIdentifier identifier)
  : HTMLDocument(frame, settings, url, identifier, { DocumentClass::Text })
{
  setCompatibilityMode(DocumentCompatibilityMode::QuirksMode);
  lockCompatibilityMode();
}

This causes the following WPT failure:

wpt /html/browsers/browsing-the-web/read-text/load-text-plain.html
Comment 1 Radar WebKit Bug Importer 2022-09-08 16:12:37 PDT
<rdar://problem/99719728>
Comment 2 Brent Fulgham 2022-09-08 16:20:47 PDT
Pull request: https://github.com/WebKit/WebKit/pull/4143
Comment 3 Brent Fulgham 2022-09-08 16:26:47 PDT
It looks like Chris started on a larger version of this change here: Bug 228832.
Comment 4 Brent Fulgham 2022-09-09 14:14:35 PDT
Pull request: https://github.com/Webkit/WebKit/pull/4143
Comment 5 EWS 2022-09-12 09:55:45 PDT
Committed 254389@main (e30caa272fe6): <https://commits.webkit.org/254389@main>

Reviewed commits have been landed. Closing PR #4143 and removing active labels.