firestore: verify DOMException exists before using it in when base64 decoding by dconeybe · Pull Request #7130 · firebase/firebase-js-sdk (original) (raw)
In #7115 the customer shows that the "browser" logic for decoding a base64 string was being invoked from a react-native app. In react-native, the DOMException class does not exist, which results in the following error:
ReferenceError: Property 'DOMException' doesn't exist
This usage of DOMException was added by #7019.
Although a react-native app should be using a different implementation of base64 decoding, we may as well be safe here so that the error message produced from a react-native app is more meaningful, something like Uncaught ReferenceError: atob() is not defined.