Skip to content

Conversation

@reynaldots
Copy link
Contributor

@reynaldots reynaldots commented May 26, 2025

Respect user-data-dir flag from web-browser-flag

Currently, it's already possible to pass web-browser-flag when launching Chrome, but the user-data-dir flag doesn't work as expected, and there are some reasons for that.

In the implementation made in PR #104935, the web-browser-flag is appended at the end of the Chrome launch arguments.

For most scenarios, this works fine, as demonstrated in the Chrome unit test below:
https://source.chromium.org/chromium/chromium/src/+/main:base/command_line_unittest.cc

TEST(CommandLineTest, MultipleSameSwitch) {
  const CommandLine::CharType* argv[] = {
      FILE_PATH_LITERAL("program"),
      FILE_PATH_LITERAL("--foo=one"),  // --foo first time
      FILE_PATH_LITERAL("-baz"),
      FILE_PATH_LITERAL("--foo=two")   // --foo second time
  };
  CommandLine cl(std::size(argv), argv);

  EXPECT_TRUE(cl.HasSwitch("foo"));
  EXPECT_TRUE(cl.HasSwitch("baz"));

  EXPECT_EQ("two", cl.GetSwitchValueASCII("foo"));
}

In this scenario, the parser will consider the last occurrence of a flag.

However, this behavior does not apply to certain flags, because Chrome processes some of them based on the first occurrence, not the last. This is the case for --user-data-dir, which is parsed very early during Chrome startup.

The proposed code checks whether --user-data-dir was provided via web-browser-flag, and if so, it uses that value instead of the default %temp%\flutter_tools_chrome_device.xpto temporary directory.

This also resolve this comment:
#104935 (comment)

Example: launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "flutter",
      "request": "launch",
      "type": "dart"
    },
    {
      "name": "flutter (profile mode)",
      "request": "launch",
      "type": "dart",
      "flutterMode": "profile"
    },
    {
      "name": "flutter (release mode)",
      "request": "launch",
      "type": "dart",
      "flutterMode": "release"
    },
    {
      "name": "Flutter for web (hot reloadable)",
      "type": "dart",
      "request": "launch",
      "program": "lib/main.dart",
      "args": [
        "-d",
        "chrome",
        "--web-port=5000",
        "--web-experimental-hot-reload",
        "--web-browser-flag=--user-data-dir=D:\\_Desenv\\flutter_tests\\chrome_profile"
      ]
    }
  ]
}

chrome://version

Before After
before after

Folder

Before After
before_files after_files

Pre-launch Checklist

@flutter-dashboard
Copy link

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.

@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label May 26, 2025
Copy link
Contributor

@bkonyi bkonyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

This should ideally be tested. Can you add a test to make sure this flag is respected properly?

@bkonyi bkonyi requested a review from mdebbar June 2, 2025 14:01
@bkonyi bkonyi added team-tool Owned by Flutter Tool team fyi-web For the attention of Web platform team labels Jun 2, 2025
Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if it LGT @bkonyi

@github-actions github-actions bot removed the team-tool Owned by Flutter Tool team label Jun 3, 2025
Copy link
Contributor

@bkonyi bkonyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there!

There's some analysis and formatting failures that need to be addressed before this can land:

   info • The imported package 'collection' isn't a dependency of the importing package • packages/flutter_tools/lib/src/web/chrome.dart:7:8 • depend_on_referenced_packages
   info • Use 'const' with the constructor to improve performance • packages/flutter_tools/test/web.shard/chrome_test.dart:942:7 • prefer_const_constructors
   info • Use 'const' literals as arguments to constructors of '@immutable' classes • packages/flutter_tools/test/web.shard/chrome_test.dart:943:18 • prefer_const_literals_to_create_immutables

@bkonyi
Copy link
Contributor

bkonyi commented Jun 23, 2025

@reynaldots, just checking in. Do you still plan on moving forward with this PR?

@bkonyi bkonyi added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jun 23, 2025
@reynaldots
Copy link
Contributor Author

@reynaldots, just checking in. Do you still plan on moving forward with this PR?

@bkonyi Yes! I've been having a crazy month releasing an app, but this weekend I'm going to refactor it.
I didt understand how i can refactor when you sad: This file needs to be formatted.

And when analysis sad: info • The imported package 'collection' isn't a dependency of the importing package • packages/flutter_tools/lib/src/web/chrome.dart:7:8 • depend_on_referenced_packages

What should i do? Because firstWhereOrNull uses that package.

@bkonyi
Copy link
Contributor

