Commit Graph

15582 Commits

Author SHA1 Message Date
SkyZeroZx 870a525bd3 test(platform-server): clean up viewport hydration observer
Trigger routed viewport hydration so its cached observer is removed before later randomized specs run.
2026-08-12 11:04:40 -07:00
Matthieu Riegler f1c0c405c9 refactor(compiler): remove explicit strict: true
This flag is set by default in TS 6.0
2026-08-12 11:03:53 -07:00
SkyZeroZx 435f8b2b8b fix(router): limit protocol-relative URL handling to serialization
Preserve createUrlTree command semantics, including custom serializer inputs, while keeping the single-leading-slash guarantee at the default serialization boundary.

Expand coverage for command forms, public UrlTree values, secondary outlets, and preserved query parameters and fragments.

Fixes #69700
2026-08-11 12:07:31 -07:00
Andrew Scott b65dea4f03 feat(router): allow throwing RedirectCommand to trigger redirects
This allows developers to throw a `RedirectCommand` directly from guards and resolvers to trigger a redirect.

The primary benefit is that we no longer need to pollute the return type of functions that redirect. For example, a deeply nested helper function or a resolver can now simply throw a `RedirectCommand` to short-circuit and redirect, instead of having to return the `UrlTree` or `RedirectCommand` all the way up the call stack.

This aligns with prior art in other modern framework routers (such as Next.js, Remix, and SvelteKit), which commonly use thrown exceptions or special redirect responses to abort execution and trigger immediate redirection.
2026-08-11 10:03:43 -07:00
Alex Rickabaugh 8925a4ee49 fix(core): ensure i18n_util hasOwnProperty checks are safe for property renaming
`getTIcu` and `setTIcu` performed `hasOwnProperty` checks with string
literals (`'currentCaseLViewIndex'` and `'tView'`). Under Closure Compiler
property renaming optimizations, these properties are minified but the
string literals are not, causing property lookups and type discriminations
to fail.

This commit defines closure-safe property constants using
`getClosureSafeProperty` so the property names are renamed consistently.
2026-08-10 15:35:38 -07:00
Angular Robot b95f9e2691 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-08-10 08:57:16 -07:00
Kristiyan Kostadinov 565dbb2fe5 fix(core): incorrect loop in defer blocks
Fixes that we were running a `for in` loop on an array and silently doing the wrong thing.

Fixes #70113.
2026-08-07 16:35:03 -07:00
Ady Elouej 107f6fa49d fix(compiler): remove namespaced MathML script elements
Treat MathML-namespaced script elements as scripts during template preprocessing. This prevents scripts nested in MathML HTML integration points from surviving template compilation.
2026-08-07 16:32:57 -07:00
SkyZeroZx 4631a6e479 refactor(forms): modernize Signal Forms tests
replace change detection calls with whenStable for async tests
2026-08-07 16:22:59 -07:00
Ady Elouej 9f8e32616b fix(core): reject prefixed SVG script hosts
Use the host element's namespace-aware local name when checking for script
elements. A prefixed SVG script can expose a qualified tag name such as
"x:script" while its local name remains "script".
2026-08-07 16:19:13 -07:00
SkyZeroZx ec372d6029 refactor(platform-browser): modernize DOM renderer tests
Migrate fixtures to standalone components and await zoneless updates
2026-08-07 16:17:19 -07:00
splincode 9e37a58e14 fix(forms): keep radio inputs in sync when values change
Recompute the checked state when a reused radio input receives a new value while the form model remains unchanged.

