File tree Expand file tree Collapse file tree 3 files changed +5
-10
lines changed Expand file tree Collapse file tree 3 files changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -28,9 +28,9 @@ export async function isWindowSupported(): Promise<boolean> {
28
28
// might be prohibited to run. In these contexts, an error would be thrown during the messaging
29
29
// instantiating phase, informing the developers to import/call isSupported for special handling.
30
30
return (
31
+ typeof window !== 'undefined' &&
32
+ typeof indexedDB !== 'undefined' &&
31
33
( await validateIndexedDBOpenable ( ) ) &&
32
- 'indexedDB' in window &&
33
- indexedDB !== null &&
34
34
navigator . cookieEnabled &&
35
35
'serviceWorker' in navigator &&
36
36
'PushManager' in window &&
Original file line number Diff line number Diff line change 16
16
*/
17
17
18
18
import { ERROR_FACTORY , ErrorCode } from '../utils/errors' ;
19
- import { isIndexedDBAvailable } from '@firebase/util' ;
19
+ import { isIndexedDBAvailable , areCookiesEnabled } from '@firebase/util' ;
20
20
import { consoleLogger } from '../utils/console_logger' ;
21
21
22
22
declare global {
@@ -112,12 +112,7 @@ export class Api {
112
112
}
113
113
114
114
requiredApisAvailable ( ) : boolean {
115
- if (
116
- ! fetch ||
117
- ! Promise ||
118
- ! this . navigator ||
119
- ! this . navigator . cookieEnabled
120
- ) {
115
+ if ( ! fetch || ! Promise || ! areCookiesEnabled ( ) ) {
121
116
consoleLogger . info (
122
117
'Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled.'
123
118
) ;
Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ export function validateIndexedDBOpenable(): Promise<boolean> {
184
184
* @return true if cookie is enabled within current browser
185
185
*/
186
186
export function areCookiesEnabled ( ) : boolean {
187
- if ( ! navigator || ! navigator . cookieEnabled ) {
187
+ if ( typeof navigator === 'undefined' || ! navigator . cookieEnabled ) {
188
188
return false ;
189
189
}
190
190
return true ;
You can’t perform that action at this time.
0 commit comments