Commit Graph

2873 Commits

Author SHA1 Message Date
Alexander Markov 9297d718a1 Revert "[test_runner] Invoke tests with relative paths."
This reverts commit b5294b9753.

Reason for revert: many failures on appjit, reload and fuchsia bots

Failure Link: <LINK TO FAILURE>

Original change's description:
> [test_runner] Invoke tests with relative paths.
>
> This makes tests more reproducible, and makes it easier to copy commands between workspaces, or between a failing bot and a local workspace.
>
> Change-Id: Ic8dd10a3540f314a406e5c5b0a23d97032e5d01d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508364
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

Change-Id: Id7aa668c0609df65a5f622ae73013a15e7f9200e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/511400
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-06-11 08:08:41 -07:00
Ryan Macnak b5294b9753 [test_runner] Invoke tests with relative paths.
This makes tests more reproducible, and makes it easier to copy commands between workspaces, or between a failing bot and a local workspace.

Change-Id: Ic8dd10a3540f314a406e5c5b0a23d97032e5d01d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508364
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-06-10 15:30:26 -07:00
Yash(VictoWolf) 16441c6025 Clarify WebSocket.addError behavior
Document that WebSocket.addError does not transmit an error event to the
remote peer and only reports the error locally.

Changes:
* sdk/lib/_http/websocket.dart

Bug: dart-lang/sdk#45733
Change-Id: I8913ac4fb466e9d613b3f0c5f0727640c9d9a913
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/502500
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2026-05-29 08:23:06 -07:00
Nate Bosch b162f6717d [io] Fix FileSystemEntity.type and Link.exists with IOOverrides
Fixes #63418

When IOOverrides are active, `fseGetType` and `fseGetTypeSync` used
`utf8.encode(path)` which does not null-terminate the path. Native
APIs require null-terminated paths. Through luck the sync path worked
but the async path failed with `notFound`.

Update them to use `FileSystemEntity._toUtf8Array(path)` which correctly
null-terminates the path.

Tested: added a regression test to tests/standalone/io/io_override_test.dart

TAG=agy
CONV=ab6af504-d536-4a8d-88be-bc487b60e24d
R=bkonyi@google.com

CoreLibraryReviewExempt: No API changes.
Change-Id: I24e31efdcbecc703800b96a144e41a095a445cff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505201
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
2026-05-22 14:13:35 -07:00
Paul Berry 4b88e5ab0f Bump package:expect version in standalone package tests.
The tests in `tests/standalone/package/` don't use the top level
`package_config.json` file; they use their own internal file, which
apparently hasn't been updated recently. This change bumps the version
of `package:expect` in that file to version 3.13, which will allow
`package:expect` to start using Dart language 3.13 features without
breaking tests.

Change-Id: Ia2975d540aa503e8f69944e0e1c275c56a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505580
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-05-22 08:04:08 -07:00
peeefour 1d80afe498 [vm/io] Range check Socket_SendMessage arguments
Closes https://github.com/dart-lang/sdk/pull/63365

GitOrigin-RevId: 344604dd1a17b73c6665026e7e75693fe0fa7ca7
Change-Id: I8f51d5735a56564f2181bcd1206c9cfdff80f077
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/502960
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-05-13 03:40:04 -07:00
Alvin 7bc22cf877 [vm/io] Range check SynchronousSocket_WriteList arguments
Closes https://github.com/dart-lang/sdk/pull/63358

GitOrigin-RevId: 1a5eb0d7e11fca131a721cd0535954f96ac1dfaf
Change-Id: I670ebdd4fadef383872a9d719efa22d6479b812d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/502441
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-05-12 00:32:52 -07:00
mohammadmseet-hue 794b281da3 fix: cap uncompressed WebSocket frame size to prevent peer-induced OOM
Closes https://github.com/dart-lang/sdk/pull/63257

GitOrigin-RevId: 47b50221f808d62c660d855b10cc1f22981c996a
Change-Id: I8c42b12277982caf0da5a627dc8de12102595d0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498460
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-05-06 04:54:42 -07:00
Ivan Ugryumov 6dd8ad5397 Add InterfaceAddress for broadcast address support
Closes https://github.com/dart-lang/sdk/pull/63088

