Commit Graph

15526 Commits

Author SHA1 Message Date
hawkgs e23541b263 fix(zone.js): vitest patching of describe/it curried calls
Separate direct from curried calls of `describe`/`it` modifiers
(direct: `skip`, `only`, etc.; curried: `runIf`, `each`, etc.)
and perform the required patching to them.

Fixes: #69748
2026-07-22 12:34:00 +02:00
Jaime Burgos d14696e430 fix(common): preserve crossorigin on image preloads
Propagate the crossorigin attribute from priority NgOptimizedImage hosts to SSR-generated preload links. Keep preload and image requests in the same credentials mode to avoid an anonymous image issuing an earlier credentialed request.
2026-07-22 12:31:52 +02:00
Suraj Yadav 49672c437b fix(migrations): correctly migrate ngClass with mixed space-separated keys
Preserve NgClass import on partial migration and increment
skippedNgClassCount when an unmigrable mixed binding is encountered.
2026-07-21 19:20:20 +02:00
splincode 8201cebc49 refactor(compiler): enforce exhaustive defer trigger handling
Store the trigger kind before each switch and assign the value to `never` in the fallback branch.

This removes the `any` casts and makes the switches exhaustive. Adding a new `DeferTriggerKind` without handling it in either phase now produces a TypeScript compilation error.

Runtime behavior and error messages remain unchanged.
2026-07-21 19:19:02 +02:00
Matthieu Riegler 3497c9b943 fix(forms): ensure pending status propagates to the root form in signal forms
Previously, the `pending()` status on a field's `ValidationState` only checked if the field itself or its immediate children had a pending asynchronous validator by directly inspecting `asyncErrors()`. This meant that a pending asynchronous validator deep within a nested form (e.g. on a grand-child) would not correctly bubble the `pending` state up to the root form.

fixes #69840
2026-07-21 13:48:32 +02:00
Matthew Beck eb3e480360 test(compiler-cli): cover DOM-only vs full instruction set across compilation modes
Adds a compliance case pinning the instruction-set selection for a
directive-free standalone component:

  - full compile: the compiler can prove the template has no directive
    dependencies, so it takes the DOM-only fast path
    (`ɵɵdomElementStart`/`ɵɵdomElementEnd`).
  - local compile: the compiler cannot inspect dependencies, so
    `hasDirectiveDependencies` is forced true and the full instruction
    set is emitted (`ɵɵelementStart`/`ɵɵelementEnd`).

This mode-dependent switch was previously only exercised incidentally by
the `foreign_component` case, which couples it with foreign-component
compilation. The new case isolates it.
2026-07-21 11:06:36 +02:00
Alan Agius 3499a1321b fix(core): ensure SVG animation attributeName is checked case-insensitively
Currently, the SVG sanitizer checks a static set of candidate attribute
names (`attributeName` and `attributename`). This approach misses other case
variations (such as `attributenAme` or others), which could potentially
bypass sanitization when binding sensitive attributes like `href` on
`<set>` or `<animate>` elements.

This change retrieves all attribute names of the SVG element, performs a
case-insensitive comparison with `'attributename'`, and sanitizes the value
if a match is found.
2026-07-21 11:05:02 +02:00
Suraj Yadav 223e40279f fix(migrations): preserve NgClass import on partial migration
When only some NgClass usages are migrated (partial migration),
the NgClass import should be preserved in the module/component
imports if it is still used elsewhere.
2026-07-20 18:14:35 +02:00
arshiya tabasum 3192dccaa3 fix(http): prevent transfer cache key collisions
`makeCacheKey` joined the request fields with `|` before hashing. The url
and the serialized body can contain `|` themselves, so a shifted field
boundary (url `/items/a` + body `b|c` vs url `/items/a|b` + body `c`)
produced the same joined string and the same key, letting two distinct
requests share a transfer cache slot.