bkonyi commented Jun 23, 2025

Not a problem! Just wanted to make sure you had intentions of coming back to this :)

To fix the formatting issue, you should just have to run dart format packages/flutter_tools/lib/src/web/chrome.dart.

For the package:collection issue, it looks like there's no other uses of package:collection in flutter_tools, so it's not actually part of the project's pubspec.yaml. You'll need to add it to the pubspec.yaml (use the version listed here) and then run the following command: flutter update-packages --cherry-pick=collection:<VERSION_HERE>, where <VERSION_HERE> is replaced with the version of package:collection.

@reynaldots
Copy link
Contributor Author

Hi @bkonyi! I finished the corrections.

Copy link
Contributor

@bkonyi bkonyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 25, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Jul 25, 2025

autosubmit label was removed for flutter/flutter/169445, because This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.

  • Merge guidelines: A PR needs at least one approved review if the author is already part of flutter-hackers or two member reviews if the author is not a flutter-hacker before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 25, 2025
@mdebbar mdebbar added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 25, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Jul 25, 2025
@mdebbar mdebbar removed the revert Autorevert PR (with "Reason for revert:" comment) label Jul 25, 2025
@mdebbar
Copy link
Contributor

mdebbar commented Jul 25, 2025

@zanderso I think this was fixed in #172776

@auto-submit
Copy link
Contributor

auto-submit bot commented Jul 25, 2025

