File tree Expand file tree Collapse file tree 4 files changed +9
-4
lines changed Expand file tree Collapse file tree 4 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @firebase/firestore " : patch
3+ ---
4+
5+ Use 'pagehide' for page termination by default.
Original file line number Diff line number Diff line change @@ -966,7 +966,7 @@ export class IndexedDbPersistence implements Persistence {
966966 return this . shutdown ( ) ;
967967 } ) ;
968968 } ;
969- this . window . addEventListener ( 'unload ' , this . windowUnloadHandler ) ;
969+ this . window . addEventListener ( 'pagehide ' , this . windowUnloadHandler ) ;
970970 }
971971 }
972972
@@ -976,7 +976,7 @@ export class IndexedDbPersistence implements Persistence {
976976 typeof this . window ?. removeEventListener === 'function' ,
977977 "Expected 'window.removeEventListener' to be a function"
978978 ) ;
979- this . window ! . removeEventListener ( 'unload ' , this . windowUnloadHandler ) ;
979+ this . window ! . removeEventListener ( 'pagehide ' , this . windowUnloadHandler ) ;
980980 this . windowUnloadHandler = null ;
981981 }
982982 }
Original file line number Diff line number Diff line change @@ -613,7 +613,7 @@ export class WebStorageSharedClientState implements SharedClientState {
613613
614614 // Register a window unload hook to remove the client metadata entry from
615615 // WebStorage even if `shutdown()` was not called.
616- this . window . addEventListener ( 'unload ' , ( ) => this . shutdown ( ) ) ;
616+ this . window . addEventListener ( 'pagehide ' , ( ) => this . shutdown ( ) ) ;
617617
618618 this . started = true ;
619619 }
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ export class FakeWindow implements WindowLike {
5858 case 'storage' :
5959 this . storageListeners . push ( listener ) ;
6060 break ;
61- case 'unload ' :
61+ case 'pagehide ' :
6262 case 'visibilitychange' :
6363 // The spec tests currently do not rely on `unload`/`visibilitychange`
6464 // listeners.
You can’t perform that action at this time.
0 commit comments