Skip to content

ReferenceError: EventSource is not defined in Pale Moon #20572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
u3shit opened this issue Jul 31, 2022 · 13 comments · Fixed by #20584
Closed

ReferenceError: EventSource is not defined in Pale Moon #20572

u3shit opened this issue Jul 31, 2022 · 13 comments · Fixed by #20584
Labels
topic/ui Change the appearance of the Gitea UI type/bug

Comments

@u3shit
Copy link

u3shit commented Jul 31, 2022

Description

After updating to 1.17.0 with javascript enabled this time, after logging in I start getting errors about EventSource (see screenshot). (It doesn't happen when I'm logged out)

Developer console:

18:25:45.836 error { target: SharedWorker, isTrusted: true, message: "ReferenceError: EventSource is not defined", filename: "http://localhost:3000/assets/js/eventsource.sharedworker.js", lineno: 1, colno: 85, srcElement: SharedWorker, eventPhase: 0, bubbles: false, cancelable: true, defaultPrevented: false }  
index.js:58:1724
	ev/< http://localhost:3000/assets/js/index.js:58:1724
18:25:45.836 error { target: SharedWorker, isTrusted: true, message: "ReferenceError: EventSource is not defined", filename: "http://localhost:3000/assets/js/eventsource.sharedworker.js", lineno: 1, colno: 85, srcElement: SharedWorker, eventPhase: 0, bubbles: false, cancelable: true, defaultPrevented: false }  
index.js:37:15714
18:25:45.836 error { target: SharedWorker, isTrusted: true, message: "ReferenceError: EventSource is not defined", filename: "http://localhost:3000/assets/js/eventsource.sharedworker.js", lineno: 1, colno: 85, srcElement: SharedWorker, eventPhase: 0, bubbles: false, cancelable: true, defaultPrevented: false }  
index.js:58:1724
18:25:45.837 error { target: SharedWorker, isTrusted: true, message: "ReferenceError: EventSource is not defined", filename: "http://localhost:3000/assets/js/eventsource.sharedworker.js", lineno: 1, colno: 85, srcElement: SharedWorker, eventPhase: 0, bubbles: false, cancelable: true, defaultPrevented: false }  
index.js:37:15714

Actually, downgrading to 1.16.9 I still have the error, but only in the developer console not in the UI. As a workaround, I can add

[ui.notification]
EVENT_SOURCE_UPDATE_TIME = -1

to my app.ini, but EVENT_SOURCE_UPDATE_TIME's documentation seems to suggest that the feature availability is auto-detected. (If I type EventSource into devconsole, I get back that it's a function, I don't know what gitea does to get it undefined...)

Screenshots

This is running gitea locally, but I get the same result on try.gitea.org.
a

Gitea Version

1.17.0

Can you reproduce the bug on the Gitea demo site?

Yes

Operating System

Linux

Browser Version

Pale Moon 31.1.1

@u3shit u3shit added type/bug topic/ui Change the appearance of the Gitea UI labels Jul 31, 2022
@6543
Copy link
Member

6543 commented Jul 31, 2022

did you clean browser cache?

@u3shit
Copy link
Author

u3shit commented Jul 31, 2022

I tried it in a new clean profile, same result.

@zeripath
Copy link
Contributor

Looks like the PaleMoon browser doesn't have the EventSource in its SharedWorker although it does have it in the non-sharedworker state.

There are a few places we would need to look at to get this working:

if (notificationSettings.EventSourceUpdateTime > 0 && !!window.EventSource && window.SharedWorker) {
// Try to connect to the event source via the shared worker first

This would need to detect somehow that EventSource is not available in the SharedWorker, or better we would need to protect the constructor here to test if the source is extant:

this.eventSource = new EventSource(url);

and then the sharedworker dropped.


Now, I don't think we explicitly support Palemoon.

zeripath added a commit to zeripath/gitea that referenced this issue Jul 31, 2022
Some browsers do not have EventSource within the SharedWorker context even though
it is available in the normal context. This leads to a global error percolating
up to the main page.

Here we simply wrap the new Source in a try/catch and catch the error falling back
to a poller if so.

Fix go-gitea#20572

Signed-off-by: Andrew Thornton <[email protected]>
@lunny
Copy link
Member

lunny commented Aug 1, 2022

Before 1.17, your javascript error will be hidden by webbrowser. In 1.17, they will be displayed on the top of the page.

@veita
Copy link

veita commented Aug 2, 2022

Before 1.17, your javascript error will be hidden by webbrowser. In 1.17, they will be displayed on the top of the page.

What is the rationale behind this? The update renders the page quite useless.

grafik

@delvh
Copy link
Member

delvh commented Aug 2, 2022

This issue is a prime example as to why:
Previously, these errors existed as well, but they were silently ignored.
Now, they are reported.
Hence, they can be fixed.
Also, there is a second benefit: Users can see why something failed and don't have to think "What a stupid site, nothing is happening?"

The update renders the page quite useless

Why that?
You can still scroll, right?

@wxiaoguang
Copy link
Contributor

FYI, some questions can be answered from #18971 and (#18971 (comment))

There are some FAQs like "What if some users do not want to see these errors?" and "What if I see JavaScript error", and it's always open to propose better solutions.

@wxiaoguang
Copy link
Contributor

Please have a try on try.gitea.io

If the problem is fixed, I will send a backport to 1.17.1

@u3shit
Copy link
Author

u3shit commented Aug 4, 2022

Checked, no errors reported (neither on the page, nor in javasscript console)

@wxiaoguang
Copy link
Contributor

Thank you for the confirmation. The backport for 1.17 is in #20663

@wolfbeast
Copy link

wolfbeast commented Aug 19, 2022

Unfortunately 1.17.1 doesn't seem to fix this error. I just upgraded our Pale Moon Gitea instance to it and it still throws.

22:23:58.501 worker error error { target: SharedWorker, isTrusted: true, message: "ReferenceError: EventSource is not defined", filename: "https://repo.palemoon.org/assets/js/eventsource.sharedworker.js", lineno: 1, colno: 85, srcElement: SharedWorker, eventPhase: 0, bubbles: false, cancelable: true, defaultPrevented: false } 1 index.js:37:15854
Gg/< https://repo.palemoon.org/assets/js/index.js:37:15854

@zeripath
Copy link
Contributor

Works for me on try.gitea.io.

Have you cleared your cache after starting 1.17.1?

@wolfbeast
Copy link

🤦 OK, silly me. Caching issue. Sorry for the noise!

@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/ui Change the appearance of the Gitea UI type/bug
Projects
None yet
8 participants