@firebase/util 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.esm2017.js +26 -4
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +24 -4
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +24 -4
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +26 -4
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -657,7 +657,15 @@ const getDefaultsFromCookie = () => {
|
|
|
657
657
|
if (typeof document === 'undefined') {
|
|
658
658
|
return;
|
|
659
659
|
}
|
|
660
|
-
|
|
660
|
+
let match;
|
|
661
|
+
try {
|
|
662
|
+
match = document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/);
|
|
663
|
+
}
|
|
664
|
+
catch (e) {
|
|
665
|
+
// Some environments such as Angular Universal SSR have a
|
|
666
|
+
// `document` object but error on accessing `document.cookie`.
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
661
669
|
const decoded = match && base64Decode(match[1]);
|
|
662
670
|
return decoded && JSON.parse(decoded);
|
|
663
671
|
};
|
|
@@ -667,9 +675,23 @@ const getDefaultsFromCookie = () => {
|
|
|
667
675
|
* (2) if such an object was provided on a shell environment variable
|
|
668
676
|
* (3) if such an object exists in a cookie
|
|
669
677
|
*/
|
|
670
|
-
const getDefaults = () =>
|
|
671
|
-
|
|
672
|
-
|
|
678
|
+
const getDefaults = () => {
|
|
679
|
+
try {
|
|
680
|
+
return (getDefaultsFromGlobal() ||
|
|
681
|
+
getDefaultsFromEnvVariable() ||
|
|
682
|
+
getDefaultsFromCookie());
|
|
683
|
+
}
|
|
684
|
+
catch (e) {
|
|
685
|
+
/**
|
|
686
|
+
* Catch-all for being unable to get __FIREBASE_DEFAULTS__ due
|
|
687
|
+
* to any environment case we have not accounted for. Log to
|
|
688
|
+
* info instead of swallowing so we can find these unknown cases
|
|
689
|
+
* and add paths for them if needed.
|
|
690
|
+
*/
|
|
691
|
+
console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
};
|
|
673
695
|
/**
|
|
674
696
|
* Returns emulator host stored in the __FIREBASE_DEFAULTS__ object
|
|
675
697
|
* for the given product.
|