Closed RomkeVdMeulen closed 6 years ago
Ah, I seem to have misdiagnosed the problem: the reason that this code works in modern browsers is because they have a Header implementation whose entries()
returns an iterator that is also an iterable (its Symbol.iterator
method returns itself). The Headers polyfill from polyfill.io doesn't seem to have this. I'll report the issue there. Apologies for the false alarm.
The current
Array.from
polyfill accepts iterable objects and 'array-like' objects, but not iterators. This is correct according to the ES6 specification. However, callingArray.from()
with an iterator rather than an iterable using the native implementations in Edge 42, Chrome 70 and Firefox 63 does give the result you would expect: all the values pointed to by the iterator are placed into a new array. This results in a difference in behavior between IE and other browsers. I suggest adding support for iterators to the polyfill.Case in point (this caused our team quite some headaches to hunt down):
In IE, using the polyfill, this gives an empty array. In browsers with native implementations you get
[["content-type", "text/plain"]]
.