File tree 4 files changed +13
-19
lines changed 4 files changed +13
-19
lines changed Original file line number Diff line number Diff line change @@ -256,10 +256,11 @@ export class FirebaseDatabase implements _FirebaseService {
256
256
}
257
257
258
258
_delete ( ) : Promise < void > {
259
- this . _checkNotDeleted ( 'delete' ) ;
260
- repoManagerDeleteRepo ( this . _repo , this . app . name ) ;
261
- this . _repoInternal = null ;
262
- this . _rootInternal = null ;
259
+ if ( this . _rootInternal !== null ) {
260
+ repoManagerDeleteRepo ( this . _repo , this . app . name ) ;
261
+ this . _repoInternal = null ;
262
+ this . _rootInternal = null ;
263
+ }
263
264
return Promise . resolve ( ) ;
264
265
}
265
266
Original file line number Diff line number Diff line change @@ -37,15 +37,6 @@ export class StorageServiceCompat
37
37
{
38
38
constructor ( public app : FirebaseApp , readonly _delegate : StorageService ) { }
39
39
40
- INTERNAL = {
41
- /**
42
- * Called when the associated app is deleted.
43
- */
44
- delete : ( ) => {
45
- return this . _delegate . _delete ( ) ;
46
- }
47
- } ;
48
-
49
40
get maxOperationRetryTime ( ) : number {
50
41
return this . _delegate . maxOperationRetryTime ;
51
42
}
Original file line number Diff line number Diff line change @@ -269,9 +269,11 @@ export class StorageService implements _FirebaseService {
269
269
* Stop running requests and prevent more from being created.
270
270
*/
271
271
_delete ( ) : Promise < void > {
272
- this . _deleted = true ;
273
- this . _requests . forEach ( request => request . cancel ( ) ) ;
274
- this . _requests . clear ( ) ;
272
+ if ( ! this . _deleted ) {
273
+ this . _deleted = true ;
274
+ this . _requests . forEach ( request => request . cancel ( ) ) ;
275
+ this . _requests . clear ( ) ;
276
+ }
275
277
return Promise . resolve ( ) ;
276
278
}
277
279
Original file line number Diff line number Diff line change @@ -333,13 +333,13 @@ GOOG4-RSA-SHA256`
333
333
const ref = service . refFromURL ( 'gs://mybucket/image.jpg' ) ;
334
334
const metadataPromise = ref . getMetadata ( ) ;
335
335
// eslint-disable-next-line @typescript-eslint/no-floating-promises
336
- service . INTERNAL . delete ( ) ;
336
+ service . _delegate . _delete ( ) ;
337
337
await expect ( metadataPromise ) . to . be . rejectedWith ( 'storage/app-deleted' ) ;
338
338
} ) ;
339
339
it ( 'Requests fail when started after the service is deleted' , async ( ) => {
340
340
const ref = service . refFromURL ( 'gs://mybucket/image.jpg' ) ;
341
341
// eslint-disable-next-line @typescript-eslint/no-floating-promises
342
- service . INTERNAL . delete ( ) ;
342
+ service . _delegate . _delete ( ) ;
343
343
344
344
await expect ( ref . getMetadata ( ) ) . to . be . rejectedWith ( 'storage/app-deleted' ) ;
345
345
} ) ;
@@ -360,7 +360,7 @@ GOOG4-RSA-SHA256`
360
360
}
361
361
) ;
362
362
// eslint-disable-next-line @typescript-eslint/no-floating-promises
363
- service . INTERNAL . delete ( ) ;
363
+ service . _delegate . _delete ( ) ;
364
364
} ) ;
365
365
return toReturn ;
366
366
} ) ;
You can’t perform that action at this time.
0 commit comments