Join with `\0` instead, which cannot occur in a valid url or in encoded
params, so the field boundaries cannot be forged by field content.
2026-07-20 14:39:51 +02:00
Pawel Kozlowski 7a626175f7 Revert "fix(forms): preserve intermediate number values in signal forms"
This reverts commit 2e32872720.
2026-07-20 10:45:01 +02:00
Jaime Burgos 2e32872720 fix(forms): preserve intermediate number values in signal forms
Preserve raw native input text while editing so parsed model values are not written back on every keystroke.
2026-07-15 15:56:48 -07:00
Angular Robot f034c02e67 build: update cross-repo angular dependencies to v22.1.0-next.4
See associated pull request for more information.
2026-07-15 14:49:48 -07:00
splincode 24a3c63976 test(elements): disambiguate the setTimeout spy type
Bind spyOn explicitly to Window so Jasmine uses the DOM setTimeout signature that returns a number instead of the Node.js Timeout type. Remove the unsafe any cast and the obsolete TODO.
2026-07-15 14:48:28 -07:00
cexbrayat 0ae6d81ed2 fix(core): preserve explicit input transform write type
If a directive has an input declared as `dismissible = input<boolean>(true, {transform: booleanAttribute});` then the following templates were not compiling:

```
<div directiveName dismissible="true"></div>
<div directiveName dismissible></div>
```

This commit fixes the issue, without breaking contravariant consumers.
2026-07-15 12:02:18 -07:00
arshiya tabasum 359fb503b8 fix(common): avoid prototype lookups in date format caches
The NAMED_FORMATS and DATE_FORMATS caches were plain objects read with a
truthy check keyed by a token from the format string, so a token matching
an inherited Object member (e.g. `__proto__`) resolved to a prototype
value. Create both caches with a null prototype so only real entries are
returned.
2026-07-15 12:01:49 -07:00
Shuaib Hasan Akib 37f3279fe7 refactor(forms): warn when a text input receives a null value in Signal Forms
Native text `<input type="text">` controls do not support `null` values.
When a Signal Forms model bound to a text input is set to `null`, the value
is silently coerced to an empty string.
2026-07-15 12:01:13 -07:00
Kristiyan Kostadinov 68ac204074 fix(core): ignore processing instruction syntax in templates
Updates the template parser to detect and ignore processing instruction syntax (e.g. `<? foo ?>` or `<? foo >`). Currently it is being printed out as text.

