Open Bug 1156137 Opened 10 years ago Updated 2 years ago

EventSource only works with HTTP channels

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect

Tracking

()

Tracking Status
firefox40 --- affected

People

(Reporter: bzbarsky, Unassigned)

Details

Attachments

(1 file)

Per spec, EventSource should work with any channel. And this simple testcase works in Chrome: <script> var e = new EventSource("data:text/event-stream;charset=UTF-8,data:hey%0a%0a"); e.addEventListener("message", function(e) { alert(e.data); this.close(); }) </script> There's a bunch of stuff in EventSource code that prevents this from working: 1) Explicit checks for the http/https schemes in EventSource::CheckCanRequestSrc. 2) What looks like a bogus use of DISALLOW_INHERIT_PRINCIPAL in the same function. 3) QIs to nsIHttpChannel various places. This code needs to be weaned off its HTTP dependency, really.
Does it really make sense to make this generic though? Requiring http/https seems okay to me. But I guess we'd need to convince Chrome.
Sure. Either we need to get the spec changed and convince Chrome to change or implement the spec or something.
Given that this API is mainly syntax sugar on top of XHR/fetch(), I don't really have any opinion either way.
Persuaded by Ian that we should fix this. With a "Fetch layer" this would work automatically.
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: