Skip to content

Commit 5447196

Browse files
janicduplessiskelset
authored andcommitted
Remove vendored fetch polyfill, update to [email protected] (#24418)
Summary: The original reason for vendoring the fetch polyfill was to remove the default blob response type but this was reverted. Here's a little history around the fetch polyfill and the blob issue: - Original commit introducing the vendored polyfill: #19333, the goal was to fix a memory leak because our blob implementation doesn't release resources automatically. Not an ideal fix but since the issue was pretty severe and the infra for a proper fix was not in place. - This introduced an issue when downloading images using `fetch` which was fixed by #22063 which re-added the default blob content type. However that re-introduced the original fetch memory leak. - We have better infra now with jsi and I was able to get blob deallocation working, see #24405 Currently the vendored fetch polyfill is useless since it was changed back to the original version. We can just use the npm version again. I also updated to 3.0 which brings better spec compliance and support for cancellation via `AbortController`, https://github.com/github/fetch/releases/tag/v3.0.0. ## Changelog [General] [Changed] - Remove vendored fetch polyfill, update to [email protected] Pull Request resolved: #24418 Differential Revision: D14932683 Pulled By: cpojer fbshipit-source-id: 915e3d25978e8b9d7507ed807e7fba45aa88385a
1 parent 1b8f7e7 commit 5447196

File tree

5 files changed

+8
-536
lines changed

5 files changed

+8
-536
lines changed

Libraries/Core/setUpGlobals.js

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ if (global.window === undefined) {
2121
global.window = global;
2222
}
2323

24+
if (global.self === undefined) {
25+
global.self = global;
26+
}
27+
2428
// Set up process
2529
global.process = global.process || {};
2630
global.process.env = global.process.env || {};

Libraries/Network/fetch.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
'use strict';
1313

14-
const whatwg = require('../vendor/core/whatwg-fetch');
14+
const whatwg = require('whatwg-fetch');
1515

1616
if (whatwg && whatwg.fetch) {
1717
module.exports = whatwg;

0 commit comments

Comments
 (0)