EventSource prints error message in DevTools even though there is no error
Categories
(Core :: DOM: Networking, defect, P3)
Tracking
()
People
(Reporter: lucacasonato, Unassigned)
References
Details
(Whiteboard: [necko-triaged])
Firefox will print a The connection to https://firefox-bug-demo.deno.dev/events was interrupted while the page was loading. error message to DevTools whenever I use an EventSource, even though the connection is never lost - the EventSource keeps operating. No such message is logged in Chrome.
Here is an example: https://firefox-bug-demo.deno.dev/. This page serves a HTML page that just creates an EventSource connected to https://firefox-bug-demo.deno.dev/events. It writes each event.data into the DOM. https://firefox-bug-demo.deno.dev/events is a text/event-source that just sends a new incrementing number ever 1000 ms.
Comment 1•4 years ago
•
|
||
I see the error when loading a new page on the tab which had https://firefox-bug-demo.deno.dev/ loaded, in which case the connection was lost.
Do you see the error even when not loading any other page?
We just happen to explicitly log errors to the console in this case
https://searchfox.org/mozilla-central/rev/918fd22032de3a0025d6e9f4fcc8b7f625315068/dom/base/EventSource.cpp#1339-1341
| Reporter | ||
Comment 2•4 years ago
|
||
Yeah, that seems to be what is happening. The log happens on page unload, not on page load. That explains the source, but I still think it is rather confusing. I don't need to know that a connection to foo.com got closed when opening the DevTools on bar.com. Maybe this log can be removed?
Updated•4 years ago
|
Comment 3•3 years ago
|
||
Nicolas, do you have an opinion about these messages? I agree it shouldn't be showing up in this case - I'm not sure if there's some other case where it's relevant to report it.
Comment 4•3 years ago
|
||
(In reply to Brian Grinstead [:bgrins] from comment #3)
Nicolas, do you have an opinion about these messages? I agree it shouldn't be showing up in this case - I'm not sure if there's some other case where it's relevant to report it.
It looks like the message might appear too late in the console. In case of navigation, it should happen before we clear the console output (or display the "Navigated to …" message). That's funny because we talked yesterday on how we are doing things too soon in devtools (on will-navigate), which creates a variety of issues down the line. I'll see if switching to something else could help in that specific case.
The message might be relevant when using EventSource in workers, so you'd be notified if the worker terminates (I think?)
I also feel that when navigating, the message could simply be a warning instead of an error
Description
•