Skip to content
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

Uncaught DOMException: Failed to execute 'atob' on 'Window' #1

Closed
zeripath opened this issue Jan 29, 2023 · 5 comments
Closed

Uncaught DOMException: Failed to execute 'atob' on 'Window' #1

zeripath opened this issue Jan 29, 2023 · 5 comments

Comments

@zeripath
Copy link

First of all thank you for providing this library.

We have recently starting experiencing an Uncaught DOMException: Failed to execute 'atob' on 'Window' on use of this library.

I think the meaning of use strict; (at least on chrome) has recently got a lot more strict and the use of the non-imported atob and btoa in this library is now causing an Uncaught DOMException.

As far as I can see, replacing atob and btoa with window.atob and window.btoa makes things work again but I'm uncertain as to whether this is the correct approach.

@yardenshoham
Copy link

Probably because of ff5c87d

@zeripath
Copy link
Author

Well that commit should only change the tests - so I'm not certain that would affect things.

Whilst I've posited above that I think this is probably something to do with the browser tightening the meaning of use strict;, we in go-gitea/gitea might be being affected because of some tightening within our webpack configuration or webpack itself. I just don't know and don't know where to look. I do know that using window.atob and window.btoa fixes this for us.

I find working with the javascript ecosystem infuriating like this because to me it's completely opaque as to where the problem is and what has changed to make this problem appear.

@WebReflection
Copy link
Owner

atob and btoa are standard on Web and not going anywhere due backward compatibility the Web is famous for … I’ve no idea which environment you’re after but from JS perspective window.atob or just atob are the same. Moreover, there are environments where window doesn’t exist (Workers) and self.atob or atob is still the same.

in short, you have an issue with your environment

@zeripath
Copy link
Author

Hmm looks like I was experiencing some kind of weird different bug - which might have been temporary.

@WebReflection
Copy link
Owner

I guess we can close this then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants