@@ -21,8 +21,6 @@ import {
21
21
ComponentType ,
22
22
InstanceFactory
23
23
} from '@firebase/component' ;
24
- import { ERROR_FACTORY , ErrorCode } from '../util/errors' ;
25
- import { isSwSupported , isWindowSupported } from '../api/isSupported' ;
26
24
import {
27
25
onNotificationClick ,
28
26
onPush ,
@@ -40,8 +38,6 @@ import { messageEventListener } from '../listeners/window-listener';
40
38
const WindowMessagingFactory : InstanceFactory < 'messaging' > = (
41
39
container : ComponentContainer
42
40
) => {
43
- maybeThrowWindowError ( ) ;
44
-
45
41
const messaging = new MessagingService (
46
42
container . getProvider ( 'app' ) . getImmediate ( ) ,
47
43
container . getProvider ( 'installations-internal' ) . getImmediate ( ) ,
@@ -58,8 +54,6 @@ const WindowMessagingFactory: InstanceFactory<'messaging'> = (
58
54
const WindowMessagingInternalFactory : InstanceFactory < 'messaging-internal' > = (
59
55
container : ComponentContainer
60
56
) => {
61
- maybeThrowWindowError ( ) ;
62
-
63
57
const messaging = container
64
58
. getProvider ( 'messaging' )
65
59
. getImmediate ( ) as MessagingService ;
@@ -71,40 +65,10 @@ const WindowMessagingInternalFactory: InstanceFactory<'messaging-internal'> = (
71
65
return messagingInternal ;
72
66
} ;
73
67
74
- function maybeThrowWindowError ( ) : void {
75
- // Conscious decision to make this async check non-blocking during the messaging instance
76
- // initialization phase for performance consideration. An error would be thrown latter for
77
- // developer's information. Developers can then choose to import and call `isSupported` for
78
- // special handling.
79
- isWindowSupported ( )
80
- . then ( isSupported => {
81
- if ( ! isSupported ) {
82
- throw ERROR_FACTORY . create ( ErrorCode . UNSUPPORTED_BROWSER ) ;
83
- }
84
- } )
85
- . catch ( _ => {
86
- throw ERROR_FACTORY . create ( ErrorCode . INDEXED_DB_UNSUPPORTED ) ;
87
- } ) ;
88
- }
89
-
90
68
declare const self : ServiceWorkerGlobalScope ;
91
69
const SwMessagingFactory : InstanceFactory < 'messaging' > = (
92
70
container : ComponentContainer
93
71
) => {
94
- // Conscious decision to make this async check non-blocking during the messaging instance
95
- // initialization phase for performance consideration. An error would be thrown latter for
96
- // developer's information. Developers can then choose to import and call `isSupported` for
97
- // special handling.
98
- isSwSupported ( )
99
- . then ( isSupported => {
100
- if ( ! isSupported ) {
101
- throw ERROR_FACTORY . create ( ErrorCode . UNSUPPORTED_BROWSER ) ;
102
- }
103
- } )
104
- . catch ( _ => {
105
- throw ERROR_FACTORY . create ( ErrorCode . INDEXED_DB_UNSUPPORTED ) ;
106
- } ) ;
107
-
108
72
const messaging = new MessagingService (
109
73
container . getProvider ( 'app' ) . getImmediate ( ) ,
110
74
container . getProvider ( 'installations-internal' ) . getImmediate ( ) ,
0 commit comments