polyfill-service: IE11 bug with Symbols and Enumerables exposed by lodash.omit

Bountysource

I’ve been trying to track this one down for a while now, and though I know where the failure is, it isn’t clear as to the best resolution.

Here is an isolated codepen that demonstrates that when poly+lodash+IE11 is combined, will blow up with:

"TypeError: Unable to get property '@@__symbol:iterator0.0365778717409362961' of undefined or null reference
   at propertyIsEnumerable (https://cdn.polyfill.io/v2/polyfill.js?features=default,Array.prototype.@@iterator:244:3)
   at Anonymous function (https://cdn.jsdelivr.net/lodash/4.17.4/lodash.js:6056:9)
   at arrayFilter (https://cdn.jsdelivr.net/lodash/4.17.4/lodash.js:603:7)
   at Anonymous function (https://cdn.jsdelivr.net/lodash/4.17.4/lodash.js:6055:7)
   at Anonymous function (https://cdn.jsdelivr.net/lodash/4.17.4/lodash.js:6070:9)
   at baseGetAllKeys (https://cdn.jsdelivr.net/lodash/4.17.4/lodash.js:3064:7)
   at getAllKeysIn (https://cdn.jsdelivr.net/lodash/4.17.4/lodash.js:5903:7)
   at Anonymous function (https://cdn.jsdelivr.net/lodash/4.17.4/lodash.js:13485:7)
   at apply (https://cdn.jsdelivr.net/lodash/4.17.4/lodash.js:496:15)
   at Anonymous function (https://cdn.jsdelivr.net/lodash/4.17.4/lodash.js:6600:9)"

http://codepen.io/asilvas/pen/VPaOjz

Deps:

This is the line of the failure: https://github.com/Financial-Times/polyfill-service/blob/master/polyfills/Symbol/polyfill.js#L84

Where this[internalSymbol]['@@' + uid] assumes that this[internalSymbol] is always defined, but is not the case. Of course, might just be able to add a conditional and be done with it, but appears this code behaves this way for a reason. So I’m guessing a resolution is needed elsewhere.

I’ve also been able to force this error (by overriding native polyfills) in other browsers like Chrome, but the codepen won’t do that in its current form.

What appears to be a near identical issue was found before with core-js in reference to lodash: https://github.com/lodash/lodash/issues/2308

Which was supposedly fixed. It’s not clear if that fix could somehow help in addressing this.

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 6
  • Comments: 16 (8 by maintainers)

Commits related to this issue

Most upvoted comments

It seems this bug also effects Safari versions < 9. I also want to give it a try. This is hitting us pretty badly.

I have run into this issue as well. What seems to be happening is that lodash calls Object.prototype.propertyIsEnumerable. However, polyfill-service’s implementation of propertyIsEnumerable seems to be incorrect for polyfilled Symbols. The polyfill-service implementation returns true for symbol properties, even if they were defined with {enumerable: false}, which seems to be a bug.

Note that this bug affects any code that uses Object.prototype.propertyIsEnumerable when in combination with the Array.prototype.@@iterator polyfill-service. I am still not sure exactly how propertyIsEnumerable is returning true for the iterator symbol on the Array prototype, but that’s what I think is happening.

@satazor It will be out in v3.17 😃

Sorry @asilvas, I’ve been working on our selenium testing suite as their are two bugs in it which are stopping me from making a new release of the service. Once I’ve finished this work I will be taking a look through the issues on the project.

@hannesj Thanks for offering to help out on this issue 😄 If you need any help, feel free to message on this issue and tag me.

@asilvas I could take a look on this, as this affects us also.

@rhalukongor don’t forget to claim the bounty, thanks!

@rhalukongor thanks very much for the fix!

@JakeChampion was the fix already deployed?

There was an issue created in lodash that’s exactly the same bug: https://github.com/lodash/lodash/issues/2308

Apparently the bug on core-js was fixed in https://github.com/zloirock/core-js/commit/78770786a4e5f2f87ea32b4dada46b9ce0a92887. Perhaps we can port the fix somehow?

Sorry @asilvas we only just started hitting this. We’ve been using polyfill with no problems for awhile. We haven’t found what changes yet

UPDATE: it looks like our issue is with https://github.com/zenorocha/clipboard.js & polyfill on ie11 UPDATE 2: it looks like lodash and polyfill.