Skip to content

Commit

Permalink
Remove vendored fetch polyfill, update to [email protected] (#24418)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
janicduplessis authored and facebook-github-bot committed May 31, 2019
1 parent a1bfb28 commit bccc92d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 536 deletions.
4 changes: 4 additions & 0 deletions Libraries/Core/setUpGlobals.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ if (global.window === undefined) {
global.window = global;
}

if (global.self === undefined) {
global.self = global;
}

// Set up process
global.process = global.process || {};
global.process.env = global.process.env || {};
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Network/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

'use strict';

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

if (whatwg && whatwg.fetch) {
module.exports = whatwg;
Expand Down
Loading

0 comments on commit bccc92d

Please sign in to comment.