@angular/common 21.0.1 → 21.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.0.1
2
+ * @license Angular v21.0.3
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -9,6 +9,7 @@ import { ɵRuntimeError as _RuntimeError, InjectionToken, inject, NgZone, Destro
9
9
  import { switchMap, finalize, concatMap, filter, map } from 'rxjs/operators';
10
10
  import { Observable, from, of } from 'rxjs';
11
11
  import { XhrFactory, parseCookieValue } from './_xhr-chunk.mjs';
12
+ import { PlatformLocation } from './_platform_location-chunk.mjs';
12
13
 
13
14
  class HttpHeaders {
14
15
  headers;
@@ -974,7 +975,7 @@ class FetchBackend {
974
975
  }
975
976
  static ɵfac = i0.ɵɵngDeclareFactory({
976
977
  minVersion: "12.0.0",
977
- version: "21.0.1",
978
+ version: "21.0.3",
978
979
  ngImport: i0,
979
980
  type: FetchBackend,
980
981
  deps: [],
@@ -982,14 +983,14 @@ class FetchBackend {
982
983
  });
983
984
  static ɵprov = i0.ɵɵngDeclareInjectable({
984
985
  minVersion: "12.0.0",
985
- version: "21.0.1",
986
+ version: "21.0.3",
986
987
  ngImport: i0,
987
988
  type: FetchBackend
988
989
  });
989
990
  }
990
991
  i0.ɵɵngDeclareClassMetadata({
991
992
  minVersion: "12.0.0",
992
- version: "21.0.1",
993
+ version: "21.0.3",
993
994
  ngImport: i0,
994
995
  type: FetchBackend,
995
996
  decorators: [{
@@ -1244,7 +1245,7 @@ class HttpXhrBackend {
1244
1245
  }
1245
1246
  static ɵfac = i0.ɵɵngDeclareFactory({
1246
1247
  minVersion: "12.0.0",
1247
- version: "21.0.1",
1248
+ version: "21.0.3",
1248
1249
  ngImport: i0,
1249
1250
  type: HttpXhrBackend,
1250
1251
  deps: [{
@@ -1254,7 +1255,7 @@ class HttpXhrBackend {
1254
1255
  });
1255
1256
  static ɵprov = i0.ɵɵngDeclareInjectable({
1256
1257
  minVersion: "12.0.0",
1257
- version: "21.0.1",
1258
+ version: "21.0.3",
1258
1259
  ngImport: i0,
1259
1260
  type: HttpXhrBackend,
1260
1261
  providedIn: 'root'
@@ -1262,7 +1263,7 @@ class HttpXhrBackend {
1262
1263
  }
1263
1264
  i0.ɵɵngDeclareClassMetadata({
1264
1265
  minVersion: "12.0.0",
1265
- version: "21.0.1",
1266
+ version: "21.0.3",
1266
1267
  ngImport: i0,
1267
1268
  type: HttpXhrBackend,
1268
1269
  decorators: [{
@@ -1319,7 +1320,7 @@ function legacyInterceptorFnFactory() {
1319
1320
  class HttpBackend {
1320
1321
  static ɵfac = i0.ɵɵngDeclareFactory({
1321
1322
  minVersion: "12.0.0",
1322
- version: "21.0.1",
1323
+ version: "21.0.3",
1323
1324
  ngImport: i0,
1324
1325
  type: HttpBackend,
1325
1326
  deps: [],
@@ -1327,7 +1328,7 @@ class HttpBackend {
1327
1328
  });
1328
1329
  static ɵprov = i0.ɵɵngDeclareInjectable({
1329
1330
  minVersion: "12.0.0",
1330
- version: "21.0.1",
1331
+ version: "21.0.3",
1331
1332
  ngImport: i0,
1332
1333
  type: HttpBackend,
1333
1334
  providedIn: 'root',
@@ -1336,7 +1337,7 @@ class HttpBackend {
1336
1337
  }
1337
1338
  i0.ɵɵngDeclareClassMetadata({
1338
1339
  minVersion: "12.0.0",
1339
- version: "21.0.1",
1340
+ version: "21.0.3",
1340
1341
  ngImport: i0,
1341
1342
  type: HttpBackend,
1342
1343
  decorators: [{
@@ -1379,7 +1380,7 @@ class HttpInterceptorHandler {
1379
1380
  }
1380
1381
  static ɵfac = i0.ɵɵngDeclareFactory({
1381
1382
  minVersion: "12.0.0",
1382
- version: "21.0.1",
1383
+ version: "21.0.3",
1383
1384
  ngImport: i0,
1384
1385
  type: HttpInterceptorHandler,
1385
1386
  deps: [{
@@ -1391,7 +1392,7 @@ class HttpInterceptorHandler {
1391
1392
  });
1392
1393
  static ɵprov = i0.ɵɵngDeclareInjectable({
1393
1394
  minVersion: "12.0.0",
1394
- version: "21.0.1",
1395
+ version: "21.0.3",
1395
1396
  ngImport: i0,
1396
1397
  type: HttpInterceptorHandler,
1397
1398
  providedIn: 'root'
@@ -1399,7 +1400,7 @@ class HttpInterceptorHandler {
1399
1400
  }
1400
1401
  i0.ɵɵngDeclareClassMetadata({
1401
1402
  minVersion: "12.0.0",
1402
- version: "21.0.1",
1403
+ version: "21.0.3",
1403
1404
  ngImport: i0,
1404
1405
  type: HttpInterceptorHandler,
1405
1406
  decorators: [{
@@ -1417,7 +1418,7 @@ i0.ɵɵngDeclareClassMetadata({
1417
1418
  class HttpHandler {
1418
1419
  static ɵfac = i0.ɵɵngDeclareFactory({
1419
1420
  minVersion: "12.0.0",
1420
- version: "21.0.1",
1421
+ version: "21.0.3",
1421
1422
  ngImport: i0,
1422
1423
  type: HttpHandler,
1423
1424
  deps: [],
@@ -1425,7 +1426,7 @@ class HttpHandler {
1425
1426
  });
1426
1427
  static ɵprov = i0.ɵɵngDeclareInjectable({
1427
1428
  minVersion: "12.0.0",
1428
- version: "21.0.1",
1429
+ version: "21.0.3",
1429
1430
  ngImport: i0,
1430
1431
  type: HttpHandler,
1431
1432
  providedIn: 'root',
@@ -1434,7 +1435,7 @@ class HttpHandler {
1434
1435
  }
1435
1436
  i0.ɵɵngDeclareClassMetadata({
1436
1437
  minVersion: "12.0.0",
1437
- version: "21.0.1",
1438
+ version: "21.0.3",
1438
1439
  ngImport: i0,
1439
1440
  type: HttpHandler,
1440
1441
  decorators: [{
@@ -1584,7 +1585,7 @@ class HttpClient {
1584
1585
  }
1585
1586
  static ɵfac = i0.ɵɵngDeclareFactory({
1586
1587
  minVersion: "12.0.0",
1587
- version: "21.0.1",
1588
+ version: "21.0.3",
1588
1589
  ngImport: i0,
1589
1590
  type: HttpClient,
1590
1591
  deps: [{
@@ -1594,7 +1595,7 @@ class HttpClient {
1594
1595
  });
1595
1596
  static ɵprov = i0.ɵɵngDeclareInjectable({
1596
1597
  minVersion: "12.0.0",
1597
- version: "21.0.1",
1598
+ version: "21.0.3",
1598
1599
  ngImport: i0,
1599
1600
  type: HttpClient,
1600
1601
  providedIn: 'root'
@@ -1602,7 +1603,7 @@ class HttpClient {
1602
1603
  }
1603
1604
  i0.ɵɵngDeclareClassMetadata({
1604
1605
  minVersion: "12.0.0",
1605
- version: "21.0.1",
1606
+ version: "21.0.3",
1606
1607
  ngImport: i0,
1607
1608
  type: HttpClient,
1608
1609
  decorators: [{
@@ -1717,7 +1718,7 @@ class JsonpClientBackend {
1717
1718
  }
1718
1719
  static ɵfac = i0.ɵɵngDeclareFactory({
1719
1720
  minVersion: "12.0.0",
1720
- version: "21.0.1",
1721
+ version: "21.0.3",
1721
1722
  ngImport: i0,
1722
1723
  type: JsonpClientBackend,
1723
1724
  deps: [{
@@ -1729,14 +1730,14 @@ class JsonpClientBackend {
1729
1730
  });
1730
1731
  static ɵprov = i0.ɵɵngDeclareInjectable({
1731
1732
  minVersion: "12.0.0",
1732
- version: "21.0.1",
1733
+ version: "21.0.3",
1733
1734
  ngImport: i0,
1734
1735
  type: JsonpClientBackend
1735
1736
  });
1736
1737
  }
1737
1738
  i0.ɵɵngDeclareClassMetadata({
1738
1739
  minVersion: "12.0.0",
1739
- version: "21.0.1",
1740
+ version: "21.0.3",
1740
1741
  ngImport: i0,
1741
1742
  type: JsonpClientBackend,
1742
1743
  decorators: [{
@@ -1768,7 +1769,7 @@ class JsonpInterceptor {
1768
1769
  }
1769
1770
  static ɵfac = i0.ɵɵngDeclareFactory({
1770
1771
  minVersion: "12.0.0",
1771
- version: "21.0.1",
1772
+ version: "21.0.3",
1772
1773
  ngImport: i0,
1773
1774
  type: JsonpInterceptor,
1774
1775
  deps: [{
@@ -1778,14 +1779,14 @@ class JsonpInterceptor {
1778
1779
  });
1779
1780
  static ɵprov = i0.ɵɵngDeclareInjectable({
1780
1781
  minVersion: "12.0.0",
1781
- version: "21.0.1",
1782
+ version: "21.0.3",
1782
1783
  ngImport: i0,
1783
1784
  type: JsonpInterceptor
1784
1785
  });
1785
1786
  }
1786
1787
  i0.ɵɵngDeclareClassMetadata({
1787
1788
  minVersion: "12.0.0",
1788
- version: "21.0.1",
1789
+ version: "21.0.3",
1789
1790
  ngImport: i0,
1790
1791
  type: JsonpInterceptor,
1791
1792
  decorators: [{
@@ -1829,7 +1830,7 @@ class HttpXsrfCookieExtractor {
1829
1830
  }
1830
1831
  static ɵfac = i0.ɵɵngDeclareFactory({
1831
1832
  minVersion: "12.0.0",
1832
- version: "21.0.1",
1833
+ version: "21.0.3",
1833
1834
  ngImport: i0,
1834
1835
  type: HttpXsrfCookieExtractor,
1835
1836
  deps: [],
@@ -1837,7 +1838,7 @@ class HttpXsrfCookieExtractor {
1837
1838
  });
1838
1839
  static ɵprov = i0.ɵɵngDeclareInjectable({
1839
1840
  minVersion: "12.0.0",
1840
- version: "21.0.1",
1841
+ version: "21.0.3",
1841
1842
  ngImport: i0,
1842
1843
  type: HttpXsrfCookieExtractor,
1843
1844
  providedIn: 'root'
@@ -1845,7 +1846,7 @@ class HttpXsrfCookieExtractor {
1845
1846
  }
1846
1847
  i0.ɵɵngDeclareClassMetadata({
1847
1848
  minVersion: "12.0.0",
1848
- version: "21.0.1",
1849
+ version: "21.0.3",
1849
1850
  ngImport: i0,
1850
1851
  type: HttpXsrfCookieExtractor,
1851
1852
  decorators: [{
@@ -1858,7 +1859,7 @@ i0.ɵɵngDeclareClassMetadata({
1858
1859
  class HttpXsrfTokenExtractor {
1859
1860
  static ɵfac = i0.ɵɵngDeclareFactory({
1860
1861
  minVersion: "12.0.0",
1861
- version: "21.0.1",
1862
+ version: "21.0.3",
1862
1863
  ngImport: i0,
1863
1864
  type: HttpXsrfTokenExtractor,
1864
1865
  deps: [],
@@ -1866,7 +1867,7 @@ class HttpXsrfTokenExtractor {
1866
1867
  });
1867
1868
  static ɵprov = i0.ɵɵngDeclareInjectable({
1868
1869
  minVersion: "12.0.0",
1869
- version: "21.0.1",
1870
+ version: "21.0.3",
1870
1871
  ngImport: i0,
1871
1872
  type: HttpXsrfTokenExtractor,
1872
1873
  providedIn: 'root',
@@ -1875,7 +1876,7 @@ class HttpXsrfTokenExtractor {
1875
1876
  }
1876
1877
  i0.ɵɵngDeclareClassMetadata({
1877
1878
  minVersion: "12.0.0",
1878
- version: "21.0.1",
1879
+ version: "21.0.3",
1879
1880
  ngImport: i0,
1880
1881
  type: HttpXsrfTokenExtractor,
1881
1882
  decorators: [{
@@ -1886,9 +1887,22 @@ i0.ɵɵngDeclareClassMetadata({
1886
1887
  }]
1887
1888
  }]
1888
1889
  });
1889
- const ABSOLUTE_URL_REGEX = /^(?:https?:)?\/\//i;
1890
1890
  function xsrfInterceptorFn(req, next) {
1891
- if (!inject(XSRF_ENABLED) || req.method === 'GET' || req.method === 'HEAD' || ABSOLUTE_URL_REGEX.test(req.url)) {
1891
+ if (!inject(XSRF_ENABLED) || req.method === 'GET' || req.method === 'HEAD') {
1892
+ return next(req);
1893
+ }
1894
+ try {
1895
+ const locationHref = inject(PlatformLocation).href;
1896
+ const {
1897
+ origin: locationOrigin
1898
+ } = new URL(locationHref);
1899
+ const {
1900
+ origin: requestOrigin
1901
+ } = new URL(req.url, locationOrigin);
1902
+ if (locationOrigin !== requestOrigin) {
1903
+ return next(req);
1904
+ }
1905
+ } catch {
1892
1906
  return next(req);
1893
1907
  }
1894
1908
  const token = inject(HttpXsrfTokenExtractor).getToken();
@@ -1907,7 +1921,7 @@ class HttpXsrfInterceptor {
1907
1921
  }
1908
1922
  static ɵfac = i0.ɵɵngDeclareFactory({
1909
1923
  minVersion: "12.0.0",
1910
- version: "21.0.1",
1924
+ version: "21.0.3",
1911
1925
  ngImport: i0,
1912
1926
  type: HttpXsrfInterceptor,
1913
1927
  deps: [],
@@ -1915,14 +1929,14 @@ class HttpXsrfInterceptor {
1915
1929
  });
1916
1930
  static ɵprov = i0.ɵɵngDeclareInjectable({
1917
1931
  minVersion: "12.0.0",
1918
- version: "21.0.1",
1932
+ version: "21.0.3",
1919
1933
  ngImport: i0,
1920
1934
  type: HttpXsrfInterceptor
1921
1935
  });
1922
1936
  }
1923
1937
  i0.ɵɵngDeclareClassMetadata({
1924
1938
  minVersion: "12.0.0",
1925
- version: "21.0.1",
1939
+ version: "21.0.3",
1926
1940
  ngImport: i0,
1927
1941
  type: HttpXsrfInterceptor,
1928
1942
  decorators: [{
@@ -2068,7 +2082,7 @@ class HttpClientXsrfModule {
2068
2082
  }
2069
2083
  static ɵfac = i0.ɵɵngDeclareFactory({
2070
2084
  minVersion: "12.0.0",
2071
- version: "21.0.1",
2085
+ version: "21.0.3",
2072
2086
  ngImport: i0,
2073
2087
  type: HttpClientXsrfModule,
2074
2088
  deps: [],
@@ -2076,13 +2090,13 @@ class HttpClientXsrfModule {
2076
2090
  });
2077
2091
  static ɵmod = i0.ɵɵngDeclareNgModule({
2078
2092
  minVersion: "14.0.0",
2079
- version: "21.0.1",
2093
+ version: "21.0.3",
2080
2094
  ngImport: i0,
2081
2095
  type: HttpClientXsrfModule
2082
2096
  });
2083
2097
  static ɵinj = i0.ɵɵngDeclareInjector({
2084
2098
  minVersion: "12.0.0",
2085
- version: "21.0.1",
2099
+ version: "21.0.3",
2086
2100
  ngImport: i0,
2087
2101
  type: HttpClientXsrfModule,
2088
2102
  providers: [HttpXsrfInterceptor, {
@@ -2103,7 +2117,7 @@ class HttpClientXsrfModule {
2103
2117
  }
2104
2118
  i0.ɵɵngDeclareClassMetadata({
2105
2119
  minVersion: "12.0.0",
2106
- version: "21.0.1",
2120
+ version: "21.0.3",
2107
2121
  ngImport: i0,
2108
2122
  type: HttpClientXsrfModule,
2109
2123
  decorators: [{
@@ -2129,7 +2143,7 @@ i0.ɵɵngDeclareClassMetadata({
2129
2143
  class HttpClientModule {
2130
2144
  static ɵfac = i0.ɵɵngDeclareFactory({
2131
2145
  minVersion: "12.0.0",
2132
- version: "21.0.1",
2146
+ version: "21.0.3",
2133
2147
  ngImport: i0,
2134
2148
  type: HttpClientModule,
2135
2149
  deps: [],
@@ -2137,13 +2151,13 @@ class HttpClientModule {
2137
2151
  });
2138
2152
  static ɵmod = i0.ɵɵngDeclareNgModule({
2139
2153
  minVersion: "14.0.0",
2140
- version: "21.0.1",
2154
+ version: "21.0.3",
2141
2155
  ngImport: i0,
2142
2156
  type: HttpClientModule
2143
2157
  });
2144
2158
  static ɵinj = i0.ɵɵngDeclareInjector({
2145
2159
  minVersion: "12.0.0",
2146
- version: "21.0.1",
2160
+ version: "21.0.3",
2147
2161
  ngImport: i0,
2148
2162
  type: HttpClientModule,
2149
2163
  providers: [provideHttpClient(withInterceptorsFromDi())]
@@ -2151,7 +2165,7 @@ class HttpClientModule {
2151
2165
  }
2152
2166
  i0.ɵɵngDeclareClassMetadata({
2153
2167
  minVersion: "12.0.0",
2154
- version: "21.0.1",
2168
+ version: "21.0.3",
2155
2169
  ngImport: i0,
2156
2170
  type: HttpClientModule,
2157
2171
  decorators: [{
@@ -2164,7 +2178,7 @@ i0.ɵɵngDeclareClassMetadata({
2164
2178
  class HttpClientJsonpModule {
2165
2179
  static ɵfac = i0.ɵɵngDeclareFactory({
2166
2180
  minVersion: "12.0.0",
2167
- version: "21.0.1",
2181
+ version: "21.0.3",
2168
2182
  ngImport: i0,
2169
2183
  type: HttpClientJsonpModule,
2170
2184
  deps: [],
@@ -2172,13 +2186,13 @@ class HttpClientJsonpModule {
2172
2186
  });
2173
2187
  static ɵmod = i0.ɵɵngDeclareNgModule({
2174
2188
  minVersion: "14.0.0",
2175
- version: "21.0.1",
2189
+ version: "21.0.3",
2176
2190
  ngImport: i0,
2177
2191
  type: HttpClientJsonpModule
2178
2192
  });
2179
2193
  static ɵinj = i0.ɵɵngDeclareInjector({
2180
2194
  minVersion: "12.0.0",
2181
- version: "21.0.1",
2195
+ version: "21.0.3",
2182
2196
  ngImport: i0,
2183
2197
  type: HttpClientJsonpModule,
2184
2198
  providers: [withJsonpSupport().ɵproviders]
@@ -2186,7 +2200,7 @@ class HttpClientJsonpModule {
2186
2200
  }
2187
2201
  i0.ɵɵngDeclareClassMetadata({
2188
2202
  minVersion: "12.0.0",
2189
- version: "21.0.1",
2203
+ version: "21.0.3",
2190
2204
  ngImport: i0,
2191
2205
  type: HttpClientJsonpModule,
2192
2206
  decorators: [{