GitOrigin-RevId: c72afbbbf2774fd4c3c3f83b69c30e86e4302abd
Change-Id: I2462f006dcbe2256b019c5b13674ca0d93838fc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/492180
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-05-05 01:15:37 -07:00
mohammadmseet-hue 4d6c9b756c fix: reject Set-Cookie with SameSite=None but no Secure attribute
Closes https://github.com/dart-lang/sdk/pull/63254

GitOrigin-RevId: 18d7d0e46c31783ff200657c0f81d029e9a64231
Change-Id: I3019e7733b6e2a3e1634b6bb7f8bb5e17be35d4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498423
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-05-05 00:53:33 -07:00
Kallen Tu 8bfb683892 Enable 'primary-constructors' feature flag.
This CL enables the primary constructors feature by default in Dart 3.13.

The primary constructors feature is a brevity feature. There are no new semantics, but it allows us to express declarations in a less verbose way.

This feature allows one constructor and a set of instance variables to be specified in the header of a declaration.

Currently a declaration with a constructor and some fields is written as:

```dart
// Current syntax.
class Point {
  int x;
  int y;
  Point(this.x, this.y);
}
```

With a primary constructor, we would write the above as:

```
class Point(var int x, var int y);
```

If a primary constructor needs an initializer list or a body, they can be
specified inside the class using the `this` body syntax:

```dart
class Point(var int x, var int y) {
  this : assert(x >= 0) {
    print('Point created at $x, $y');
  }
}
```

As part of this feature, you can also use the `new` and `factory` keywords to
declare constructors in the class body without repeating the class name:
```dart
class Point {
  int x, y;

  // Equivalent to Point(this.x, this.y)
  new(this.x, this.y);

  // Equivalent to Point.origin()
  new origin() : x = 0, y = 0;

  // Equivalent to factory Point.clone(Point other)
  factory clone(Point other) => Point(other.x, other.y);
}
```

To learn more about the feature, check out the feature specification located here: https://github.com/dart-lang/language/blob/main/accepted/future-releases/primary-constructors/feature-specification.md

Tested: Has existing language, CFE, analyzer, analysis server tests.
Bug: https://github.com/dart-lang/sdk/issues/61524
Change-Id: I296f2fcd918b87bf2a1dd00256340759866c2423
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489241
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2026-05-04 15:09:49 -07:00
mohammadmseet-hue c5d23e0df3 fix: HTTP request smuggling via Transfer-Encoding token whitespace
Closes https://github.com/dart-lang/sdk/pull/63250

GitOrigin-RevId: 7c6b7bf7d033dd31dc23a7cc3a30b3dc4db41d16
Change-Id: I573328660bbef7ec9cd829ec376fcee894a6bc34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498420
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-04-30 00:52:02 -07:00
mohammadmseet-hue 890f7e8aa9 fix: do not forward Authorization/Cookie to subdomains on redirect
Closes https://github.com/dart-lang/sdk/pull/63256

GitOrigin-RevId: 1cf4d94690343b4df087e7c583154a36580fff71
Change-Id: I186e9338e36ee72714d385444e6fbf3b217ec4ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498424
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2026-04-29 00:54:05 -07:00
mohammadmseet-hue 75479bc7a7 fix: reject HTTP requests with Transfer-Encoding not ending in chunked
Closes https://github.com/dart-lang/sdk/pull/63251

GitOrigin-RevId: 55ef08553ee65ab1052a46b92ff57f097863c340
Change-Id: Ibd3e93b553e046962bba36ec683b0d2bb157b264
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498401
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-04-27 23:59:39 -07:00
Lasse R.H. Nielsen ab434651fa Fix cookie-date parsing to use the correct algorithm.
A prior parser change made the parsing more restrictive,
only accepting the dart formats that a cookie creator should
produce, rather than what the RFC specifies should be accepted.

Now implements the specified algorithm again.

Bug: https://github.com/dart-lang/sdk/issues/62721

Prior over-optimisitc breaking change: https://dart-review.googlesource.com/c/sdk/+/448383

Change-Id: I4ed7cf2368d04063e0fc563ff8e64904bf0d3e1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496080
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2026-04-22 06:13:58 -07:00
Brian Quinlan 8b6c67a4ba [io]: Fixes a redirect credential leak and a HTTP request smuggling issue.
1. The redirect credential leak was caused because the arguments to `shouldCopyHeaderOnRedirect` were passed in the wrong order
2. The HTTP request smuggling was caused by incorrect identification of chunked transfer encoding.