Handle this case for both reactive forms and signal forms, and add regression tests covering reused radio elements.
2026-08-07 16:15:06 -07:00
Kristiyan Kostadinov 11b4089acf test(compiler): add test for imports with unquoted URL
Adds a test to cover the case where an `@import` might have a URL with special characters that isn't quoted.
2026-08-07 16:12:51 -07:00
Kristiyan Kostadinov a4f1a94948 fix(compiler): do not encapsulate nested selectors if parent contains ::ng-deep
Updates the nested selector encapsulation logic so that it skips encapsulating child selectors if the parent contains `::ng-deep`. The reasoning is that `:host ::ng-deep { .foo {} }` should behave as `:host ::ng-deep .foo {}`.
2026-08-07 16:12:51 -07:00
Kristiyan Kostadinov d0d7f57e08 fix(compiler): scope nested CSS rules
This is a second attempt at scoping nested CSS rules after not being able to land #50693. I took some extra precautions to try and avoid the crash that was happening last time.
2026-08-07 16:12:51 -07:00
Matthew Beck 8d6c925392 fix(compiler-cli): record class extends clause references in DeferredSymbolTracker
`DeferredSymbolTracker.lookupIdentifiersInSourceFile` prunes `ts.isTypeNode`
subtrees so that references appearing exclusively inside type annotations
do not keep static import declarations in the emitted JavaScript.

However, `ts.isTypeNode` returns `true` for `ts.ExpressionWithTypeArguments`,
which TypeScript uses to represent both `extends` and `implements` heritage
clauses. An `extends` clause on a class declaration or class expression is a
value position that survives in the emitted JavaScript output.

Because `isTypeNode` returned `true`, references to base classes imported
alongside deferred dependencies were ignored. As a result, the compiler
erroneously marked the static import statement as deferrable and deleted it
from the emitted JavaScript, leaving the `extends <Base>` clause referencing
an undeclared identifier and causing a runtime `ReferenceError`.

This commit ensures that `ExpressionWithTypeArguments` under a class `extends`
clause is not treated as an erasable type node, preserving the static import
whenever a base class is referenced.
2026-08-07 16:10:41 -07:00
Angular Robot 0eaf1c55d3 build: update all non-major dependencies
See associated pull request for more information.
2026-08-07 15:56:00 -07:00
Matthieu Riegler d7b03f5523 fix(compiler): Generate correct expression for optional chaning.
Optional chaining was generating expressions with included an extra pair of parenthesis which changed the semantics of the expression and threw an unexpected error from the optional chain non nullable extended diagnostic.

fixes #70085
2026-08-07 15:55:10 -07:00
SkyZeroZx 09bc90003e fix(http): always decode JSON responses as UTF-8
Keep the charset handling added in #70062 limited to text responses. JSON
bytes must stay UTF-8 regardless of the Content-Type charset.

Fetch defines Body.json() using "parse JSON from bytes". Infra specifies that
step as: "Let string be the result of running UTF-8 decode on bytes."

https://fetch.spec.whatwg.org/#dom-body-json
https://infra.spec.whatwg.org/#parse-json-bytes-to-a-javascript-value
2026-08-07 15:54:20 -07:00
Alan Agius cf1844bcce refactor(devtools): use JavaScriptTransformer for Angular optimization esbuild plugin
Refactor the devtools optimization esbuild plugin to use JavaScriptTransformer from @angular/build/private.
2026-08-07 10:30:52 -07:00
Matthieu Riegler ef4dfead83 fix(http): avoid aborting completed requests in FetchBackend
Prevent AbortController.abort() from executing during Observable teardown when a FetchBackend HTTP request has already completed successfully or errored.
Previously, FetchBackend unconditionally called abort() upon stream termination. When requests completed normally, calling abort() after delivery caused Chromium-based browsers to mark the resolved request as net::ERR_ABORTED in DevTools due to a race condition, leading to missing response body payloads ("Failed to load response data"). By tracking whether the request has already settled—similar to XhrBackend checking for xhr.readyState !== xhr.DONE—we ensure abort() is only called for unsettled, in-flight requests upon unsubscription.

Fixes #70071
2026-08-04 09:37:35 -07:00
Angular Robot 308a361f71 build: update domino digest to e0779df
See associated pull request for more information.
2026-08-04 09:35:04 -07:00
SkyZeroZx 2f0be5bef8 refactor(common): modernize directive tests to rely on whenStable
Replace synchronous detectChanges calls with zoneless-compatible scheduling and stability waits in NgClass, NgStyle, and NgOptimizedImage tests.
2026-08-04 08:45:01 -07:00
Alan Agius 280d09b160 fix(http): strip RFC 6265 DQUOTE characters and handle URIError in parseCookieValue
Previously, `parseCookieValue` did not strip enclosing double quotes (`DQUOTE`) from quoted cookie values as specified in RFC 6265 Section 4.1.1. In addition, malformed percent-encoding in cookie values caused an unhandled `URIError` when calling `decodeURIComponent`.
2026-08-04 08:29:46 -07:00
Matthieu Riegler 6a0789dc7f fix(http): respect content-type charset in fetch backend text decoder
Extract the charset parameter from the Content-Type response header in FetchBackend and pass it to TextDecoder when decoding text and json responses. When no valid charset is provided or supported, gracefully fall back to default utf-8 decoding.

