Skip to content

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

@zeripath

Description

@zeripath

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.

Activity

yardenshoham

yardenshoham commented on Jan 29, 2023

@yardenshoham

Probably because of ff5c87d

zeripath

zeripath commented on Jan 29, 2023

@zeripath
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

WebReflection commented on Jan 29, 2023

@WebReflection
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

zeripath commented on Jan 29, 2023

@zeripath
Author

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

WebReflection

WebReflection commented on Jan 30, 2023

@WebReflection
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @WebReflection@zeripath@yardenshoham

        Issue actions

          Uncaught DOMException: Failed to execute 'atob' on 'Window' · Issue #1 · WebReflection/uint8-to-base64