emberx-select icon indicating copy to clipboard operation
emberx-select copied to clipboard

ReferenceError: event is not defined - Firefox

Open aafaq-hassan-confiz opened this issue 6 years ago • 6 comments

I have just installed from master branch and on firefox (any version) following error shows in developer console:

"ReferenceError: event is not defined"

aafaq-hassan-confiz avatar Nov 11 '18 09:11 aafaq-hassan-confiz

I observe the same issue on FF.

wuarmin avatar Dec 18 '18 07:12 wuarmin

Thanks for reporting this! I'm going to try and take a look tonight / over the weekend / over the break.

Robdel12 avatar Dec 21 '18 16:12 Robdel12

I tried testing XSelect v4.0.0-beta.2 on codesandbox with Firefox 63 & 65 and couldn't reproduce. https://codesandbox.io/s/kkw0nk5j6v (you might have to edit a file, & hit save for the server to start on codesandbox 🤷‍♂️ )

Could anyone provide more info or a reproduction? or an error stack trade screenshot?

CodeSandbox
Small description for my-app goes here

Robdel12 avatar Dec 21 '18 21:12 Robdel12

+1 Very annoying.

aandis avatar Feb 14 '19 17:02 aandis

@Robdel12 screenshot if it helps.

select

aandis avatar Feb 14 '19 17:02 aandis

I can't reproduce this (Firefox 68) but I got an error from Sentry with this exact issue. Sentry says that it happens in __setDefaultValues like others here are mentioning.

What I found interesting was that looking at the code for __setDefaultValues we see (this was checked today) this

__setDefaultValues() {
    let canSet = !this.isDestroying && !this.isDestroyed;

    if (canSet && this.get('value') == null) {
      // `onChange` is the default event we use
      this._handleAction('onChange', this._getValue(), event);
    }
  },

That event variable that's passed to handleAction is nowhere to be found on this code (not passed as argument, defined as parameter, local variable). I thought "of course, that must be it". But while debugging I found that event is actually defined, so I assumed it's some implicit global variable (because in both Chrome and Firefox it wasn't undefined).

Even more interesting is that in MDN there are some notes regarding to this (https://developer.mozilla.org/en-US/docs/Web/API/Window/event). Interesting, about compatibility... it says that Firefox started supporting this in version 63/65 but it was reverted.

Also interesting is that the Sentry report I got was from a Firefox of version 64. In the MDN page they recommend: This property can be fragile, in that there may be situations in which the returned Event is not the expected value. In addition, Window.event is not accurate for events dispatched within shadow trees.

So I think only a subset of Firefox versions are affected by this? (maybe 64). Not sure the solution, but maybe explicitly invoke handleAction with window.event ?

corrspt avatar Jul 18 '19 11:07 corrspt