Unable to create the revert pull request due to ProcessException: Standard out
Auto-merging packages/flutter_tools/test/web.shard/chrome_test.dart
CONFLICT (content): Merge conflict in packages/flutter_tools/test/web.shard/chrome_test.dart
Standard error
error: could not revert aea660d... feat(tool): Respect user-data-dir flag from web-browser-flag (#169445)
hint: After resolving the conflicts, mark them with
hint: "git add/rm ", then run
hint: "git revert --continue".
hint: You can instead skip this commit with "git revert --skip".
hint: To abort and get back to the state before "git revert",
hint: run "git revert --abort".
Command: git revert --no-edit -m 1 aea660d

@zanderso
Copy link
Member

Oops. You're right. Thanks!

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2025
azatech pushed a commit to azatech/flutter that referenced this pull request Jul 28, 2025
…#169445)

### Respect user-data-dir flag from web-browser-flag

Currently, it's already possible to pass `web-browser-flag` when
launching Chrome, but the `user-data-dir` flag doesn't work as expected,
and there are some reasons for that.

In the implementation made in [PR
flutter#104935](flutter#104935), the
`web-browser-flag` is appended at the end of the Chrome launch
arguments.

For most scenarios, this works fine, as demonstrated in the Chrome unit
test below:

https://source.chromium.org/chromium/chromium/src/+/main:base/command_line_unittest.cc

```
TEST(CommandLineTest, MultipleSameSwitch) {
  const CommandLine::CharType* argv[] = {
      FILE_PATH_LITERAL("program"),
      FILE_PATH_LITERAL("--foo=one"),  // --foo first time
      FILE_PATH_LITERAL("-baz"),
      FILE_PATH_LITERAL("--foo=two")   // --foo second time
  };
  CommandLine cl(std::size(argv), argv);

  EXPECT_TRUE(cl.HasSwitch("foo"));
  EXPECT_TRUE(cl.HasSwitch("baz"));

  EXPECT_EQ("two", cl.GetSwitchValueASCII("foo"));
}
```
In this scenario, the parser will consider the last occurrence of a
flag.

However, this behavior does not apply to certain flags, because Chrome
processes some of them based on the first occurrence, not the last. This
is the case for `--user-data-dir`, which is parsed very early during
Chrome startup.

The proposed code checks whether `--user-data-dir` was provided via
`web-browser-flag`, and if so, it uses that value instead of the default
`%temp%\flutter_tools_chrome_device.xpto` temporary directory.

This also resolve this comment:
flutter#104935 (comment)

Example: `launch.json`
```
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "flutter",
      "request": "launch",
      "type": "dart"
    },
    {
      "name": "flutter (profile mode)",
      "request": "launch",
      "type": "dart",
      "flutterMode": "profile"
    },
    {
      "name": "flutter (release mode)",
      "request": "launch",
      "type": "dart",
      "flutterMode": "release"
    },
    {
      "name": "Flutter for web (hot reloadable)",
      "type": "dart",
      "request": "launch",
      "program": "lib/main.dart",
      "args": [
        "-d",
        "chrome",
        "--web-port=5000",
        "--web-experimental-hot-reload",
        "--web-browser-flag=--user-data-dir=D:\\_Desenv\\flutter_tests\\chrome_profile"
      ]
    }
  ]
}
```

`chrome://version`

| Before | After  |
|--------|--------|
|
![before](https://github.com/user-attachments/assets/b3f33419-fbf1-446e-a471-745df2e8c4f6)
|
![after](https://github.com/user-attachments/assets/ea74a203-c269-4ce1-8a9b-f97e9a4cdc78)
|

Folder
| Before | After  |
|--------|--------|
|
![before_files](https://github.com/user-attachments/assets/8522e60b-d0eb-4b66-a4b6-c2d6ed34c15b)
|
![after_files](https://github.com/user-attachments/assets/ff94b498-b319-474c-89e5-c55f6e1c4383)
|

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
azatech pushed a commit to azatech/flutter that referenced this pull request Jul 28, 2025
flutter#169445 was stale (not re-based),
causing a tree failure.

Let's just land this versus reverting.
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jul 28, 2025
Roll Flutter from 20788c0 to cfbaa18 (43 revisions)

flutter/flutter@20788c0...cfbaa18

2025-07-28 git@reki.re Remove shortner (flutter/flutter#172844)
2025-07-28 matanlurey@users.noreply.github.com Update `flutter pub get` to use `flutter.version.json` (instead of `version`) (flutter/flutter#172798)
2025-07-27 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from i7RS-4iBtdndwa3Jy... to tK_PAaLeo0pUxi8hv... (flutter/flutter#172827)
2025-07-26 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 4IewCwqcEm7r4QsXd... to i7RS-4iBtdndwa3Jy... (flutter/flutter#172808)
2025-07-26 98614782+auto-submit[bot]@users.noreply.github.com Reverts "fix: get content hash for master on local engine branches (#172792)" (flutter/flutter#172805)
2025-07-26 codefu@google.com fix: build size_exp artifacts in post (flutter/flutter#172802)
2025-07-26 codefu@google.com fix: get content hash for master on local engine branches (flutter/flutter#172792)
2025-07-25 matanlurey@users.noreply.github.com Update `main`/`master` repoExceptions analysis set (flutter/flutter#172796)
2025-07-25 matanlurey@users.noreply.github.com Remove deprecated `--[no-]-disable-dds` (flutter/flutter#172791)
2025-07-25 matanlurey@users.noreply.github.com `last_engine_commit.ps1`: Use `$flutterRoot` instead of `$gitTopLevel` (flutter/flutter#172786)
2025-07-25 matanlurey@users.noreply.github.com Check file contents, remove tests that are now invalid (`: 'none'`) (flutter/flutter#172788)
2025-07-25 loic.peron@inetum.com windows: allow pwsh.bat wrapper (flutter/flutter#171778)
2025-07-25 bdero@google.com [Impeller] Log glCheckFrameBufferStatus output when it fails in blit pass. (flutter/flutter#172592)
2025-07-25 matanlurey@users.noreply.github.com Remove deprecated `AssetManifest.json` file (flutter/flutter#172594)
2025-07-25 matanlurey@users.noreply.github.com Refactor `verifyVersion` into typed `Version` object, use it (flutter/flutter#172780)
2025-07-25 jmccandless@google.com Bump the customer tests to pick up an update to Zulip's tests, for th… (flutter/flutter#172733)
2025-07-25 matanlurey@users.noreply.github.com Rename `AppRunLogger`, stop writing status messages that break JSON (flutter/flutter#172591)
2025-07-25 matanlurey@users.noreply.github.com Add `--dart-define`, `-D` to `assemble`, deprecate `--define`, `-d`. (flutter/flutter#172510)
2025-07-25 rmolivares@renzo-olivares.dev Fix previous text input connection interrupts enter/space (flutter/flutter#171973)
2025-07-25 1063596+reidbaker@users.noreply.github.com Update CHANGELOG.md for 3.32.8 (flutter/flutter#172779)
2025-07-25 matanlurey@users.noreply.github.com Fix an `omit-type` lint that is breaking the tree (flutter/flutter#172776)
2025-07-25 reynaldots@gmail.com feat(tool): Respect user-data-dir flag from web-browser-flag (flutter/flutter#169445)
2025-07-25 mdebbar@google.com [web] Fix empty first frame in multiview mode (flutter/flutter#172493)
2025-07-25 jssaadeh@outlook.com Migrate to null aware elements - Part 3 (flutter/flutter#172307)
2025-07-25 mdebbar@google.com Update few links in docs (flutter/flutter#172166)
2025-07-25 engine-flutter-autoroll@skia.org Roll Skia from 768ace3fd144 to 409e1c7ba09b (1 revision) (flutter/flutter#172745)
2025-07-25 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from a_55b5hqpRnigzuNC... to 4IewCwqcEm7r4QsXd... (flutter/flutter#172742)
2025-07-25 engine-flutter-autoroll@skia.org Roll Skia from 094ac350125f to 768ace3fd144 (18 revisions) (flutter/flutter#172735)
2025-07-25 matanlurey@users.noreply.github.com Remove 2023 deprecated `'platforms'` key from daemon output (flutter/flutter#172593)
2025-07-24 a-siva@users.noreply.github.com Manual roll of Dart from 26dece893751 to 5ede85aff798 (flutter/flutter#172731)
2025-07-24 ievdokdm@gmail.com 169108 ci debug (flutter/flutter#172589)
2025-07-24 31685655+SalehTZ@users.noreply.github.com Improve assertion message in `_MixedBorderRadius.resolve()` (flutter/flutter#172100)
2025-07-24 ahmedsameha1@gmail.com Make sure that a BottomAppBar doesn't crash in 0x0 environment (flutter/flutter#172097)
2025-07-24 ahmedsameha1@gmail.com Handle#6537 bottom navigation bar (flutter/flutter#172404)
2025-07-24 ahmedsameha1@gmail.com Make sure that a MaterialBanner doesn't crash in 0x0 environment (flutter/flutter#172074)
2025-07-24 matanlurey@users.noreply.github.com Remove support for `pluginClass: none` (on `master`; `> 3.35.0`) (flutter/flutter#172579)
2025-07-24 ahmedsameha1@gmail.com Make sure that a Card doesn't crash in 0x0 environment (flutter/flutter#172373)
2025-07-24 ahmedsameha1@gmail.com Make sure that an AboutDialog doesn't crash in 0x0 environment (flutter/flutter#172444)
2025-07-24 ahmedsameha1@gmail.com Make sure that an ActionChip doesn't crash in 0x0 environment (flutter/flutter#172684)
2025-07-24 matanlurey@users.noreply.github.com Delete (unused) `dev/checks_tool` directory (flutter/flutter#172715)
2025-07-24 34871572+gmackall@users.noreply.github.com [Android] Add missing ci configuration for `Linux android_java17_tool_integration_tests` (flutter/flutter#172702)
2025-07-24 srawlins@google.com Flutter-Cherrypick-Process.md - Spell cherry-pick consistently (flutter/flutter#172697)
2025-07-24 matanlurey@users.noreply.github.com Bringup `linux_web_engine_tests`; failing 4+ times in a row (flutter/flutter#172714)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
...
vashworth pushed a commit to vashworth/packages that referenced this pull request Jul 30, 2025
Roll Flutter from 20788c0 to cfbaa18 (43 revisions)

flutter/flutter@20788c0...cfbaa18

2025-07-28 git@reki.re Remove shortner (flutter/flutter#172844)
2025-07-28 matanlurey@users.noreply.github.com Update `flutter pub get` to use `flutter.version.json` (instead of `version`) (flutter/flutter#172798)
2025-07-27 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from i7RS-4iBtdndwa3Jy... to tK_PAaLeo0pUxi8hv... (flutter/flutter#172827)
2025-07-26 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 4IewCwqcEm7r4QsXd... to i7RS-4iBtdndwa3Jy... (flutter/flutter#172808)
2025-07-26 98614782+auto-submit[bot]@users.noreply.github.com Reverts "fix: get content hash for master on local engine branches (#172792)" (flutter/flutter#172805)
2025-07-26 codefu@google.com fix: build size_exp artifacts in post (flutter/flutter#172802)
2025-07-26 codefu@google.com fix: get content hash for master on local engine branches (flutter/flutter#172792)
2025-07-25 matanlurey@users.noreply.github.com Update `main`/`master` repoExceptions analysis set (flutter/flutter#172796)
2025-07-25 matanlurey@users.noreply.github.com Remove deprecated `--[no-]-disable-dds` (flutter/flutter#172791)
2025-07-25 matanlurey@users.noreply.github.com `last_engine_commit.ps1`: Use `$flutterRoot` instead of `$gitTopLevel` (flutter/flutter#172786)
2025-07-25 matanlurey@users.noreply.github.com Check file contents, remove tests that are now invalid (`: 'none'`) (flutter/flutter#172788)
2025-07-25 loic.peron@inetum.com windows: allow pwsh.bat wrapper (flutter/flutter#171778)
2025-07-25 bdero@google.com [Impeller] Log glCheckFrameBufferStatus output when it fails in blit pass. (flutter/flutter#172592)
2025-07-25 matanlurey@users.noreply.github.com Remove deprecated `AssetManifest.json` file (flutter/flutter#172594)
2025-07-25 matanlurey@users.noreply.github.com Refactor `verifyVersion` into typed `Version` object, use it (flutter/flutter#172780)
2025-07-25 jmccandless@google.com Bump the customer tests to pick up an update to Zulip's tests, for th… (flutter/flutter#172733)
2025-07-25 matanlurey@users.noreply.github.com Rename `AppRunLogger`, stop writing status messages that break JSON (flutter/flutter#172591)
2025-07-25 matanlurey@users.noreply.github.com Add `--dart-define`, `-D` to `assemble`, deprecate `--define`, `-d`. (flutter/flutter#172510)
2025-07-25 rmolivares@renzo-olivares.dev Fix previous text input connection interrupts enter/space (flutter/flutter#171973)
2025-07-25 1063596+reidbaker@users.noreply.github.com Update CHANGELOG.md for 3.32.8 (flutter/flutter#172779)
2025-07-25 matanlurey@users.noreply.github.com Fix an `omit-type` lint that is breaking the tree (flutter/flutter#172776)
2025-07-25 reynaldots@gmail.com feat(tool): Respect user-data-dir flag from web-browser-flag (flutter/flutter#169445)
2025-07-25 mdebbar@google.com [web] Fix empty first frame in multiview mode (flutter/flutter#172493)
2025-07-25 jssaadeh@outlook.com Migrate to null aware elements - Part 3 (flutter/flutter#172307)
2025-07-25 mdebbar@google.com Update few links in docs (flutter/flutter#172166)
2025-07-25 engine-flutter-autoroll@skia.org Roll Skia from 768ace3fd144 to 409e1c7ba09b (1 revision) (flutter/flutter#172745)
2025-07-25 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from a_55b5hqpRnigzuNC... to 4IewCwqcEm7r4QsXd... (flutter/flutter#172742)
2025-07-25 engine-flutter-autoroll@skia.org Roll Skia from 094ac350125f to 768ace3fd144 (18 revisions) (flutter/flutter#172735)
2025-07-25 matanlurey@users.noreply.github.com Remove 2023 deprecated `'platforms'` key from daemon output (flutter/flutter#172593)
2025-07-24 a-siva@users.noreply.github.com Manual roll of Dart from 26dece893751 to 5ede85aff798 (flutter/flutter#172731)
2025-07-24 ievdokdm@gmail.com 169108 ci debug (flutter/flutter#172589)
2025-07-24 31685655+SalehTZ@users.noreply.github.com Improve assertion message in `_MixedBorderRadius.resolve()` (flutter/flutter#172100)
2025-07-24 ahmedsameha1@gmail.com Make sure that a BottomAppBar doesn't crash in 0x0 environment (flutter/flutter#172097)
2025-07-24 ahmedsameha1@gmail.com Handle#6537 bottom navigation bar (flutter/flutter#172404)
2025-07-24 ahmedsameha1@gmail.com Make sure that a MaterialBanner doesn't crash in 0x0 environment (flutter/flutter#172074)
2025-07-24 matanlurey@users.noreply.github.com Remove support for `pluginClass: none` (on `master`; `> 3.35.0`) (flutter/flutter#172579)
2025-07-24 ahmedsameha1@gmail.com Make sure that a Card doesn't crash in 0x0 environment (flutter/flutter#172373)
2025-07-24 ahmedsameha1@gmail.com Make sure that an AboutDialog doesn't crash in 0x0 environment (flutter/flutter#172444)
2025-07-24 ahmedsameha1@gmail.com Make sure that an ActionChip doesn't crash in 0x0 environment (flutter/flutter#172684)
2025-07-24 matanlurey@users.noreply.github.com Delete (unused) `dev/checks_tool` directory (flutter/flutter#172715)
2025-07-24 34871572+gmackall@users.noreply.github.com [Android] Add missing ci configuration for `Linux android_java17_tool_integration_tests` (flutter/flutter#172702)
2025-07-24 srawlins@google.com Flutter-Cherrypick-Process.md - Spell cherry-pick consistently (flutter/flutter#172697)
2025-07-24 matanlurey@users.noreply.github.com Bringup `linux_web_engine_tests`; failing 4+ times in a row (flutter/flutter#172714)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
...
ksokolovskyi pushed a commit to ksokolovskyi/flutter that referenced this pull request Aug 19, 2025
…#169445)

### Respect user-data-dir flag from web-browser-flag

Currently, it's already possible to pass `web-browser-flag` when
launching Chrome, but the `user-data-dir` flag doesn't work as expected,
and there are some reasons for that.

In the implementation made in [PR
flutter#104935](flutter#104935), the
`web-browser-flag` is appended at the end of the Chrome launch
arguments.

For most scenarios, this works fine, as demonstrated in the Chrome unit
test below:

https://source.chromium.org/chromium/chromium/src/+/main:base/command_line_unittest.cc

```
TEST(CommandLineTest, MultipleSameSwitch) {
  const CommandLine::CharType* argv[] = {
      FILE_PATH_LITERAL("program"),
      FILE_PATH_LITERAL("--foo=one"),  // --foo first time
      FILE_PATH_LITERAL("-baz"),
      FILE_PATH_LITERAL("--foo=two")   // --foo second time
  };
  CommandLine cl(std::size(argv), argv);

  EXPECT_TRUE(cl.HasSwitch("foo"));
  EXPECT_TRUE(cl.HasSwitch("baz"));

  EXPECT_EQ("two", cl.GetSwitchValueASCII("foo"));
}
```
In this scenario, the parser will consider the last occurrence of a
flag.

However, this behavior does not apply to certain flags, because Chrome
processes some of them based on the first occurrence, not the last. This
is the case for `--user-data-dir`, which is parsed very early during
Chrome startup.

The proposed code checks whether `--user-data-dir` was provided via
`web-browser-flag`, and if so, it uses that value instead of the default
`%temp%\flutter_tools_chrome_device.xpto` temporary directory.

This also resolve this comment:
flutter#104935 (comment)

Example: `launch.json`
```
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "flutter",
      "request": "launch",
      "type": "dart"
    },
    {
      "name": "flutter (profile mode)",
      "request": "launch",
      "type": "dart",
      "flutterMode": "profile"
    },
    {
      "name": "flutter (release mode)",
      "request": "launch",
      "type": "dart",
      "flutterMode": "release"
    },
    {
      "name": "Flutter for web (hot reloadable)",
      "type": "dart",
      "request": "launch",
      "program": "lib/main.dart",
      "args": [
        "-d",
        "chrome",
        "--web-port=5000",
        "--web-experimental-hot-reload",
        "--web-browser-flag=--user-data-dir=D:\\_Desenv\\flutter_tests\\chrome_profile"
      ]
    }
  ]
}
```

`chrome://version`

| Before | After  |
|--------|--------|
|
![before](https://github.com/user-attachments/assets/b3f33419-fbf1-446e-a471-745df2e8c4f6)
|
![after](https://github.com/user-attachments/assets/ea74a203-c269-4ce1-8a9b-f97e9a4cdc78)
|

Folder
| Before | After  |
|--------|--------|
|
![before_files](https://github.com/user-attachments/assets/8522e60b-d0eb-4b66-a4b6-c2d6ed34c15b)
|
![after_files](https://github.com/user-attachments/assets/ff94b498-b319-474c-89e5-c55f6e1c4383)
|

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
ksokolovskyi pushed a commit to ksokolovskyi/flutter that referenced this pull request Aug 19, 2025
flutter#169445 was stale (not re-based),
causing a tree failure.

Let's just land this versus reverting.
mboetger pushed a commit to mboetger/flutter that referenced this pull request Sep 18, 2025
…#169445)

### Respect user-data-dir flag from web-browser-flag

Currently, it's already possible to pass `web-browser-flag` when
launching Chrome, but the `user-data-dir` flag doesn't work as expected,
and there are some reasons for that.

In the implementation made in [PR
flutter#104935](flutter#104935), the
`web-browser-flag` is appended at the end of the Chrome launch
arguments.

For most scenarios, this works fine, as demonstrated in the Chrome unit
test below:

https://source.chromium.org/chromium/chromium/src/+/main:base/command_line_unittest.cc

```
TEST(CommandLineTest, MultipleSameSwitch) {
  const CommandLine::CharType* argv[] = {
      FILE_PATH_LITERAL("program"),
      FILE_PATH_LITERAL("--foo=one"),  // --foo first time
      FILE_PATH_LITERAL("-baz"),
      FILE_PATH_LITERAL("--foo=two")   // --foo second time
  };
  CommandLine cl(std::size(argv), argv);

  EXPECT_TRUE(cl.HasSwitch("foo"));
  EXPECT_TRUE(cl.HasSwitch("baz"));

  EXPECT_EQ("two", cl.GetSwitchValueASCII("foo"));
}
```
In this scenario, the parser will consider the last occurrence of a
flag.

However, this behavior does not apply to certain flags, because Chrome
processes some of them based on the first occurrence, not the last. This
is the case for `--user-data-dir`, which is parsed very early during
Chrome startup.

The proposed code checks whether `--user-data-dir` was provided via
`web-browser-flag`, and if so, it uses that value instead of the default
`%temp%\flutter_tools_chrome_device.xpto` temporary directory.

This also resolve this comment:
flutter#104935 (comment)

Example: `launch.json`
```
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "flutter",
      "request": "launch",
      "type": "dart"
    },
    {
      "name": "flutter (profile mode)",
      "request": "launch",
      "type": "dart",
      "flutterMode": "profile"
    },
    {
      "name": "flutter (release mode)",
      "request": "launch",
      "type": "dart",
      "flutterMode": "release"
    },
    {
      "name": "Flutter for web (hot reloadable)",
      "type": "dart",
      "request": "launch",
      "program": "lib/main.dart",
      "args": [
        "-d",
        "chrome",
        "--web-port=5000",
        "--web-experimental-hot-reload",
        "--web-browser-flag=--user-data-dir=D:\\_Desenv\\flutter_tests\\chrome_profile"
      ]
    }
  ]
}
```

`chrome://version`

| Before | After  |
|--------|--------|
|
![before](https://github.com/user-attachments/assets/b3f33419-fbf1-446e-a471-745df2e8c4f6)
|
![after](https://github.com/user-attachments/assets/ea74a203-c269-4ce1-8a9b-f97e9a4cdc78)
|

Folder
| Before | After  |
|--------|--------|
|
![before_files](https://github.com/user-attachments/assets/8522e60b-d0eb-4b66-a4b6-c2d6ed34c15b)
|
![after_files](https://github.com/user-attachments/assets/ff94b498-b319-474c-89e5-c55f6e1c4383)
|

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
mboetger pushed a commit to mboetger/flutter that referenced this pull request Sep 18, 2025
flutter#169445 was stale (not re-based),
causing a tree failure.

Let's just land this versus reverting.
korca0220 pushed a commit to korca0220/flutter that referenced this pull request Sep 22, 2025
…#169445)

### Respect user-data-dir flag from web-browser-flag

Currently, it's already possible to pass `web-browser-flag` when
launching Chrome, but the `user-data-dir` flag doesn't work as expected,
and there are some reasons for that.

In the implementation made in [PR
flutter#104935](flutter#104935), the
`web-browser-flag` is appended at the end of the Chrome launch
arguments.

For most scenarios, this works fine, as demonstrated in the Chrome unit
test below:

https://source.chromium.org/chromium/chromium/src/+/main:base/command_line_unittest.cc

```
TEST(CommandLineTest, MultipleSameSwitch) {
  const CommandLine::CharType* argv[] = {
      FILE_PATH_LITERAL("program"),
      FILE_PATH_LITERAL("--foo=one"),  // --foo first time
      FILE_PATH_LITERAL("-baz"),
      FILE_PATH_LITERAL("--foo=two")   // --foo second time
  };
  CommandLine cl(std::size(argv), argv);

  EXPECT_TRUE(cl.HasSwitch("foo"));
  EXPECT_TRUE(cl.HasSwitch("baz"));

  EXPECT_EQ("two", cl.GetSwitchValueASCII("foo"));
}
```
In this scenario, the parser will consider the last occurrence of a
flag.

However, this behavior does not apply to certain flags, because Chrome
processes some of them based on the first occurrence, not the last. This
is the case for `--user-data-dir`, which is parsed very early during
Chrome startup.

The proposed code checks whether `--user-data-dir` was provided via
`web-browser-flag`, and if so, it uses that value instead of the default
`%temp%\flutter_tools_chrome_device.xpto` temporary directory.

This also resolve this comment:
flutter#104935 (comment)

Example: `launch.json`
```
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "flutter",
      "request": "launch",
      "type": "dart"
    },
    {
      "name": "flutter (profile mode)",
      "request": "launch",
      "type": "dart",
      "flutterMode": "profile"
    },
    {
      "name": "flutter (release mode)",
      "request": "launch",
      "type": "dart",
      "flutterMode": "release"
    },
    {
      "name": "Flutter for web (hot reloadable)",
      "type": "dart",
      "request": "launch",
      "program": "lib/main.dart",
      "args": [
        "-d",
        "chrome",
        "--web-port=5000",
        "--web-experimental-hot-reload",
        "--web-browser-flag=--user-data-dir=D:\\_Desenv\\flutter_tests\\chrome_profile"
      ]
    }
  ]
}
```

`chrome://version`

| Before | After  |
|--------|--------|
|
![before](https://github.com/user-attachments/assets/b3f33419-fbf1-446e-a471-745df2e8c4f6)
|
![after](https://github.com/user-attachments/assets/ea74a203-c269-4ce1-8a9b-f97e9a4cdc78)
|

Folder
| Before | After  |
|--------|--------|
|
![before_files](https://github.com/user-attachments/assets/8522e60b-d0eb-4b66-a4b6-c2d6ed34c15b)
|
![after_files](https://github.com/user-attachments/assets/ff94b498-b319-474c-89e5-c55f6e1c4383)
|

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
korca0220 pushed a commit to korca0220/flutter that referenced this pull request Sep 22, 2025
flutter#169445 was stale (not re-based),
causing a tree failure.

Let's just land this versus reverting.
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
…#169445)

### Respect user-data-dir flag from web-browser-flag

Currently, it's already possible to pass `web-browser-flag` when
launching Chrome, but the `user-data-dir` flag doesn't work as expected,
and there are some reasons for that.

In the implementation made in [PR
flutter#104935](flutter#104935), the
`web-browser-flag` is appended at the end of the Chrome launch
arguments.

For most scenarios, this works fine, as demonstrated in the Chrome unit
test below:

https://source.chromium.org/chromium/chromium/src/+/main:base/command_line_unittest.cc

```
TEST(CommandLineTest, MultipleSameSwitch) {
  const CommandLine::CharType* argv[] = {
      FILE_PATH_LITERAL("program"),
      FILE_PATH_LITERAL("--foo=one"),  // --foo first time
      FILE_PATH_LITERAL("-baz"),
      FILE_PATH_LITERAL("--foo=two")   // --foo second time
  };
  CommandLine cl(std::size(argv), argv);

  EXPECT_TRUE(cl.HasSwitch("foo"));
  EXPECT_TRUE(cl.HasSwitch("baz"));

  EXPECT_EQ("two", cl.GetSwitchValueASCII("foo"));
}
```
In this scenario, the parser will consider the last occurrence of a
flag.

However, this behavior does not apply to certain flags, because Chrome
processes some of them based on the first occurrence, not the last. This
is the case for `--user-data-dir`, which is parsed very early during
Chrome startup.

The proposed code checks whether `--user-data-dir` was provided via
`web-browser-flag`, and if so, it uses that value instead of the default
`%temp%\flutter_tools_chrome_device.xpto` temporary directory.

This also resolve this comment:
flutter#104935 (comment)

Example: `launch.json`
```
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "flutter",
      "request": "launch",
      "type": "dart"
    },
    {
      "name": "flutter (profile mode)",
      "request": "launch",
      "type": "dart",
      "flutterMode": "profile"
    },
    {
      "name": "flutter (release mode)",
      "request": "launch",
      "type": "dart",
      "flutterMode": "release"
    },
    {
      "name": "Flutter for web (hot reloadable)",
      "type": "dart",
      "request": "launch",
      "program": "lib/main.dart",
      "args": [
        "-d",
        "chrome",
        "--web-port=5000",
        "--web-experimental-hot-reload",
        "--web-browser-flag=--user-data-dir=D:\\_Desenv\\flutter_tests\\chrome_profile"
      ]
    }
  ]
}
```

`chrome://version`

| Before | After  |
|--------|--------|
|
![before](https://github.com/user-attachments/assets/b3f33419-fbf1-446e-a471-745df2e8c4f6)
|
![after](https://github.com/user-attachments/assets/ea74a203-c269-4ce1-8a9b-f97e9a4cdc78)
|

Folder
| Before | After  |
|--------|--------|
|
![before_files](https://github.com/user-attachments/assets/8522e60b-d0eb-4b66-a4b6-c2d6ed34c15b)
|
![after_files](https://github.com/user-attachments/assets/ff94b498-b319-474c-89e5-c55f6e1c4383)
|

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
flutter#169445 was stale (not re-based),
causing a tree failure.

Let's just land this versus reverting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fyi-web For the attention of Web platform team tool Affects the "flutter" command-line tool. See also t: labels. waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants