-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Set injectDebuggingSupportCode in DWDS based on specified device ID #165820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. 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.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
// Defaults to 'chrome' if deviceManager or specifiedDeviceId is null, | ||
// ensuring the condition is true by default. | ||
injectDebuggingSupportCode: | ||
(globals.deviceManager?.specifiedDeviceId ?? 'chrome') == 'chrome', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nshahan I had some weird conflict with the other PR so decided to drop it and create a new one. I'm reentering the comment from the previous PR.
IIUC from the linked change (dart-lang/webdev#2601) this will inject the code required to support debugging into the page but that doesn't mean debugging actually works?
Does globals.deviceManager?.specifiedDeviceId evaluate to null when someone runs flutter run -d web-server? It isn't clear to me why we want to default it to be true when we don't know if it will work or not.
I missed this comment earlier. When someone runs flutter run -d web-server
, globals.deviceManager?.specifiedDeviceId
evaluates to web-server
. When we do a flutter run without the flag, globals.deviceManager?.specifiedDeviceId
evaluates to chrome
by default. I'm not sure if globals.deviceManager?.specifiedDeviceId
ever evaluates to null
but I wanted to catch that case so we don't run into any surprises. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Building on the previous comment, setting injectDebuggingSupportCode
to true
preserves the current behavior. My approach here is to maintain this behavior by default while allowing users to skip the injection when running on a different device, such as web-server
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So previously we always injected the debugging support code?
And I guess now with this change we stop injecting it when the device is not null and explicitly not chrome. SGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, that is correct!
This change ensures that
injectDebuggingSupportCode
in DWDS is set based on the specified device ID, defaulting to Chrome. This complements the changes made in dart-lang/webdev#2601 and ensures that debugging support is correctly configured for different environments.fixes dart-lang/sdk#60289