Fixes #34371.
2026-07-15 11:57:02 -07:00
Cameron Smick d997a96b47 refactor(core): move signal debug graph interfaces to primitives/devtools
Move the DebugSignalGraph, DebugSignalGraphEdge, and DebugSignalGraphNode interfaces from packages/core/src/render3/util/signal_debug.ts into the packages/core/primitives/devtools/src package. This decouples the signal graph debug types from runtime render3 utilities and allows devtools and internal core tooling to import them directly from primitives as type-only exports.
2026-07-14 11:09:22 -07:00
CYANO-01 fb6b354fbd fix(platform-browser): prevent ReDoS in SOURCEMAP_URL_REGEXP
Replace the lazy quantifier (.+?) with a negated character class
([^\s*]+) that excludes whitespace and asterisks. Source map URLs
never contain these characters, so the fix is semantically
equivalent while eliminating the O(n²) backtracking path triggered
by unclosed /*# sourceMappingURL= fragments.

Fixes: polynomial ReDoS in addBaseHrefToCssSourceMap
2026-07-14 10:57:20 -07:00
Sonu Kapoor 6d043f8657 fix(http): prevent interceptor signal reads from leaking into calling reactive contexts
When `HttpClient` is called from within an `effect()` or other reactive
context, any signal reads performed inside HTTP interceptors were
inadvertently tracked by that context. This caused the effect to
re-execute whenever those signals changed, regardless of whether the
signal was semantically related to the HTTP call.

The fix wraps the interceptor chain invocation in `untracked()` so that
signal reads inside interceptors — both functional (`withInterceptors`)
and class-based (`withInterceptorsFromDi`) — are invisible to the
calling reactive context. This matches the precedent set by the resource
API, which also wraps its loader in `untracked()` for the same reason.

Fixes #58682
2026-07-14 09:21:07 -07:00
LordKay-sudo ae0ec7315c fix(compiler-cli): re-tag SourceFiles after TsCreateProgramDriver.updateFiles()
TypeScript reuses SourceFile objects between old and new programs, so untagging the old program also untags shared files in the new program. Re-apply shim tags on the new program to prevent getSemanticDiagnostics() crashes with TS 5.5+.
2026-07-14 09:18:35 -07:00
Alan Agius 13d9cc36c0 refactor: remove obsolete @types/babel__core dependency
Remove the obsolete @types/babel__core dependency from packages/compiler-cli and packages/localize. This dependency is no longer needed as Babel v8 ships with its own built-in TypeScript definitions.
2026-07-13 08:13:13 -07:00
Doug Parker ce4f7adc95 refactor(core): remove deprecated unregisterTool from ModelContext
In the WebMCP specification, tools are unregistered by aborting the `AbortSignal` provided in `registerTool(tool, {signal})`. The deprecated `unregisterTool` method on `ModelContext` is no longer needed or part of the standard, and is now removed from the TypeScript interface definition.
2026-07-10 10:56:41 -07:00
Doug Parker f908140d71 refactor(core): update WebMCP tool registration to be asynchronous
In the latest WebMCP specification and Chromium preview builds, `document.modelContext.registerTool` was updated to be asynchronous and return a `Promise`: https://groups.google.com/a/chromium.org/g/chrome-ai-dev-preview/c/xQWt0b1sZIE/m/UJznbNCIAwAJ?utm_medium=email&utm_source=footer

This commit update adjusts Angular's experimental WebMCP implementation (`declareExperimentalWebMcpTool` and form registration) to be async as well, returning `Promise<void>`.
2026-07-10 10:56:41 -07:00
Matthew Beck 1fb4678207 Revert "fix(core): allow static attributes for explicit input transforms"
This reverts commit 9b9b0e93c9.

This broke g3. Not sure yet why it didn't break externally. We can
investigate and fix following this revert.
2026-07-09 17:58:22 -07:00
Angular Robot 4cf5135743 build: update cross-repo angular dependencies
See associated pull request for more information.
2026-07-09 16:04:43 -07:00
arshiya tabasum 2a4f582731 fix(localize): use Object.hasOwn for placeholder lookup in translate
`translate()` looked up substitutions with `message.substitutions.hasOwnProperty(placeholder)`. A message whose placeholder is named `hasOwnProperty` stores that key on the plain substitutions object, shadowing the method, so the lookup calls the substitution value and throws a TypeError. Use `Object.hasOwn` instead, which resolves through `Object` and is unaffected by the shadowed key, matching the recent `I18nSelectPipe` fix.
2026-07-09 12:29:55 -07:00
Bhuvansh855 12fe700ad8 test(forms): register writeback test control as CVA
Register the custom writeback test control as an NG_VALUE_ACCESSOR
so it is recognized as a valid formField host during debounce
writeback testing.
2026-07-09 12:29:06 -07:00
Bhuvansh855 2e0cb52dbf fix(forms): prevent stale CVA writeback during debounce
Use controlValue() instead of value() when synchronizing
ControlValueAccessor instances.

When debounce is active, value() can still contain the
previous model value while controlValue() reflects the
latest user-entered value. This prevents stale values
from being written back to the CVA before the debounce
is flushed.

Adds a regression test covering the debounce scenario.
2026-07-09 12:29:06 -07:00
cexbrayat 9b9b0e93c9 fix(core): allow static attributes for explicit input transforms
This is a follow-up to #67997, which allowed explicit read generics with input transforms, such as `input<boolean>(false, {transform: booleanAttribute})`.

That fixed the declaration, but static template attributes like `dismissible="true"` and bare `dismissible` were still checked as strings against the read type. Allow the fallback write type to include static attribute strings so these template forms compile.
2026-07-09 12:28:25 -07:00
Shuaib Hasan Akib 13b6bbd6a0 docs(platform-server): add error reference page for NG05703 and wire up RuntimeError
Add a dedicated error reference page for NG05703 (suspicious URL origin
change during SSR) and update the error to use RuntimeError with a
negative code so the error message automatically includes a link to the
docs page in both dev and production builds.

Update affected tests in url_spec.ts, platform_location_spec.ts, and
integration_spec.ts to match the new NG05703-prefixed error message
format.

Fixes: #69667
2026-07-09 11:56:01 -07:00
hawkgs 53ca8c25cb test(language-service): empty template literal interpolation
Ensure that empty template literal interpolation is handled gracefully.
2026-07-09 09:56:40 -07:00
hawkgs da52137724 fix(compiler): parsing of an empty template literal interpolation
Even if we have an `EmptyExpr`, add that expression to the expressions array when a literal is parsed.
The lack of the expression results in a discrepancy in the sizes of the `elements` and the `expressions`
arrays of a `TemplateLiteral`, that result in an error when we visit that same literal due to the missing
expression.

Fixes #69699
2026-07-09 09:56:40 -07:00
arshiya tabasum 5de0ea5f23 fix(localize): build runtime translations map with a null prototype
loadTranslations stores parsed translations into the shared global
$localize.TRANSLATIONS keyed by message id. Those ids come verbatim from
the translations map (typically parsed from a translation file), so a
translation whose id is __proto__ assigns through the inherited __proto__
setter, reparenting the map rather than storing the entry (and throwing
under --disable-proto=throw). Create the map with Object.create(null) in
loadTranslations and clearTranslations so __proto__ is an ordinary key.
2026-07-09 09:56:10 -07:00
Matthieu Riegler 5cb8c733a3 fix(forms): allow multiple async validators
When a parent form element defines an async validator, its resource's `params` function needs to evaluate `syncValid()`, which causes unvisited child form nodes to be lazily instantiated. If any of these lazily instantiated child nodes also define an async validator, their resource is initialized while the parent's `params` function is still evaluating. This incorrectly triggers Angular core's `NG0992` guard (`Cannot create a resource inside the params of another resource`).
This commit exports `ɵsetInParamsFunction` and `ɵisInParamsFunction` from `@angular/core` and uses them in `FieldMetadataState.runMetadataCreateLifecycle` to explicitly detach the lazy creation of form metadata from the parent's reactive `params` context.

fixes #69620
2026-07-09 09:55:29 -07:00
leonsenft 5bd00add07 fix(compiler): support foreign components inside control flow blocks (#69674)
Prepend generated view scope variables to `view.create` in addition to
`view.update` so that expressions evaluated during creation (such as
foreign component property bindings) can resolve context variables from
parent views when nested inside control flow blocks (`@if`, `@switch`,
`@for`). This is necessary to support binding properties to foreign
components inside control flow blocks.
reflect this broader behavior.)

PR Close #69674
2026-07-09 09:38:24 -07:00
leonsenft 2e442f7876 perf(compiler): do not emit tag name when control flow root is foreign component (#69674)
When a control flow block (`@if`, `@switch`, `@for`) contains a single
root element that is a foreign component, do not treat its name as a tag
name for the template container (`conditionalCreate`, `repeaterCreate`).

PR Close #69674
2026-07-09 09:38:24 -07:00
Matthieu Riegler 25b7afa515 Revert "fix(forms): allow multiple async validators"
This reverts commit 953cdfd66a.
2026-07-08 13:03:48 -07:00
Matthieu Riegler c0eaaedef3 refactor(core): cleanup Meta service
The service had a rather old implementation. This is mostly a cleanup.
2026-07-08 11:23:54 -07:00
volkanfilazi 8e8c5524bb removed console log 2026-07-08 11:23:00 -07:00
volkanfilazi b542302a23 fix(forms/signals): make extractValue reactive for compat AbstractControl values 2026-07-08 11:23:00 -07:00
Matthieu Riegler d93e922517 docs(forms): add jsdoc for ReadonlyFieldState 2026-07-08 10:45:31 -07:00
SkyZeroZx c1829f6d7c docs(docs-infra): Add build-time validation for API and guide links using route manifest
Adds build-time validation to catch broken, stale, or miscased internal documentation links in both JSDoc and markdown, including `/api/` and `/guide/` URLs and their fragments. Updates the documentation pipeline to share the canonical route manifest, ensuring that all references are checked against the current navigation structure.
2026-07-08 10:24:47 -07:00
P4 eb2a8ff63f fix(compiler-cli): apply debugName transform to required signal queries
Transform assumed `.required` functions always take options as the first argument.
This is true for `input` and `model`, but not for `viewChild` and `contentChild`,
which take the same arguments as non-required versions.

Change the code to put options for signal queries in the right position,
causing debugName to be correctly generated for signal queries.
2026-07-07 11:05:22 -07:00
Angular Robot c3e688f102 build: update all non-major dependencies
See associated pull request for more information.
2026-07-07 11:04:31 -07:00
Cameron Smick bf6dba878e refactor(core): move devtools ai tool definition types to primitives
Extract the AI tool definition interfaces from the core debug module to the devtools primitives module. This relocates ToolDefinition, ToolGroup, and DevtoolsToolDiscoveryEvent to the primitives folder, exposing them cleanly via "export type" in the devtools entry point, improving module organization and readability.
2026-07-07 10:18:05 -07:00
rootvector2 e5c37f21de fix(router): use safe hasOwnProperty when parsing query params
`parseQueryParam` and the AngularJS-compat `parseKeyValue` accumulate query params into a plain object and check key presence with `obj.hasOwnProperty`, so a `hasOwnProperty` query key clobbers the method and the next lookup throws `TypeError`. Switch both to `Object.hasOwn`, which can't be shadowed by a query key.
2026-07-07 10:09:34 -07:00
cexbrayat fbb705e6fd fix(migrations): remove stale model import in model-output migration
Remove the model import after migrating all model() usages in a file.
2026-07-07 10:08:43 -07:00
arturovt ab618bdc0f refactor(compiler-cli): use BindingType enum check in suffix-not-supported extended diagnostic
Replaces the `node.keySpan.toString().startsWith('attr.')` string allocation in the `suffixNotSupported` extended template check with an O(1) `node.type === BindingType.Attribute` enum comparison.

The diagnostic message string is also extracted to a module-level constant so it is created once at module load time instead of on every diagnostic emit.

Additionally, this change adds missing test coverage for the `.%` and `.em` suffixes, as well as for a plain `attr.` binding without a style suffix.

Measured with a 100-iteration microbenchmark before and after the change (MacBook Pro 2018, Intel CPU):

```ts
const start = performance.now();
for (let i = 0; i < 100; i++) {
  new ExtendedTemplateCheckerImpl(templateTypeChecker, program.getTypeChecker(),
    [suffixNotSupportedFactory], {}).getDiagnosticsForComponent(component);
}
console.log((performance.now() - start) / 100, 'ms/iter');
```

Before: `~0.24 ms/iter`
After: `~0.14 ms/iter` (~40% faster)
2026-07-07 10:05:05 -07:00
cexbrayat eac363e92e fix(compiler-cli): detect uninvoked signals in bound expressions using ternary
Extend the interpolated signal extended diagnostic to inspect ternary-bound expressions and report uninvoked signal reads in bound bindings.

```
<div [style.width]="width() ? 1 : width"></div>
```

where the false branch should invoke the signal as `width()`.
2026-07-07 10:01:49 -07:00