Closes https://github.com/dart-lang/sdk/pull/63133

GitOrigin-RevId: 1e6189fd7cd7b0360566f01d02c82a71de5d0f0a
Change-Id: I7c76615d12b6dac8888c1cdc3a6cab46199f6b0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493600
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-04-08 13:31:32 -07:00
Lasse R.H. Nielsen 56505e0575 Stop using Match.group.
The `Match.operator[]` does the same thing and is
generally recommended (and shorter).
(I want to deprecate `group` and `groups`)

Tested: Refactoring.
CoreLibraryReviewExempt: Calling equivalent function.
Change-Id: I4c758968ae622fe16b7322be1b29b05b91e7fcd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/489021
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2026-03-20 09:09:46 -07:00
Alexander Markov 8c7ef075a9 [tests] Skip standalone/file_system_watcher_isolate_exit_leak_test on sanitizer bots
Memory allocation and access by sanitizers affects RSS in unpredictable
way, which confuses RSS measurements in this test.

Closes https://github.com/dart-lang/sdk/issues/62569

Change-Id: Ice38677d084e93c1b5deda20d68414a119c678db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/485840
Commit-Queue: Alexander Aprelev <aam@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2026-03-05 08:11:22 -08:00
Colton Grubbs 6c587065a2 [io/http] Fix race condition where RawSecureSocket dispatches read events after shutdown
Closes https://github.com/dart-lang/sdk/pull/62520

GitOrigin-RevId: d2bdfac991eb2427530a52b6f3cc26f5577fdf2d
Change-Id: Ib1a6620af1710d682ea46620517a3b1363eb2bd3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/475941
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2026-03-02 01:47:04 -08:00
Ryan Macnak e443b89f23 [vm] Update Irregexp to V8 commit 254cc758346f10be2a7e22e55d90d4defe9cad74.
Includes support for modifier spans and duplicate named capture groups.

Drops the flow graph implementation to ease maintenance.

TEST=corelib/regexp
Bug: https://github.com/dart-lang/sdk/issues/56573
Bug: https://github.com/dart-lang/sdk/issues/61337
Bug: https://github.com/dart-lang/sdk/issues/62349
Bug: https://github.com/dart-lang/sdk/issues/62708
Change-Id: I05640ba945a4fa5476e7ad463738f4f39d842c14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480121
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-02-23 09:54:47 -08:00
Ryan Macnak eae5349c23 [test] Remove asserts that currentRss <= maxRss.
The underlying syscalls and proc reads that produce these values may produce inaccurate values.

Bug: https://github.com/dart-lang/sdk/issues/62715
Change-Id: I508db7722a4ab2536848742155ef5631533b58dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/481580
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-02-18 14:26:51 -08:00
Lasse R.H. Nielsen 6fe105671c Remove var and final from parameters in test/.
Not removing from any file with a language marker.
Also not touching anything in `tests/language/primary_constructors`
or `.../private_named_parameters`, which are both assumed to be
primary constructor feature aware.

Two files rewritten from multi-test to error-test.

Change-Id: I43d444a35a41c7734f266794e9f167655692473f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480640
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2026-02-17 08:28:57 -08:00
Slava Egorov 25ffce7e36 [vm/win] Avoid unnecessary consoles for dartvm.exe
If dart.exe is not attached to the console then it should spawn
dartvm.exe detached to avoid creating an unnecessary console
window.

Fixes https://github.com/dart-lang/build/issues/4312

TEST=standalone/io/windows_no_unnecessary_console_test

Change-Id: I1de65accca5e28f3cfbe44a70f782525f0059bf0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/475000
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2026-01-22 08:17:43 -08:00
Ryan Macnak 97a00247f8 [test] Disable TSAN thread leak detection for more tests that call exit.
Cf. cee7000c1a.

TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/62405
Change-Id: I03d6bd34e57c249f0e62ae87179614b9871e0436
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/474483
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-01-20 14:47:53 -08:00
Alexander Aprelev 026bb7cfeb [vm/gardening] Handle child process racing to exit.
Writing to stdin of already exited child process might not raise an error, will cause infinite loop in the test.

Fixes https://github.com/dart-lang/sdk/issues/56400
TEST=ci

