File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export class FirebaseServerAppImpl
3232 implements FirebaseServerApp
3333{
3434 private readonly _serverConfig : FirebaseServerAppSettings ;
35- private _finalizationRegistry : FinalizationRegistry < object > ;
35+ private _finalizationRegistry : FinalizationRegistry < object > | null ;
3636 private _refCount : number ;
3737
3838 constructor (
@@ -67,9 +67,12 @@ export class FirebaseServerAppImpl
6767 ...serverConfig
6868 } ;
6969
70- this . _finalizationRegistry = new FinalizationRegistry ( ( ) => {
71- this . automaticCleanup ( ) ;
72- } ) ;
70+ this . _finalizationRegistry = null ;
71+ if ( typeof FinalizationRegistry !== 'undefined' ) {
72+ this . _finalizationRegistry = new FinalizationRegistry ( ( ) => {
73+ this . automaticCleanup ( ) ;
74+ } ) ;
75+ }
7376
7477 this . _refCount = 0 ;
7578 this . incRefCount ( this . _serverConfig . releaseOnDeref ) ;
@@ -97,7 +100,7 @@ export class FirebaseServerAppImpl
97100 return ;
98101 }
99102 this . _refCount ++ ;
100- if ( obj !== undefined ) {
103+ if ( obj !== undefined && this . _finalizationRegistry !== null ) {
101104 this . _finalizationRegistry . register ( obj , this ) ;
102105 }
103106 }
You can’t perform that action at this time.
0 commit comments