diff --git a/source b/source index b70155a8252..39b3e6c614b 100644 --- a/source +++ b/source @@ -2477,6 +2477,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
Origin
` headerCross-Origin-Resource-Policy
` headerSet ev's request to request.
Let eventSourceResponse be null.
Let finalizeEventSourceFetch be to finalize and report timing - with eventSourceResponse, settings's +
Let finalizeEventSourceFetch given
+ response resbe to
+ finalize and report timing with res, settings's
global object, and
"other
".
Run this step in parallel:
+Fetch request with + processResponseEndOfBody set to + finalizeEventSourceFetch and processResponse set + to the following steps given response res:
Fetch request with - processResponse given - response res be to set - eventSourceResponse to res.
If res is an aborted network error, then + fail the connection.
Otherwise, if res is a network error, then + reestablish the connection, unless the user agent knows that to be futile, in + which case the user agent may fail the connection.
Otherwise, if res's status is
+ not 200, or if res's `Content-Type
` is not
+ `text/event-stream
`, then fail the connection.
Otherwise, announce the connection and + interpret res's + body line by line.
Return ev.
The resource indicated in the argument to the EventSource
- constructor is fetched when the constructor is run.
As data is received, the tasks queued by the networking - task source to handle the data must act as follows.
- -HTTP 200 OK responses with a `Content-Type
` header specifying the type
- `text/event-stream
`, ignoring any MIME type parameters, must be
- processed line by line as described below.
When a successful response with a supported MIME type is received, such that the - user agent begins parsing the contents of the stream, the user agent must announce the - connection.
- -The task that the networking task source places
- on the task queue once fetching for such a resource (with the correct MIME
- type) has completed must cause the user agent to run finalizeEventSourceFetch,
- and reestablish the connection in parallel. This applies whether the connection is closed gracefully or unexpectedly
- (but does not apply when fetching is canceled by the user agent, e.g., in response to window.stop()
, since in those cases the final task is actually discarded). It doesn't apply for the error
- conditions listed below except where explicitly specified.
HTTP 200 OK responses that have a Content-Type specifying an unsupported type, or - that have no Content-Type at all, must cause the user agent to fail the - connection.
- -Network errors that prevents the connection from - being established in the first place (e.g. DNS errors), should cause the user agent to - run finalizeEventSourceFetch, and reestablish the connection - in parallel, unless the user agent knows that to be futile, in which case the user - agent may fail the connection.
- -Any other HTTP response code not listed here, as well as the
- cancelation of the fetch algorithm by the user agent (e.g. in response to window.stop()
or the user canceling the network connection
- manually) must cause the user agent to run finalizeEventSourceFetch and
- fail the connection.
When a user agent is to announce the connection, the user agent must queue a
task which, if the readyState
attribute is
set to a value other than CLOSED
, sets the