Change-Id: I0100b5e5d782ae3682d634a47759b78146243274
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/473821
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2026-01-16 13:00:40 -08:00
Slava Egorov 7b5bd07e87 [vm/io] Fix pausing read on SecureSocket
Pausing read on the SecureSocket should pause read on the underlying
socket, because otherwise we will be stuck calling _readHandler
which will not read anything but still schedule an SSL filter
wasting CPU time.

Fixes https://github.com/dart-lang/sdk/issues/62037

CoreLibraryReviewExempt: No API changes, VM specific implementation change
Change-Id: I4144815d34c1e77a68533b6ebcb66c146a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467804
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2026-01-07 03:41:35 -08:00
Ryan Macnak cee7000c1a [test] Enable TSAN thread leak detection for most tests.
Disable for tests that use dart:io's exit.

Add missing thread joins to cc tests.

TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/41811
Change-Id: Id4e1a468a986c886fb5ae9e9677b4d8d0281cc79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468880
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2026-01-05 10:04:25 -08:00
Ben Konyi 4cbf367b94 [ dart2bytecode ] Skip more tests that depend on dart:mirrors
Change-Id: I3dadc31c7cb2ba351ec797d8a851d82bf5bab232
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468920
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2025-12-17 11:54:43 -08:00
Slava Egorov 9bf1f2529a [vm/io] Fix crashes in Socket.setOption
Don't call native methods on a socket which is closed
or in process of being closed. On some OSes this will
crash the VM because underlying FD is actually a malloc
allocated handle object which will be destroyed by 
the event handler once it receives and processes close
request.

BUG=b/335437875
TEST=standalone/io/abrupt_close_test

Change-Id: I557d725a6cce020a6a1e3df0bd3e2c836a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467841
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2025-12-15 02:31:18 -08:00
Brian Quinlan c847a7bf43 test: Fix many_pending_secure_sockets_test timeouts.
Bug:https://github.com/dart-lang/sdk/issues/62064
Change-Id: Ie3aafd9549d7c26494faa7dddba85025e4b2cb69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465462
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-12-03 13:24:32 -08:00
Martin Kustermann 42658764a4 [gardening] Skip standalone/file_system_watcher_isolate_exit_leak_test on Linux/Android
Change-Id: Ia2779fa51d7c06cffe45a2cdf9f550bf7e2a6ab0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461360
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2025-11-12 01:07:40 -08:00
Slava Egorov e50d3b98a3 [io] Support Unix domain sockets on Windows
Basic support for Unix domain sockets on Windows within
the limitations of the operating system itself: no 
support for abstract addresses, datagram or 
packet sockets and ancillary data.

This also fixes File::GetType on Windows to correctly
identify reparse points representing AF_UNIX sockets
as such, rather then identify them as links.

Finally, it is worth noting that there is an existing
discrepancy between POSIX OSes and Windows: on POSIX OSes
File(sockPath).existsSync() returns true, but on Windows the 
same code returns false because Unix domain sockets are not 
considered regular files by stat. 

