[flutter web] Listen for service extension registration events to determine hot-restart method name#147897
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
DanTup
left a comment
There was a problem hiding this comment.
The seems reasonable to me - we have to do the same in Dart-Code for calling services. I never understood why the names might be different.. but Jacob recently mentioned it might be because multiple clients can register the same service names, and this is how they'd be disambiguated. Dart-Code just calls the last one with that name, so if there are multiple they might not all be being called!
(I don't know the best way to add tests for this though, I'll defer to Chris for suggestions)
|
I was gonna say, "I'm assuming this is covered by existing tests", but then saw the test failures :) This LGTM once you update the test expectations: |
…s to determine hot-restart method name (flutter/flutter#147897)
…s to determine hot-restart method name (flutter/flutter#147897)
…s to determine hot-restart method name (flutter/flutter#147897)
…s to determine hot-restart method name (flutter/flutter#147897)
…s to determine hot-restart method name (flutter/flutter#147897)
Some background:
Why is this change necessary?
In DWDS, we are changing how we register the "hotRestart" service extension (here is the PR for that: dart-lang/webdev#2388). Previously, we registered the "hotRestart" service extension on a client that was directly connected to the VmService. With dart-lang/webdev#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
kServiceRegisteredevents sent to theServicestream.Therefore, this change simply listens to those service extension registered events, and uses them to determine the "hotRestart" service extension's method name.