Diokuz / baron

Native scroll with custom scrollbar
MIT License
776 stars 124 forks source link

Blocked a frame with origin "..." from accessing a cross-origin frame #170

Closed aik099 closed 6 years ago

aik099 commented 6 years ago

When there are <iframe> elements on the page, then window.length property (see https://developer.mozilla.org/en-US/docs/Web/API/Window/length) will indicate iframe count.

Unfortunately https://github.com/Diokuz/baron/blob/master/src/core.js#L298-L301 code, that sets event listeners on the elements considers elements with .length property to be an array and attempts to iterate over them.

In my case iframes come from different domain and that causes Blocked a frame with origin "..." from accessing a cross-origin frame error to happen.

Diokuz commented 6 years ago

Good point! Thanks!

Will fix that in a few days.

aik099 commented 6 years ago

I've fixed it locally by changing if (event.element.length) { into if (event.element !== scopedWindow && event.element.length) {.

Diokuz commented 6 years ago

Fixed in baron@3.0.2

@aik099 thanks again)

aik099 commented 6 years ago

I'm not seeing this release at https://github.com/Diokuz/baron/releases. Do you tag new releases, so that people could compare changes made between releases?