• Hey!

    Here is Matthew, developer behind the Real Cookie Banner plugin. ??

    I have found an issue with NitroPack which does not allow our main feature to work as expected. In technical words, we are trying to override the window.addEventListener and document.addEventListener to delay execution of blocked content which needs user consent (GDPR).

    Unfortunately, we get the following error:

    TypeError: Cannot assign to read only property 'addEventListener' of object '#<HTMLDocument>'

    The root cause for this is NitroPack and how it overrides the addEventListener functionality, too:

    flameshot_screenshot

    Is it intentional, that writable, configurable and enumerable are disabled through your defineProperty? If you pass only value to Object.defineProperty, all this fields default to false. By default, browsers are defining .addEventListener as writable, configurable and enumarable to true.

    I think this is a bug, and you should consider overriding addEventListener in the following way to not modify the object descriptor itself: window.addEventListener = function() { ...

    Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty

    Regards,
    Matthew ??

Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Technical] addEventListener can no longer be overriden’ is closed to new replies.