forked from firka/flutter
[flutter web] Listen for service extension registration events to determine hot-restart method name (#147897)
### Some background: * Flutter registers the hot-restart service extension for all devices **except** web devices. For web devices, DWDS registers the service extensions. * When a user is debugging their code via VS Code, the VS Code Dart extension [sends a hot-restart](94cb81c552/src/debug/run_daemon_base.ts (L100)) request via stdin/out to flutter_tools * flutter_tools then [calls the "hotRestart" service extension](f3978c7a46/packages/flutter_tools/lib/src/isolated/resident_web_runner.dart (L447)) (which, again, has been registered by DWDS) ### Why is this change necessary? In DWDS, we are changing how we register the "hotRestart" service extension (here is the PR for that: https://github.com/dart-lang/webdev/pull/2388). Previously, we registered the "hotRestart" service extension on a client that was directly connected to the VmService. With https://github.com/dart-lang/webdev/pull/2388, we will be registering the "hotRestart" service extension on a client that is connected to DDS. When a service extension is registered against DDS, DDS adds a prefix to the service extension method name (e.g. "hotRestart" becomes "s0.hotRestart"). It informs clients of the service extension name via `kServiceRegistered` events sent to the `Service` stream. Therefore, this change simply listens to those service extension registered events, and uses them to determine the "hotRestart" service extension's method name.
This commit is contained in:
@@ -62,6 +62,9 @@ const List<VmServiceExpectation> kAttachLogExpectations =
|
||||
|
||||
const List<VmServiceExpectation> kAttachIsolateExpectations =
|
||||
<VmServiceExpectation>[
|
||||
FakeVmServiceRequest(method: 'streamListen', args: <String, Object>{
|
||||
'streamId': 'Service',
|
||||
}),
|
||||
FakeVmServiceRequest(method: 'streamListen', args: <String, Object>{
|
||||
'streamId': 'Isolate',
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user