This CL does a bunch of refactoring around RawAddr class which
surves as a wrapper around various structures in sockaddr_* family.
Distinguishing anonymous AF_UNIX address from abstract AF_UNIX
address requires passing around the length of the address
structure. Thus we incorporate this information into
RawAddr. This will also make possible to properly support
full-range of abstract AF_UNIX addresses in the future because
supporting these requires properly handling embedded NUL bytes.
(See https://github.com/dart-lang/sdk/issues/46158).

Fixes https://github.com/dart-lang/sdk/issues/41161

TEST=standalone/io/unix_socket

Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-x64-try
Change-Id: I016cb33ebdd62f0cac1ae97d822105366a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/457720
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2025-10-29 05:25:24 -07:00
Alexander Markov ef64f00982 [tests] Print sub-process output in standalone/io/process_working_directory_test
This test runs sub-process and sometimes fails because sub-process has
an unexpected exit code. This is an attempt to get more information
about the cause of such failures.

Issue: https://github.com/dart-lang/sdk/issues/61713

Change-Id: I38eff88b0f94058510078e6e4862d2ad56df2dd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/454320
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-10-09 09:24:43 -07:00
Slava Egorov c70a4b08a2 [io] Fix Mac OS X file watcher
Fixes bug in commit 25df2b3f11.

The code for converting FSEventStream notification into Dart format 
was checking file existence using relative path instead of absolute
path. This caused it to incorrectly classify rename events which
were creations as deletions.

This was not caught by testing because this was not well covered
by the test and the test closest to checking this was even 
disabled on Mac. CL updates updates the test to cover this better. 

Fixes https://github.com/dart-lang/sdk/issues/61693

TEST=standalone/io/file_system_watcher_test

Change-Id: I2a7c984dfcec0be74c974f13b6ead7d86a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453880
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-10-08 02:25:17 -07:00
Ryan Macnak 6938441679 [build] Increase android_api_level from 21 to 24.
Bug: https://github.com/dart-lang/sdk/issues/61664
Change-Id: I10a99fbe03df32f056765913e75f14b63bc33bc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453681
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-10-07 13:17:21 -07:00
Slava Egorov ed6bab847b [io] Rewrite _FileSystemWatcher implementation
Existing implementation is an entangled mess which consists of shared
code residing in the base class which in random places invokes a number
of undocumented poorly named methods overloaded in OS specific
subclasses. Some of these methods mutate static state. There are no
clear lifetime guarantees for different parts of the system (including
comments saying that some values might or might not be valid at certain
points).

The rewrite aims to clean most of this up - sharing everything that can
be shared and moving OS specific logic to clearly documented methods.

Furthermore, we change the code to ensure proper lifetime guarantees -
so we no longer find ourself in situations where we don't know whether
pathId is valid or not.

This refactoring by itself fixes a number of issues, most specifically a
bug where watcher would stop receiving events on Windows because
DirectoryWatchHandle ends up allocated at precisely the same address as
a previous destroyed one - which confuses Dart side to think that newly
created handle is the same as the old one (due to a race between event
handler thread and Dart thread).

We fix Windows lifetime issue by a) not keeping pathId based mapping in
the watcher anymore and b) keeping DirectoryWatchHandler alive until it
is stoped by the Dart side - this is achieved by retaining it after it
is created and releasing it once path is unwatched. This way Dart side
is always sure that pathId values are valid until they are explicitly
released via _unwatchPath - which makes code very uniform.

To make sure that native objects created by _watchPath are released when
surrounding isolate exists abruptly (e.g. via Isolate.exit - without
letting Dart code to shutdown and call _unwatchPath naturally) we attach
NativeFinalizer to them. This fixes the existing leak of file watchers
on Mac OS X - as Node objects it created were not freed if surrounding
isolate exited. Note that inotify descriptors did not leak in the same
way because they were wrapped into sockets.

Finally, this refactoring also make sure that the last subscriber
cancelling subscription on filesystem event stream will get a proper
cancellation future back and can wait for the watcher to shutdown.
Previously implementation used broadcast streams which simply return an
already completed future when subscriber cancels. New implementation
uses Stream.multi instead which gives a better result. Now doing
watch().listen().cancel() returns a future which will only complete once
watcher is fully disposed (e.g. inotify descriptor is closed). Bad
behavior was revealed by analysing standalone/regress_52715 - which
revealed that repeatedly watching and cancelling might flakely cause us
to hit fd limit depending on whether eventhandler thread can keep up
closing file descriptors created by the main thread or not.

Fixes https://github.com/dart-lang/sdk/issues/61378

TEST=standalone/{regress_61378,file_system_watcher_isolate_exit_leak}

