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

triggerMap iteration is broken when Array.prototype is polluted #372

Open
eligrey opened this issue Sep 3, 2020 · 2 comments
Open

triggerMap iteration is broken when Array.prototype is polluted #372

eligrey opened this issue Sep 3, 2020 · 2 comments
Milestone

Comments

@eligrey
Copy link

eligrey commented Sep 3, 2020

#269 is not fixed. Please see this comment.

Some advertising scripts pollute Array.prototype (e.g. Array.prototype.clear), which is iterated by micromodal in these two locations and ends up attempting to iterate over a function, leading to a TypeError.

https://github.com/ghosh/Micromodal/blob/master/lib/src/index.js#L267

https://github.com/ghosh/Micromodal/blob/master/lib/src/index.js#L290

Micromodal should use Object.keys(triggerMap).forEach() in these two locations to prevent this issue from happening.

@eligrey eligrey changed the title triggerMap iteration is broken when Array.prototype is polluted triggerMap iteration is broken when Array.prototype is polluted Sep 3, 2020
anujtenani added a commit to anujtenani/Micromodal that referenced this issue Feb 28, 2021
@jukibom
Copy link

jukibom commented Feb 3, 2022

@ghosh any chance you could please pull in the fix referenced above (anujtenani@25c8607)?

It does indeed fix the issue when other libraries pollute the array prototype:

image

@dkniffin dkniffin added this to the pre-1.0 milestone Mar 21, 2025
@dkniffin
Copy link
Contributor

If anyone wants to help me out by making the PR and adding tests, that would be great 😄 Otherwise, I'll try and get this fixed sometime soon.

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