mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Fix launching DevTools with Flutter Web applications (#72110)
This commit is contained in:
parent
918100f8e8
commit
705811fee2
@ -808,6 +808,11 @@ class _ResidentWebRunner extends ResidentWebRunner {
|
|||||||
});
|
});
|
||||||
|
|
||||||
websocketUri = Uri.parse(_connectionResult.debugConnection.uri);
|
websocketUri = Uri.parse(_connectionResult.debugConnection.uri);
|
||||||
|
device.vmService = _vmService;
|
||||||
|
// Update caches to enable the FlutterVmService extensions.
|
||||||
|
setHttpAddress(_httpUriFromWebsocketUri(websocketUri), device.vmService);
|
||||||
|
setWsAddress(websocketUri, device.vmService);
|
||||||
|
|
||||||
// Always run main after connecting because start paused doesn't work yet.
|
// Always run main after connecting because start paused doesn't work yet.
|
||||||
if (!debuggingOptions.startPaused || !supportsServiceProtocol) {
|
if (!debuggingOptions.startPaused || !supportsServiceProtocol) {
|
||||||
_connectionResult.appConnection.runMain();
|
_connectionResult.appConnection.runMain();
|
||||||
@ -859,4 +864,10 @@ class _ResidentWebRunner extends ResidentWebRunner {
|
|||||||
await device.exitApps();
|
await device.exitApps();
|
||||||
appFinished();
|
appFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Uri _httpUriFromWebsocketUri(Uri websocketUri) {
|
||||||
|
const String wsPath = '/ws';
|
||||||
|
final String path = websocketUri.path;
|
||||||
|
return websocketUri.replace(scheme: 'http', path: path.substring(0, path.length - wsPath.length));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:meta/meta.dart' show required, visibleForTesting;
|
import 'package:meta/meta.dart' show required;
|
||||||
import 'package:vm_service/vm_service.dart' as vm_service;
|
import 'package:vm_service/vm_service.dart' as vm_service;
|
||||||
|
|
||||||
import 'base/context.dart';
|
import 'base/context.dart';
|
||||||
@ -152,13 +152,17 @@ final Expando<Uri> _httpAddressExpando = Expando<Uri>();
|
|||||||
|
|
||||||
final Expando<Uri> _wsAddressExpando = Expando<Uri>();
|
final Expando<Uri> _wsAddressExpando = Expando<Uri>();
|
||||||
|
|
||||||
@visibleForTesting
|
|
||||||
void setHttpAddress(Uri uri, vm_service.VmService vmService) {
|
void setHttpAddress(Uri uri, vm_service.VmService vmService) {
|
||||||
|
if(vmService == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
_httpAddressExpando[vmService] = uri;
|
_httpAddressExpando[vmService] = uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
@visibleForTesting
|
|
||||||
void setWsAddress(Uri uri, vm_service.VmService vmService) {
|
void setWsAddress(Uri uri, vm_service.VmService vmService) {
|
||||||
|
if(vmService == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
_wsAddressExpando[vmService] = uri;
|
_wsAddressExpando[vmService] = uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user