Fixes #70061
2026-08-04 08:28:23 -07:00
Shuaib Hasan Akib 337053ef1a refactor(compiler): remove unused code and exports
Removes unused code and exports that are no longer referenced anywhere
in the compiler codebase.
2026-08-03 09:42:08 -07:00
Suraj Yadav fb698d12cd test(platform-server): add SSR integration test for null and normal input values
Fixes #69785

Add an Angular SSR integration test in platform-server verifying that null input values do not render string attributes like value="null" during server-side rendering, while normal non-empty string values like value="hello" are properly preserved.
2026-08-03 09:30:45 -07:00
lazerg 36c2197539 fix(zone.js): guard against null handle when detecting refreshable timers
A timer wrapper such as a browser extension, policy, or automation harness can block a call and return null instead of a handle. patchTimer then read `.refresh` on that null value and threw synchronously.

Treat a nullish handle as non-refreshable so the patched timer keeps working.

Fixes #70044
2026-08-03 09:14:04 -07:00
SkyZeroZx c9c4f2afc6 refactor(common): modernize directive tests to rely on whenStable
Replace synchronous detectChanges calls with zoneless-compatible scheduling and stability waits. Preserve NgComponentOutlet coverage for components declared by NgModules.
2026-08-03 09:13:32 -07:00
Angular Robot 4aacaecb96 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-08-03 08:55:37 -07:00
Matthieu Riegler 1b13db7a1b refactor(animations): remove outdated comment
This isn't necessary anymore.
2026-07-31 15:34:04 -07:00
SkyZeroZx cfe2cda110 fix(core): initialize hydration triggers after late runtime activation
After incremental hydration became tree-shakable, application bootstrap could finish before a routed component activated the runtime. The one-time trigger scan was then skipped, leaving routed and nested hydration triggers uninitialized.

Coordinate application bootstrap with runtime activation and initialize once both have occurred.

Fixes #69908
2026-07-31 12:26:08 -07:00
Jaime Burgos bb78286e5e fix(http): run root interceptors in the terminal request chain
Represent withRequestsMadeViaParent() with an internal delegating backend so the interceptor handler can distinguish delegated clients from independent child configurations.
2026-07-31 08:32:14 -07:00
Angular Robot b63b9032b4 build: update all non-major dependencies
See associated pull request for more information.
2026-07-30 09:59:54 -07:00
Angular Robot 9e5dc74b67 build: update cross-repo angular dependencies
See associated pull request for more information.

Closes #69910 as a pr takeover
2026-07-30 09:41:50 -07:00
SkyZeroZx 6deb6afcd1 refactor(forms): modernize reactive forms tests to rely on whenStable
Rely on zoneless scheduling throughout reactive forms tests instead of triggering change detection manually.
2026-07-30 09:06:29 -07:00
splincode e43eb96341 fix(core): warn when style property bindings receive invalid values
Report unsupported style property binding values in development mode while preserving existing binding behavior. Unwrap trusted style values before appending unit suffixes and link NG0318 warnings to the corresponding error guide.
2026-07-30 09:05:46 -07:00
Jaime Burgos d068fc1ea0 refactor(common): modernize pipes & non bindable tests to rely on whenStable
Rely on zoneless scheduling throughout reactive forms tests instead of triggering change detection manually.
2026-07-30 08:56:25 -07:00
splincode 5d76720e06 refactor(compiler): replace any casts with precise types
- r3_factory: use `in` operator instead of `as any` property probing
  in isDelegatedFactoryMetadata / isExpressionFactoryMetadata type guards
