File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @firebase/app-compat ' : patch
3+ ---
4+
5+ Properly handle the case in app-compat checks where ` window ` exists but ` self ` does not. (This occurs in Ionic Stencil's Jest preset.)
Original file line number Diff line number Diff line change @@ -21,16 +21,22 @@ import { firebase as firebaseNamespace } from './firebaseNamespace';
2121import { logger } from './logger' ;
2222import { registerCoreComponents } from './registerCoreComponents' ;
2323
24+ declare global {
25+ interface Window {
26+ firebase : FirebaseNamespace ;
27+ }
28+ }
29+
2430// Firebase Lite detection
2531// eslint-disable-next-line @typescript-eslint/no-explicit-any
26- if ( isBrowser ( ) && ( self as any ) . firebase !== undefined ) {
32+ if ( isBrowser ( ) && window . firebase !== undefined ) {
2733 logger . warn ( `
2834 Warning: Firebase is already defined in the global scope. Please make sure
2935 Firebase library is only loaded once.
3036 ` ) ;
3137
3238 // eslint-disable-next-line
33- const sdkVersion = ( ( self as any ) . firebase as FirebaseNamespace ) . SDK_VERSION ;
39+ const sdkVersion = ( window . firebase as FirebaseNamespace ) . SDK_VERSION ;
3440 if ( sdkVersion && sdkVersion . indexOf ( 'LITE' ) >= 0 ) {
3541 logger . warn ( `
3642 Warning: You are trying to load Firebase while using Firebase Performance standalone script.
Original file line number Diff line number Diff line change @@ -80,6 +80,9 @@ export function isNode(): boolean {
8080
8181/**
8282 * Detect Browser Environment
83+ * Note: This will return true for certain test frameworks that are incompletely
84+ * mimicking a browser, and should not lead to assuming all browser APIs are
85+ * available.
8386 */
8487export function isBrowser ( ) : boolean {
8588 return typeof window !== 'undefined' || isWebWorker ( ) ;
You can’t perform that action at this time.
0 commit comments