490 Commits

Author SHA1 Message Date
Andrew Kushnir 89b391c245 test(zone.js): reduce flakiness of a timer-related test (#59653)
This commit updates a flaky test to increase the amount of work (more `for` loop iterations) to minimize the chance of getting the same timestamp after that work.

PR Close #59653
2025-01-21 13:20:24 -08:00
hawkgs 3e7ba3d014 docs: set syntax highlighting to the remaining Markdown code examples blocks (#59088)
There are some code blocks that slipped through the initial Regex-es.

Related to #59026

PR Close #59088
2025-01-14 15:14:03 -05:00
Angular Robot 3913893ef4 build: lock file maintenance (#59519)
See associated pull request for more information.

Closes #59494 as a takeover pull request

PR Close #59519
2025-01-14 14:44:30 -05:00
Johnson Chu a6cdbec09f refactor: remove unnecessary TSLint rule flags (#59365)
There are many TSLint rule flags in the source code that have no effect, and they can be safely removed to keep the code clean.

PR Close #59365
2025-01-07 16:06:21 +00:00
Angular Robot 8eb8af5217 build: lock file maintenance (#59291)
See associated pull request for more information.

PR Close #59291
2025-01-06 22:23:08 +00:00
Angular Robot b4f38e5d47 build: lock file maintenance (#59202)
See associated pull request for more information.

PR Close #59202
2024-12-16 15:22:38 -08:00
Angular Robot 2beb374524 build: lock file maintenance (#59110)
See associated pull request for more information.

PR Close #59110
2024-12-10 13:43:27 -08:00
Angular Robot 392c036e5e build: update dependency mocha to v11 (#59012)
See associated pull request for more information.

PR Close #59012
2024-12-03 12:21:45 +01:00
Angular Robot e305b45627 build: lock file maintenance (#58998)
See associated pull request for more information.

PR Close #58998
2024-12-02 16:29:03 +01:00
Utku Gultopu 0f1c71869e docs: capitalize webpack with a lowercase W (#56812)
PR Close #56812
2024-11-26 22:24:11 +00:00
Angular Robot a534fa5f46 build: lock file maintenance (#58867)
See associated pull request for more information.

PR Close #58867
2024-11-25 15:21:02 +00:00
Angular Robot aca8cc0e16 build: lock file maintenance (#58711)
See associated pull request for more information.

PR Close #58711
2024-11-22 14:46:21 +00:00
Angular Robot 48be715878 build: lock file maintenance (#58450)
See associated pull request for more information.

PR Close #58450
2024-11-07 21:29:52 +00:00
Costin Sin 2e54d6dea8 refactor(zone.js): Change the type of _taskCounts to an IndexSignature that can have keys (#51739)
named as the values of the `TaskType` type.

The Closure Compiler used at Google has a property renaming optimization
that can change the property names when minifying code. Having the
correct type helps the TSJS team that develops a tool to identfy
property renaming issues directly in TypeScript.

Signed-off-by: Costin Sin <sin.costinrobert@gmail.com>

PR Close #51739
2024-11-01 15:44:06 +00:00
Alan Agius 01fcbafa2b build: update cross-repo angular dependencies (#58446)
See associated pull request for more information.

Closes #57880 as a pr takeover

PR Close #58446
2024-10-31 19:05:01 +01:00
arturovt 69763491c3 fix(zone.js): remove abort listener once fetch is settled (#57882)
This commit updates the `fetch` patch for zone.js. Currently, we're attaching an
`abort` event listener on the signal (when it's provided) and never removing it.
We should be good citizens and remove event listeners whenever objects need to be
properly collected. In Firefox, when saving a heap snapshot and running it through
`fxsnapshot`, querying `AbortSignal` will print a so-called "CaptureMap" with a list
of "lambdas," indicating that the signal is not garbage collected because of the event
listener lambda function.

PR Close #57882
2024-10-07 08:27:53 -07:00
arturovt 8ce190b1b7 docs(zone.js): update docs to enable beforeunload (#57881)
In this commit, we update the documentation to reflect the property that allows
enabling the default browser `beforeunload` handling, which was added in a
previous commit.

Additionally, some cosmetic grammar changes have been made in this documentation,
as the previous text had some issues.

Closes #52256

PR Close #57881
2024-10-04 10:55:00 -07:00
Joey Perrott 9dbe6fc18b refactor: update license text to point to angular.dev (#57901)
Update license text to point to angular.dev instead of angular.io

PR Close #57901
2024-09-24 15:33:00 +02:00
Kristiyan Kostadinov e608e6cfbb fix(zone.js): more robust check for promise-like objects (#57388)
Fixes that Zone.js wasn't checking properly if an object is promise-like.

Fixes #57385.

PR Close #57388
2024-08-23 12:58:29 -07:00
Andrew Kushnir d1d4adcba2 release: cut the zone.js-0.15.0 release (#57418)
PR Close #57418
2024-08-21 11:30:53 -07:00
Angular Robot 24cd1c8db6 build: lock file maintenance (#57340)
See associated pull request for more information.

PR Close #57340
2024-08-12 11:22:43 -07:00
Matthieu Riegler e1240c6f5d fix(zone.js): Add support for addition jest functions. (#57280)
This commit add support for `test.failing` and `it.failing`.

Fixes #57277

PR Close #57280
2024-08-07 18:13:51 +00:00
Andrew Scott 70e8b40750 fix(zone.js): Update the default behavior of fakeAsync to flush after the test (#57240)
From the internal issue on the matter:

> When using the standard Jasmine version of it promises returned by the body function are automatically awaited. The Catalyst version of it is fake-async, so awaiting the promise does not make sense; however it would be nice if Catalyst automatically flushed the promise to replicate the experience of using standard it. This would allow users to do the following:

```
it('should fail later', async () => {
  await new Promise(r => setTimeout(r));
  fail('failure');
});
```
> In Catalyst today the above test will pass. If this proposal to automatically flush the resulting promise were implemented it would fail.

Flushing after the tests complete has been the default behavior inside
Google since 2020. Very few tests remain that use the old behavior of
only flushing microtasks. The example above would actually fail with
`fakeAsync` due to the pending timer, but the argument still remains the
same. We might as well just flush if we're going to fail the test
anyways by throwing if there's no flush at the end.

BREAKING CHANGE: `fakeAsync` will now flush pending timers at the end of
the given function by default. To opt-out of this, you can use `{flush:
false}` in options parameter of `fakeAsync`

PR Close #57240
2024-08-05 20:24:54 +00:00
Jessica Janiuk de99d3eb3e release: cut the zone.js-0.14.10 release (#57264)
PR Close #57264
2024-08-05 17:00:06 +00:00
Angular Robot dbca467a35 build: lock file maintenance (#57256)
See associated pull request for more information.

PR Close #57256
2024-08-05 14:42:24 +00:00
Andrew Scott 99d679d606 feat(zone.js): Add 'flush' parameter option to fakeAsync to flush after the test (#57137)
From the internal issue on the matter:

> When using the standard Jasmine version of it promises returned by the body function are automatically awaited. The Catalyst version of it is fake-async, so awaiting the promise does not make sense; however it would be nice if Catalyst automatically flushed the promise to replicate the experience of using standard it. This would allow users to do the following:

```
it('should fail later', async () => {
  await new Promise(r => setTimeout(r));
  fail('failure');
});
```
> In Catalyst today the above test will pass. If this proposal to automatically flush the resulting promise were implemented it would fail.

Flushing after the tests complete has been the default behavior inside
Google since 2020. Very few tests remain that use the old behavior of
only flushing microtasks. The example above would actually fail with
`fakeAsync` due to the pending timer, but the argument still remains the
same. We might as well just flush if we're going to fail the test
anyways by throwing if there's no flush at the end.

PR Close #57137
2024-08-02 16:52:07 +00:00
Paul Gschwendtner 2d314865c8 build: lock file maintenance (#57205)
See associated pull request for more information.

PR Close #57205
2024-07-31 16:02:11 +00:00
Alan Agius 658c7fe42d docs: fix changelog entry (#57038)
The entry incorrectly included a link.

PR Close #57038
2024-07-18 11:12:29 -07:00
Andrew Scott d97aee6dc2 release: cut the zone.js 0.14.8 release (#57030)
PR Close #57030
2024-07-17 14:03:01 -07:00
Alan Agius 982f1b1251 fix(zone.js): support Timeout.refresh in Node.js (#56852)
The `Timeout` object in Node.js has a `refresh` method, used to restart `setTimeout`/`setInterval` timers. Before this commit, `Timeout.refresh` was not handled, leading to memory leaks when using `fetch` in Node.js. This issue arose because `undici` (the Node.js fetch implementation) uses a refreshed `setTimeout` for cleanup operations.

For reference, see: https://github.com/nodejs/undici/blob/1dff4fd9b1b2cee97c5f8cf44041521a62d3f133/lib/util/timers.js#L45

Fixes: #56586

PR Close #56852
2024-07-16 12:46:51 -07:00
arturovt b8d5882127 fix(zone.js): allow enabling default beforeunload handling (#55875)
Prior to this commit, when zone.js was included, it wasn't possible to handle `beforeunload`
events correctly if event handlers returned strings to prompt the user.

With this change, we introduce a global configuration flag,
`__zone_symbol__enable_beforeunload`, to allow consumers to enable the default
`beforeunload` handling behavior.

This flag is necessary to prevent any breaking changes resulting from this modification.
The previous attempt to fix it caused a large number of failures in G3. Hence, we're
hiding that fix behind the configuration flag.

Closes #47579

PR Close #55875
2024-06-12 13:06:21 -07:00
Angular Robot 6ca056532a build: lock file maintenance (#56361)
See associated pull request for more information.

PR Close #56361
2024-06-10 13:54:11 -07:00
Jessica Janiuk 181ed2a84a release: cut the zone.js-0.14.7 release (#56306)
PR Close #56306
2024-06-06 13:40:34 -07:00
Dylan Hunn 117a26bac3 docs(zone.js): update release guide for zone.js (#55846)
Update the releasing guide for zone.js, because one of the release commands was outdated.
PR Close #55846
2024-06-05 19:33:27 +00:00
arturovt 4a3800a6a0 fix(zone.js): store remove abort listener on the scheduled task (#56160)
Prior to this commit, a memory leak occurred when the `abort` listener was
not removed from the `AbortSignal`. We introduced a fix to remove the event
listener, but it was erroneously stored on the `taskData`, which is a shared
global object. Consequently, when something attempted to remove an event listener,
it immediately removed the last stored abort listener. As a result, events would
never be canceled.

We have now rectified this by storing the remove abort listener function directly on
the task itself. This adjustment ensures that the abort listener is tied only to the
specific task. When the `abort` function is called, it cancels the task. Therefore, it
is safe to associate the cleanup function directly with the task.

Closes: #56148

PR Close #56160
2024-06-04 17:29:05 +00:00
arturovt 85c171920a fix(zone.js): do not mutate event listener options (may be readonly) (#55796)
Prior to this commit, event listener options were mutated directly, for example,
`options.signal = undefined` or `options.once = false`.

This issue arises in apps using third-party libraries where the responsibility lies
with the library provider. Some libraries, like WalletConnect, pass an abort controller
as `addEventListener` options. Because the abort controller has the `signal` property,
this is a valid case. Thus, mutating options would throw an error since `signal`
is a readonly property.

Even though zone.js is being deprecated as Angular moves towards zoneless change detection,
this fix is necessary for apps that still use zone.js and cannot migrate to zoneless change
detection because they rely on third-party libraries and are not responsible for the code
used in them.

Closes #54142

PR Close #55796
2024-05-22 16:20:34 -07:00
Dylan Hunn 13601105ec release: cut the zone.js-0.14.6 release (#55845)
PR Close #55845
2024-05-16 17:32:14 -07:00
Alan Agius 20a530acb6 fix(zone.js): correctly bundle zone-patch-rxjs (#55826)
https://github.com/angular/angular/pull/53443 caused the a local `rxjs` file to be imported from an entry-point which caused this to be excluded from being bundled due to the name matching `rxjs`.

Closes #55825

PR Close #55826
2024-05-16 09:21:17 -07:00
Alan Agius f3b0e2fbc1 refactor(zone.js): remove tslib from dependencies (#55827)
Iif needed `tslib` code is included directly in the bundled FESM2015 hence making the dependency redundant.

PR Close #55827
2024-05-16 09:15:19 -07:00
Andrew Kushnir 0eade1c4db docs: add a note about development status of zone.js (#55746)
PR Close #55746
2024-05-14 10:53:43 -07:00
Kristiyan Kostadinov aa8df1d029 refactor(core): clean up clang comments and workarounds (#55750)
Since we aren't using clang anymore, we can remove the comments and the workarounds that were in place to prevent it from doing the wrong thing.

PR Close #55750
2024-05-13 11:10:36 -07:00
arturovt a9460d08a0 fix(zone.js): remove abort listener on a signal when actual event is removed (#55339)
This commit updates the implementation of the `addEventListener` patcher.

We're currently creating an abort event listener on the signal (when it's provided)
and never remove it. The abort event listener creates a closure which captures `task`
(tasks capture zones and other stuff too) and prevent `task`, zones and signals from
being garbage collected.

We now store the function which removes the abort event listener when the actual event
listener is being removed. The function is stored on task data since task data is already
being used to store different types of information that's necessary to be shared between
`addEventListener` and `removeEventListener`.

Closes #54739

PR Close #55339
2024-05-07 08:07:33 -07:00
Angular Robot 7898957b9d build: lock file maintenance (#55680)
See associated pull request for more information.

PR Close #55680
2024-05-06 12:32:18 -07:00
arturovt 9e07b621ea fix(zone.js): add missing APIs to Node.js fs patch (#54396)
This commit updates the list of Node.js `fs` APIs to be patched because
they haven't been updated for a long time. It adds `opendir,lutimes,writev`.
For example, the `opendir` method was added to Node.js in version 12.12.0 in
2019, causing some of the APIs to potentially be always called within the
`<root>` context.

**Note:** There are missing unit tests for these changes because in unit tests,
`fs` is patched by Bazel's Node.js rules and its `node_patches.cjs`. However,
the APIs are successfully patched in the real production code and are called
with the correct context.

PR Close #54396
2024-05-03 08:03:25 -07:00
Doug Parker 3312727aec refactor(zone.js): use Object.prototype.toString directly for improved tree shakability (#55412)
These lines were not tree shakable by Closure Compiler because `.toString()` is special cased as a "pure" function eligible to eliminated if it's return value is unused. However `.toString.call` circumvents this and makes Closure Compiler think the function may have side effects. Switching to `.toString()` should be fine here as `process.toString()` in Node outputs `[object process]` so this should be safe. Presumably the original motivation for this roundabout approach was for type safety reasons which no longer apply as `_global` is `any`.

PR Close #55412
2024-04-30 14:06:43 -07:00
Angular Robot 2ac54f8327 build: lock file maintenance (#55575)
See associated pull request for more information.

PR Close #55575
2024-04-30 14:03:59 -07:00
Andrew Kushnir ff656691c3 release: cut the zone.js-0.14.5 release (#55599)
PR Close #55599
2024-04-30 13:51:16 -07:00
Joey Perrott fd544159e3 ci: complete migration to prettier formatting (#55580)
Format the remaining unformatted files in the repository

PR Close #55580
2024-04-29 14:00:16 -07:00
Joey Perrott f307e95459 refactor: migrate zone.js to prettier formatting (#55427)
Migrate formatting to prettier for zone.js from clang-format

PR Close #55427
2024-04-29 09:52:05 -07:00
Angular Robot 86967af904 build: lock file maintenance (#55343)
See associated pull request for more information.

PR Close #55343
2024-04-23 13:37:56 -07:00