go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.36k stars 5.43k forks source link

`ReferenceError: EventSource is not defined` in Pale Moon #20572

Closed u3shit closed 2 years ago

u3shit commented 2 years ago

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

6543 commented 2 years ago

did you clean browser cache?

u3shit commented 2 years ago

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

zeripath commented 2 years ago

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:

https://github.com/go-gitea/gitea/blob/589677fafb4b77112b7220a1c6089cec71d6db94/web_src/js/features/notification.js#L52-L53

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:

https://github.com/go-gitea/gitea/blob/589677fafb4b77112b7220a1c6089cec71d6db94/web_src/js/features/eventsource.sharedworker.js#L7

and then the sharedworker dropped.


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

lunny commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

FYI, some questions can be answered from #18971 and (https://github.com/go-gitea/gitea/pull/18971#issuecomment-1158973862)

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 commented 2 years ago

Please have a try on try.gitea.io

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

u3shit commented 2 years ago

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

wxiaoguang commented 2 years ago

Thank you for the confirmation. The backport for 1.17 is in https://github.com/go-gitea/gitea/pull/20663

wolfbeast commented 2 years ago

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 commented 2 years ago

Works for me on try.gitea.io.

Have you cleared your cache after starting 1.17.1?

wolfbeast commented 2 years ago

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