Bug 265386

Summary: Streaming HTML only works in iframe elements. Safari waits to buffer all HTML before rendering.
Product: WebKit Reporter: Nathan Knowler <nathan>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bfulgham, mike, rik, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: Safari 17   
Hardware: Mac (Apple Silicon)   
OS: macOS 13   
Attachments:
Description Flags
Deno Server which streams HTML. Run with `deno run --allow-net deno-server-streaming-html.js`.
none
Source code of the hosted Deno server which streaming to the Declarative Shadow DOM. none

Description Nathan Knowler 2023-11-27 09:03:32 PST
Created attachment 468769 [details]
Deno Server which streams HTML. Run with `deno run --allow-net deno-server-streaming-html.js`.

Safari doesn’t seem to be streaming HTML at all, except for `<iframe>` elements. Right now, it appears to buffer all the HTML before rendering anything.

To reproduce you will need a web server that supports streaming. The attached example uses Deno (1.38.2). When run locally, it’ll serve HTTP/1.1 and adds the correct `Transport-Encoding: chunked` header. I have a hosted variation of the example which is being served with Deno Deploy: https://shadowroot-streams.deno.dev. It also uses the Declarative Shadow DOM. That example uses HTTP/2 and correctly doesn’t use the `Transport-Encoding` header since it’s incompatible with HTTP/2. In short, Deno’s streaming the content correctly and Deno Deploy supports HTML streaming.

Note: the attached example admittedly doesn’t have a tonne of HTML in the first chunk, but that doesn’t seem to matter at all for streaming into an `<iframe>` element. Other browsers are also able to stream this fine.
Comment 1 Nathan Knowler 2023-11-27 09:05:10 PST
Created attachment 468770 [details]
Source code of the hosted Deno server which streaming to the Declarative Shadow DOM.
Comment 2 Radar WebKit Bug Importer 2023-11-27 09:39:50 PST
<rdar://problem/118837578>