ogame-infinity / web-extension

Repository for the web extension code (coming)
https://ogameinfinity.com
Other
34 stars 48 forks source link

[BUG] Plugin unsable due to DOMPurify #196

Closed piotryordanov closed 1 year ago

piotryordanov commented 1 year ago

image I keep on getting this error. Forces me to reload the page all the time. Ogame becomes totally unusable otherwise!

Any idea how to fix it? I can look in the code!

Bishop341-B commented 1 year ago

Yeah... this a known nasty bug that was introduced some versions ago. It happens sometimes (or always) to some people, but not to all, and we don't know yet why exactly only for these people. The bug seems to be because some race condition in the code (loading/calling the lib i suspect), but we don't know what/when exactly trigger it.

We are in process to fix it getting rid of DOMpurify component, because this will bring also a little speed bump and get rid of playing with innerHTML. But this process is slow, there are tons of code to replace to do that. Great progress has been done so far (see #170 and #183), but still there some DOMpurify uses left to replace.

Sorry but until the complete elimination of the DOMpurify component or maybe if someone find the bug trigger, this bug can not be fixed. You may try to use another browser or try to use a new browser profile as a workaround, as this it worked for some of the affected people, but no guarantee on this.

IbaiArricibita commented 1 year ago

I realized a little thing with this DOMPurify problem, and (to me at least) it only happens if i navigate using left menu. It wont happen if navigating via the url bar or if using f5 to refresh the current page...

Edit: When something finishes upgrading (a mine for example) and the game reloads the page itself, it happens also. No idea if its even possible, but could be something with some header on the request? Always when it crashed to me, headers had referal, and the times it doesnt crash, theres no referal on the headers.

Bishop341-B commented 1 year ago

I tried to make a workaround. Can you test if this fix (to some extent or fully) the problem?

https://github.com/Bishop341-B/ogame-infinity/tree/b40ca57269f28180952f7587c0c8b3a92c959804

Download the code here, disable regular ogi extension and then load the test extension as a developer extension.

imagen

This is a direct link to the zip file:

https://github.com/Bishop341-B/ogame-infinity/archive/b40ca57269f28180952f7587c0c8b3a92c959804.zip

Edit: another version with more timeout:

https://github.com/Bishop341-B/ogame-infinity/archive/4d78380e92163d9d5f1d0d4a8ca53378aecc20a0.zip

IbaiArricibita commented 1 year ago

The little I tested it seems to work. Not showing the "DOMPurify is not defined" problem anymore.

Bishop341-B commented 1 year ago

The little I tested it seems to work. Not showing the "DOMPurify is not defined" problem anymore.

Great :+1:

Did you have the problem on a PC browser or in a mobile browser?

IbaiArricibita commented 1 year ago

PC Browser