CoreLibraryReviewExempt: VM only changes.
Change-Id: I6a6a69642b1f2673f2be78434bc64270846ad8c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/450921
Reviewed-by: Lasse Nielsen <lrn@google.com>
2025-10-01 11:28:05 -07:00
Lasse R.H. Nielsen c6e64057ee Fix bug in HTTP header parameter value parsing.
The `preserveBackslash` flag should preserve
backslashes before any non-`"` character,
not before any non-`\` character.

Change-Id: I3270f3b1b6c678e712e27a1cf4557558c883610b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452781
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
2025-10-01 08:15:02 -07:00
Ryan Macnak c850242ef9 [test] Remove use of package:test from standalone tests.
Bug: https://github.com/dart-lang/sdk/issues/61548
Change-Id: I7a4d562a88d5d2f4ca2245e924411042ec463c37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452544
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2025-09-30 15:43:42 -07:00
Alexander Markov 1f89a5e623 [vm,dyn_modules] Disable dart:mirrors in standalone VM when using interpreter
Bytecode doesn't fully support dart:mirrors and support for
dart:mirrors is already disabled in dart2bytecode.

This change disables dart:mirrors in the standalone VM running with
--interpreter flag and updates status files.

TEST=ci

Change-Id: Id9423bafb10926e8274835b77a6f50a825ad7fd7
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try,vm-ffi-dyn-mac-debug-simarm64_arm64-try,vm-ffi-dyn-mac-release-simarm64_arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/451580
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-09-29 11:04:13 -07:00
Lasse R.H. Nielsen 97909b6bca Update the cookie and cookie-date parsers.
Avoid doing unnecessary allocations,
don't use `String.operator[]` to access single characters,
or creating substrings that are not needed.

Reuse the date-parser for cookie dates, instead of having two
separate parsers. The cookie-date-parser was very forgiving,
and only tested very little.
It's unlikely that there will be wildly different cookie formats
in actual use, when the specification only allows for one format.

Change-Id: I81b3620cc4476af3584b859f9c1eb80362f83979
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/448383
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2025-09-25 07:05:00 -07:00
Martin Kustermann 48cc23ed13 [gardening] Mark vm/dart/regress47472_test on TSAN
It seemingly flakily times out om mac under TSAN

Change-Id: I2e030756bfb353b8e2044c4ad676c50d2ff9f003
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/449122
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-09-11 03:28:16 -07:00
Ben Konyi 8e5195c3c5 [ dart:io ] Added override for exit(...) in IOOverrides
This will allow for `package:test` to handle test cases which call
`exit(...)` without the test suite being aborted due to the VM shutting
down.

See https://github.com/dart-lang/test/issues/2248

Change-Id: I09e78460d2b87ba7ea755d7538a1446ecb566d0b
CoreLibraryReviewExempt: Only adds override behavior, does not change API surface.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377380
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2025-08-12 08:32:06 -07:00
asiva 6fcb3d394e Fix for https://github.com/dart-lang/sdk/issues/61206
Ensure Platform.executable is not resolved.

TEST=new test case added

Bug: 61206
Change-Id: I0522869f57d519168542b453dc2e827d9d5e6486
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442942
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-08-01 11:11:18 -07:00
Ben Konyi 2550dadaa2 [ dart:io ] Breaking change: mark IOOverrides as abstract base
Fixes https://github.com/dart-lang/sdk/issues/56468

CoreLibraryReviewExempt: Only impacts dart:io
Change-Id: I529ac7bbb50640cb1a0fba967cf0bcc6e3bb52aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389520
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Jessy Yameogo <yjessy@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
2025-08-01 08:19:40 -07:00
asiva ab44b20ab8 Reapply "[VM/dartdev] Switch dartdev to use an AOT runtime." and
Add the fixes that were done after original CL landed.

This reverts commit 97bc401163.

TEST=ci

Change-Id: I26373aecc325e4c0c379c92e779aa301e3a58c5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441700
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2025-07-24 14:48:03 -07:00
asiva ff05b45f5c Address code review comment.
TEST=ci

Change-Id: I778069c914146752f1f1e37dfdd11f71bff3e3a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441860
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-07-23 12:58:52 -07:00
Brian Quinlan a2ff602e37 Fix pipe copy test broken by https://dart-review.googlesource.com/c/sdk/+/439823
Change-Id: I8146922de576a080d66959a8aba9192b1c4edf7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439981
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2025-07-11 15:56:27 -07:00
Brian Quinlan 15a00898af Add the ability to copy pipes using File.Copy
Bug:https://github.com/dart-lang/sdk/issues/60999
Change-Id: I2e20ad5c051b43582483d5275d6d2b65b6f3395a
Tested: unit
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439823
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-07-10 18:28:01 -07:00
asiva 97bc401163 Revert "[VM/dartdev] Switch dartdev to use an AOT runtime."
This reverts commit 5399dbf6f6.

Reason for revert : Flutter rolls are failing

TEST=ci

Change-Id: I76fede849705514496adbc2ab7f6c262de4103ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439661
Reviewed-by: Jason Simmons <jsimmons@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2025-07-09 23:08:28 -07:00
Ryan Macnak 5a37b79a57 [test] Ignore failures from the remote side closing the socket in test of handling many pending connections.
TEST=standalone/io/many_pending_secure_sockets_test
Bug: https://github.com/dart-lang/sdk/issues/61072
Change-Id: I9ce7130db90c8b04f832a4c4ee7ccdaec97126d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439546
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-07-09 13:47:35 -07:00