@@ -111,6 +111,12 @@ export default class Store extends EventEmitter<{|
111
111
// If not, features like reload-and-profile will not work correctly and must be disabled.
112
112
_isBackendStorageAPISupported: boolean = false ;
113
113
114
+ // Can DevTools use sync XHR requests?
115
+ // If not, features like reload-and-profile will not work correctly and must be disabled.
116
+ // This current limitation applies only to web extension builds
117
+ // and will need to be reconsidered in the future if we add support for reload to React Native.
118
+ _isSynchronousXHRSupported: boolean = false ;
119
+
114
120
_nativeStyleEditorValidAttributes: $ReadOnlyArray < string > | null = null ;
115
121
116
122
// Map of element (id) to the set of elements (ids) it owns.
@@ -195,12 +201,16 @@ export default class Store extends EventEmitter<{|
195
201
bridge . addListener ( 'shutdown' , this . onBridgeShutdown ) ;
196
202
bridge . addListener (
197
203
'isBackendStorageAPISupported' ,
198
- this . onBridgeStorageSupported ,
204
+ this . onBackendStorageAPISupported ,
199
205
) ;
200
206
bridge . addListener (
201
207
'isNativeStyleEditorSupported' ,
202
208
this . onBridgeNativeStyleEditorSupported ,
203
209
) ;
210
+ bridge . addListener (
211
+ 'isSynchronousXHRSupported' ,
212
+ this . onBridgeSynchronousXHRSupported ,
213
+ ) ;
204
214
bridge . addListener (
205
215
'unsupportedRendererVersion' ,
206
216
this . onBridgeUnsupportedRendererVersion ,
@@ -359,11 +369,16 @@ export default class Store extends EventEmitter<{|
359
369
get supportsProfiling ( ) : boolean {
360
370
return this . _supportsProfiling ;
361
371
}
372
+
362
373
get supportsReloadAndProfile ( ) : boolean {
363
374
// Does the DevTools shell support reloading and eagerly injecting the renderer interface?
364
- // And if so, can the backend use the localStorage API?
365
- // Both of these are required for the reload-and-profile feature to work.
366
- return this . _supportsReloadAndProfile && this . _isBackendStorageAPISupported ;
375
+ // And if so, can the backend use the localStorage API and sync XHR?
376
+ // All of these are currently required for the reload-and-profile feature to work.
377
+ return (
378
+ this . _supportsReloadAndProfile &&
379
+ this . _isBackendStorageAPISupported &&
380
+ this . _isSynchronousXHRSupported
381
+ ) ;
367
382
}
368
383
369
384
get supportsTraceUpdates ( ) : boolean {
@@ -1130,20 +1145,43 @@ export default class Store extends EventEmitter<{|
1130
1145
debug ( 'onBridgeShutdown' , 'unsubscribing from Bridge' ) ;
1131
1146
}
1132
1147
1133
- this . _bridge . removeListener ( 'operations' , this . onBridgeOperations ) ;
1134
- this . _bridge . removeListener ( 'shutdown' , this . onBridgeShutdown ) ;
1135
- this . _bridge . removeListener (
1148
+ const bridge = this . _bridge ;
1149
+ bridge . removeListener ( 'operations' , this . onBridgeOperations ) ;
1150
+ bridge . removeListener (
1151
+ 'overrideComponentFilters' ,
1152
+ this . onBridgeOverrideComponentFilters ,
1153
+ ) ;
1154
+ bridge . removeListener ( 'shutdown' , this . onBridgeShutdown ) ;
1155
+ bridge . removeListener (
1136
1156
'isBackendStorageAPISupported' ,
1137
- this . onBridgeStorageSupported ,
1157
+ this . onBackendStorageAPISupported ,
1158
+ ) ;
1159
+ bridge . removeListener (
1160
+ 'isNativeStyleEditorSupported' ,
1161
+ this . onBridgeNativeStyleEditorSupported ,
1162
+ ) ;
1163
+ bridge . removeListener (
1164
+ 'isSynchronousXHRSupported' ,
1165
+ this . onBridgeSynchronousXHRSupported ,
1166
+ ) ;
1167
+ bridge . removeListener (
1168
+ 'unsupportedRendererVersion' ,
1169
+ this . onBridgeUnsupportedRendererVersion ,
1138
1170
) ;
1139
1171
} ;
1140
1172
1141
- onBridgeStorageSupported = ( isBackendStorageAPISupported : boolean ) => {
1173
+ onBackendStorageAPISupported = ( isBackendStorageAPISupported : boolean ) => {
1142
1174
this . _isBackendStorageAPISupported = isBackendStorageAPISupported ;
1143
1175
1144
1176
this . emit ( 'supportsReloadAndProfile' ) ;
1145
1177
} ;
1146
1178
1179
+ onBridgeSynchronousXHRSupported = ( isSynchronousXHRSupported : boolean ) => {
1180
+ this . _isSynchronousXHRSupported = isSynchronousXHRSupported ;
1181
+
1182
+ this . emit ( 'supportsReloadAndProfile' ) ;
1183
+ } ;
1184
+
1147
1185
onBridgeUnsupportedRendererVersion = ( ) => {
1148
1186
this . _unsupportedRendererVersionDetected = true ;
1149
1187
0 commit comments