Skip to content
Permalink
Browse files

Remove vendored fetch polyfill, update to whatwg-fetch@3.0 (#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 whatwg-fetch@3.0
Pull Request resolved: #24418

Differential Revision: D14932683

Pulled By: cpojer

fbshipit-source-id: 915e3d25978e8b9d7507ed807e7fba45aa88385a
  • Loading branch information...
janicduplessis authored and kelset committed May 31, 2019
1 parent 1b8f7e7 commit 54471963e02e15e42d48764de9dfc67aab23c2fb
Showing with 8 additions and 536 deletions.
  1. +4 −0 Libraries/Core/setUpGlobals.js
  2. +1 −1 Libraries/Network/fetch.js
  3. +0 −533 Libraries/vendor/core/whatwg-fetch.js
  4. +2 −1 package.json
  5. +1 −1 yarn.lock
@@ -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 || {};
@@ -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;

0 comments on commit 5447196

Please sign in to comment.
You can’t perform that action at this time.