Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE11: Enumerating Object properties has Symbol polyfill keys in them #2825

Open
petetnt opened this issue Feb 21, 2018 · 4 comments
Open

IE11: Enumerating Object properties has Symbol polyfill keys in them #2825

petetnt opened this issue Feb 21, 2018 · 4 comments

Comments

@petetnt
Copy link

petetnt commented Feb 21, 2018

Sorry in advance if this actually has nothing to do with Closure Compiler directly. I'd assume that it's done on purpose (or not?) and mostly looking for alternative ways to prevent the issue.

We have been debugging some issues caused by Google Maps version >3.29 on Internet Explorer 11 for a while now and finally most likely found a root cause in

apollographql/apollo-client#3043 (comment)

TL;DR: Recursively enumerating Object properties causes endless loops (or at least really really deep recursion) on IE11 because Google Maps now uses a version of Symbol polyfill that adds the keys to object. Maybe related to #2448 or similar?

Steps to reproduce:

Option 1:

  • Use the Apollo repo linked in the issue

Option 2:

  • Add a blank page with Google Maps v3.30 embedded
  • Inline some large-ish object
  • deepFreeze

It's hard to say what happened between the versions v3.29 and v3.30 that caused the breakage (versions updated, compiler flags changed) but hopefully you Googlers can check the menorepo or ask across the table or something (😂) to find out more.

@petetnt
Copy link
Author

petetnt commented Feb 26, 2018

I assume this is the commit which caused the regression? 83857a5#diff-d22d8209fc94aff372133012210c694c

thoughts @shicks @blickly? I guess this can be worked around by checking if the symbol is polyfilled with typeof Symbol('') !== 'string'

@brad4d
Copy link
Contributor

brad4d commented Aug 16, 2018

See also related issue #3052

There the problem is that libraries are using typeof x to determine whether x is a string or a symbol, and that doesn't work properly when the symbol comes from our polyfill.

@brad4d brad4d self-assigned this Aug 16, 2018
@brad4d
Copy link
Contributor

brad4d commented Aug 16, 2018

Just left a suggested workaround on #3052.
If you're already using a JS library that provides a better Symbol polyfill than the one provided by closure-compiler, you may be able to resolve this problem by just making sure that library loads before the Maps API (or any other JS code compiled with closure-compiler).

This will ensure that the closure-compiler polyfill code sees an already-polyfilled Symbol and does not try to add it's own polyfill for it.

@concavelenz
Copy link
Contributor

Generally, polyfilling "WeakMap" or "symbol" is going to be problematic regardless of how you do it. I think the best solution would be to ask the Maps team to be careful not to use these in their API library. Using any polyfill on a page you don't own is generally problematic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants