Skip to content

Commit 80de542

Browse files
committed
Update AbortController to more recent polyfill
The `abort-controller` package hasn't been updated since 2019, and is missing a number of useful features from the current DOM specification. So, switch to `abortcontroller-polyfill` to get a more modern implementation. Fixes #42042 and #50015.
1 parent 43f464b commit 80de542

3 files changed

Lines changed: 24 additions & 15 deletions

File tree

packages/react-native/Libraries/Core/setUpXHR.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@ polyfillGlobal('URL', () => require('../Blob/URL').URL);
3636
polyfillGlobal('URLSearchParams', () => require('../Blob/URL').URLSearchParams);
3737
polyfillGlobal(
3838
'AbortController',
39-
() => require('abort-controller/dist/abort-controller').AbortController, // flowlint-line untyped-import:off
39+
() =>
40+
require('abortcontroller-polyfill/dist/abortsignal-ponyfill')
41+
.AbortController, // flowlint-line untyped-import:off
4042
);
4143
polyfillGlobal(
4244
'AbortSignal',
43-
() => require('abort-controller/dist/abort-controller').AbortSignal, // flowlint-line untyped-import:off
45+
() =>
46+
require('abortcontroller-polyfill/dist/abortsignal-ponyfill').AbortSignal, // flowlint-line untyped-import:off
4447
);

packages/react-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
"@react-native/js-polyfills": "0.83.0-main",
167167
"@react-native/normalize-colors": "0.83.0-main",
168168
"@react-native/virtualized-lists": "0.83.0-main",
169-
"abort-controller": "^3.0.0",
169+
"abortcontroller-polyfill": "^1.7.7",
170170
"anser": "^1.4.9",
171171
"ansi-regex": "^5.0.0",
172172
"babel-jest": "^29.7.0",

yarn.lock

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,20 @@
10431043
"@babel/parser" "^7.27.2"
10441044
"@babel/types" "^7.27.1"
10451045

1046-
"@babel/traverse--for-generate-function-map@npm:@babel/traverse@^7.25.3", "@babel/traverse@^7.25.3", "@babel/traverse@^7.25.9", "@babel/traverse@^7.26.8":
1046+
"@babel/traverse--for-generate-function-map@npm:@babel/traverse@^7.25.3":
1047+
version "7.26.9"
1048+
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.26.9.tgz#4398f2394ba66d05d988b2ad13c219a2c857461a"
1049+
integrity sha512-ZYW7L+pL8ahU5fXmNbPF+iZFHCv5scFak7MZ9bwaRPLUhHh7QQEMjZUg0HevihoqCM5iSYHN61EyCoZvqC+bxg==
1050+
dependencies:
1051+
"@babel/code-frame" "^7.26.2"
1052+
"@babel/generator" "^7.26.9"
1053+
"@babel/parser" "^7.26.9"
1054+
"@babel/template" "^7.26.9"
1055+
"@babel/types" "^7.26.9"
1056+
debug "^4.3.1"
1057+
globals "^11.1.0"
1058+
1059+
"@babel/traverse@^7.25.3", "@babel/traverse@^7.25.9", "@babel/traverse@^7.26.8":
10471060
version "7.26.9"
10481061
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.26.9.tgz#4398f2394ba66d05d988b2ad13c219a2c857461a"
10491062
integrity sha512-ZYW7L+pL8ahU5fXmNbPF+iZFHCv5scFak7MZ9bwaRPLUhHh7QQEMjZUg0HevihoqCM5iSYHN61EyCoZvqC+bxg==
@@ -2668,12 +2681,10 @@
26682681
resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.8.10.tgz#a1337ca426aa61cef9fe15b5b28e340a72f6fa99"
26692682
integrity sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==
26702683

2671-
abort-controller@^3.0.0:
2672-
version "3.0.0"
2673-
resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392"
2674-
integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==
2675-
dependencies:
2676-
event-target-shim "^5.0.0"
2684+
abortcontroller-polyfill@^1.7.7:
2685+
version "1.7.8"
2686+
resolved "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.8.tgz#fe8d4370403f02e2aa37e3d2b0b178bae9d83f49"
2687+
integrity sha512-9f1iZ2uWh92VcrU9Y8x+LdM4DLj75VE0MJB8zuF1iUnroEptStw+DQ8EQPMUdfe5k+PkB1uUfDQfWbhstH8LrQ==
26772688

26782689
accepts@^1.3.7, accepts@~1.3.7:
26792690
version "1.3.8"
@@ -4515,11 +4526,6 @@ etag@~1.8.1:
45154526
resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887"
45164527
integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==
45174528

4518-
event-target-shim@^5.0.0:
4519-
version "5.0.1"
4520-
resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789"
4521-
integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==
4522-
45234529
eventemitter3@^5.0.1:
45244530
version "5.0.1"
45254531
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-5.0.1.tgz#53f5ffd0a492ac800721bb42c66b841de96423c4"

0 commit comments

Comments
 (0)