- r3_deferred_triggers: narrow assignment to
  `DeferredBlockTriggers[typeof name]` instead of `as any`
- defer_resolve_targets / reify: drop unnecessary `as any` on
  `op.trigger` — `DeferTriggerBase.kind` is present on all union members
- pipe_creation: replace double `as any` with `as {target?: ir.XrefId}`,
  and reuse the already-narrowed `slotHandle` variable for the call
- extractor_merger: replace legacy `<any>console` guards with a proper
  `typeof console !== 'undefined'` check
2026-07-30 08:55:04 -07:00
Matthieu Riegler d8a570ec4e refactor(core): update acceptance test
- remove NgModules
- remove non-necessary TestBed.configureTestingModule
- remove non-necessary Eager strategy
- Drop usages of CommonModule
2026-07-30 08:47:53 -07:00
SkyZeroZx 59f6ef690b refactor(forms): modernize signal forms tests to rely on whenStable
Rely on zoneless test scheduling instead of manually triggering change detection. Keep Signals Forms tests aligned with the async-first testing pattern.
2026-07-29 09:57:37 -07:00
Shuaib Hasan Akib ec87f04200 refactor(common): replaces the deprecated positional subscribe arguments with the
recommended observer object
2026-07-29 09:43:52 -07:00
Kristiyan Kostadinov 2a141847a5 fix(forms): add utility to assert that value is a field tree
Adds the `isFieldTree` utility that allows users to assert whether a value is a field tree. This is something that has come up on Material recently and will be useful for users as well.

Fixes #69984.
2026-07-29 08:53:24 -07:00
Matthew Beck d44b3224d9 test(compiler-cli): add compliance case for @HostListener on a property
`@HostListener` is not limited to methods — it is equally valid on a property
holding a function, which is the idiomatic way to keep `this` bound:

    @HostListener('window:beforeunload', ['$event'])
    private onUnload = (event: BeforeUnloadEvent) => {...};

Every existing host-listener compliance case declares the handler as a method,
so the property form was uncovered. This adds a case exercising both a public
and a private function-valued property, one of them with a global (`window:`)
event target, and locks in the emitted chained `ɵɵlistener` calls plus
`ɵɵresolveWindow`.

Verified against all four compliance modes (full, partial/linked,
declaration-only); GOLDEN_PARTIAL.js regenerated via the golden update rule.
2026-07-29 08:52:53 -07:00
Matthieu Riegler 36474f7011 refactor(common): remove duplicate helper function
We have `useAutoTick` in our private shared utils.
2026-07-29 08:49:15 -07:00
Matthieu Riegler c1025a0510 refactor(core): Migrate more tests off fakeAsync
This will prevent to polute the agent context with outdated/bad practices.
2026-07-29 08:46:01 -07:00
Jaime Burgos de240a5d0e fix(http): enable xsrf for root-provided HttpClient
Include the XSRF interceptor in the root token factory so the automatically provided HttpClient retains the documented default protection without requiring provideHttpClient().
2026-07-29 08:40:09 -07:00
brysonbw d5e8b1ef7a feat(forms): allow permanent hidden fields in signal forms
Allow the hidden utility function to be called without a configuration object to make fields permanently hidden.
2026-07-29 08:39:39 -07:00
SkyZeroZx f33ee95045 fix(http): match header values exactly when deleting
Normalize value-specific HttpHeaders deletions before filtering. The string overload previously used String#indexOf and removed shorter values contained within the requested deletion value, potentially widening outgoing request metadata.

Preserve delete-all behavior only when no value is supplied, and cover string, array, and empty-string deletion.
2026-07-29 08:39:07 -07:00
SkyZeroZx ff02a16749 fix(http): preserve immutability of materialized clones
Prevent lazy HttpHeaders and HttpParams clones from reusing value arrays owned by a materialized source. Append and value-specific delete operations previously mutated those shared arrays, violating the immutable API contract and allowing request metadata to bleed into later requests.

Share value arrays until an update mutates a specific header or parameter, then copy only that array. Cover the affected append and delete paths with regression tests that materialize the source first.
2026-07-29 08:39:07 -07:00